@@ -21,10 +21,8 @@ export default async function tape() {
2121 failures += await test ( 'ignores invalid entries' , { basename : 'ignore' } )
2222 failures += await test ( 'supports complex entries' , { basename : 'complex' } )
2323 failures += await test ( 'supports all spec examples' , { basename : 'spec-examples' } )
24- failures += await test ( 'supports spec compliant mixing of nested rules and declarations' , { basename : 'mixing-nested-rules-and-declarations-spec' } )
25- failures += await test ( 'supports legacy mixing of nested rules and declarations' , { basename : 'mixing-nested-rules-and-declarations-legacy' , pluginOptions : { allowDeclarationsAfterNestedRules : true } } )
2624
27- let mixinPlugin = ( ) => {
25+ let mixinPluginRule = ( ) => {
2826 return {
2927 postcssPlugin : 'mixin' ,
3028 AtRule : {
@@ -34,20 +32,35 @@ export default async function tape() {
3432 } ,
3533 }
3634 }
37- mixinPlugin . postcss = true
38- failures += await test ( 'supports other visitors' , { basename : 'mixin' } , mixinPlugin )
35+
36+ mixinPluginRule . postcss = true
37+ failures += await test ( 'supports other visitors (mixin rule)' , { basename : 'mixin-rule' } , mixinPluginRule )
38+
39+ let mixinPluginDeclaration = ( ) => {
40+ return {
41+ postcssPlugin : 'mixin' ,
42+ AtRule : {
43+ mixin ( node ) {
44+ node . replaceWith ( 'color: blue;' )
45+ } ,
46+ } ,
47+ }
48+ }
49+
50+ mixinPluginDeclaration . postcss = true
51+ failures += await test ( 'supports other visitors (mixin declaration)' , { basename : 'mixin-declaration' } , mixinPluginDeclaration )
3952
4053 return failures === 0
4154}
4255
4356async function test ( name , init , ...plugins ) {
44- const { basename, pluginOptions } = Object ( init )
57+ const { basename } = Object ( init )
4558
4659 let sourceUrl = new URL ( `test/${ basename } .css` , workingUrl )
4760 let expectUrl = new URL ( `test/${ basename } .expect.css` , workingUrl )
4861 let resultUrl = new URL ( `test/${ basename } .result.css` , workingUrl )
4962
50- plugins . unshift ( plugin ( pluginOptions ) )
63+ plugins . unshift ( plugin ( ) )
5164
5265 let sourceCss = await fs . readFile ( sourceUrl , 'utf8' )
5366 let expectCss = await fs . readFile ( expectUrl , 'utf8' )
0 commit comments