diff options
Diffstat (limited to '')
-rw-r--r-- | packages/astro/test/0-css.test.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/astro/test/0-css.test.js b/packages/astro/test/0-css.test.js index 9371673d4..2120452eb 100644 --- a/packages/astro/test/0-css.test.js +++ b/packages/astro/test/0-css.test.js @@ -170,6 +170,15 @@ describe('CSS', function () { // 2. check CSS expect(bundledCSS).to.match(new RegExp(`.${moduleClass}[^{]*{font-family:fantasy`)); }); + + it('.module.css ordering', () => { + const globalStyleClassIndex = bundledCSS.indexOf('.module-ordering'); + const moduleStyleClassIndex = bundledCSS.indexOf('._module_ordering'); + // css module has higher priority than global style + expect(globalStyleClassIndex).to.be.greaterThan(-1); + expect(moduleStyleClassIndex).to.be.greaterThan(-1); + expect(moduleStyleClassIndex).to.be.greaterThan(globalStyleClassIndex); + }); }); describe('Vue', () => { @@ -412,6 +421,17 @@ describe('CSS', function () { ); }); + it('.module.css ordering', () => { + const globalStyleTag = $('style[data-vite-dev-id$="default.css"]'); + const moduleStyleTag = $('link[href$="ModuleOrdering.module.css"]'); + const globalStyleClassIndex = globalStyleTag.index(); + const moduleStyleClassIndex = moduleStyleTag.index(); + // css module has higher priority than global style + expect(globalStyleClassIndex).to.be.greaterThan(-1); + expect(moduleStyleClassIndex).to.be.greaterThan(-1); + expect(moduleStyleClassIndex).to.be.greaterThan(globalStyleClassIndex); + }); + it('.css?raw return a string', () => { const el = $('#css-raw'); expect(el.text()).to.equal('.foo {color: red;}'); |