11import test from 'ava' ;
2-
2+ import { outdent } from 'outdent' ;
33import { parse , nodeToString } from '../../lib/index.js' ;
44
55test ( 'basic' , ( t ) => {
@@ -305,6 +305,7 @@ test('mixin parameters with functions (#122)', (t) => {
305305 const { first } = root ;
306306
307307 t . is ( first . name , 'mixin' ) ;
308+ t . is ( first . mixin , true ) ;
308309 t . is ( nodeToString ( root ) , less ) ;
309310} ) ;
310311
@@ -321,6 +322,7 @@ test('mixin parameters with multiple parens', (t) => {
321322 const { first, last } = root ;
322323
323324 t . is ( first . name , 'mixin' ) ;
325+ t . is ( first . mixin , true ) ;
324326 t . is ( last . selector , '.two' ) ;
325327 t . is ( nodeToString ( root ) , less ) ;
326328} ) ;
@@ -335,6 +337,7 @@ test('support mixin starts with a digit', (t) => {
335337 const { first, last } = root ;
336338
337339 t . is ( first . name , '3D' ) ;
340+ t . is ( first . mixin , true ) ;
338341 t . is ( last . selector , '.3D(...)' ) ;
339342 t . is ( nodeToString ( root ) , less ) ;
340343} ) ;
@@ -349,6 +352,30 @@ test('support mixin starts with a backslash', (t) => {
349352 const { first, last } = root ;
350353
351354 t . is ( first . name , '\\123' ) ;
355+ t . is ( first . mixin , true ) ;
352356 t . is ( last . name , '\\x' ) ;
353357 t . is ( nodeToString ( root ) , less ) ;
354358} ) ;
359+
360+ test ( 'support mixin looks like a color or number' , ( t ) => {
361+ const less = outdent `
362+ #eee,
363+ .3{
364+ color: red;
365+ }
366+
367+ a {
368+ #eee();
369+ .3()
370+ }
371+ ` ;
372+
373+ const root = parse ( less ) ;
374+ const node = root . nodes [ 1 ] . nodes ;
375+
376+ t . is ( node [ 0 ] . name , 'eee' ) ;
377+ t . is ( node [ 0 ] . mixin , true ) ;
378+ t . is ( node [ 1 ] . name , '3' ) ;
379+ t . is ( node [ 1 ] . mixin , true ) ;
380+ t . is ( nodeToString ( root ) , less ) ;
381+ } ) ;
0 commit comments