@@ -245,6 +245,27 @@ function include(path, sandbox) {
245245 Assert . areEqual ( 2 , result . ruleset [ "adjoining-classes" ] ) ;
246246 Assert . areEqual ( 1 , result . ruleset [ "text-indent" ] ) ;
247247 Assert . areEqual ( 0 , result . ruleset [ "box-sizing" ] ) ;
248+ } ,
249+
250+ "Allow statement on one line with one rule should be added to report" : function ( ) {
251+ var report = CSSLint . verify ( ".foo.bar{}\n.baz.qux{} /* csslint allow: box-sizing */\nquux.corge{}" ) ;
252+ Assert . isTrue ( report . allow . hasOwnProperty ( "2" ) ) ;
253+ Assert . isTrue ( report . allow [ "2" ] . hasOwnProperty ( "box-sizing" ) ) ;
254+ } ,
255+
256+ "Allow statement on one line with multiple rules should be added to report" : function ( ) {
257+ var report = CSSLint . verify ( ".foo.bar{}\n.baz.qux{} /* csslint allow: box-sizing, box-model */\nquux.corge{}" ) ;
258+ Assert . isTrue ( report . allow . hasOwnProperty ( "2" ) ) ;
259+ Assert . isTrue ( report . allow [ "2" ] . hasOwnProperty ( "box-sizing" ) ) ;
260+ Assert . isTrue ( report . allow [ "2" ] . hasOwnProperty ( "box-model" ) ) ;
261+ } ,
262+
263+ "Allow statements on multiple lines for different rules should be added to report" : function ( ) {
264+ var report = CSSLint . verify ( ".foo.bar{}\n.baz.qux{} /* csslint allow: box-sizing */\nquux.corge{}\ngrault.garply{} /* csslint allow: box-model */" ) ;
265+ Assert . isTrue ( report . allow . hasOwnProperty ( "2" ) ) ;
266+ Assert . isTrue ( report . allow [ "2" ] . hasOwnProperty ( "box-sizing" ) ) ;
267+ Assert . isTrue ( report . allow . hasOwnProperty ( "4" ) ) ;
268+ Assert . isTrue ( report . allow [ "4" ] . hasOwnProperty ( "box-model" ) ) ;
248269 }
249270
250271 } ) ) ;
@@ -281,6 +302,30 @@ function include(path, sandbox) {
281302
282303 Assert . areEqual ( 1 , reporter . messages . length ) ;
283304 Assert . areEqual ( "error" , reporter . messages [ 0 ] . type ) ;
305+ } ,
306+
307+ "Allow statement should drop message about specific rule on specific line but not other lines" : function ( ) {
308+ var reporter = new CSSLint . _Reporter ( [ ] , { "fake-rule" : 1 } , { "3" : { "fake-rule" : true } } ) ;
309+ reporter . report ( "Foo" , 2 , 1 , { id : "fake-rule" } ) ;
310+ reporter . report ( "Bar" , 3 , 1 , { id : "fake-rule" } ) ;
311+
312+ Assert . areEqual ( 1 , reporter . messages . length ) ;
313+ } ,
314+
315+ "Allow statement should drop message about specific rule on specific line but not other rules" : function ( ) {
316+ var reporter = new CSSLint . _Reporter ( [ ] , { "fake-rule" : 1 , "fake-rule2" : 1 } , { "3" : { "fake-rule" : true } } ) ;
317+ reporter . report ( "Foo" , 3 , 1 , { id : "fake-rule" } ) ;
318+ reporter . report ( "Bar" , 3 , 1 , { id : "fake-rule2" } ) ;
319+
320+ Assert . areEqual ( 1 , reporter . messages . length ) ;
321+ } ,
322+
323+ "Allow statement should drop messages about multiple rules on specific line" : function ( ) {
324+ var reporter = new CSSLint . _Reporter ( [ ] , { "fake-rule" : 1 , "fake-rule2" : 1 } , { "3" : { "fake-rule" : true , "fake-rule2" : true } } ) ;
325+ reporter . report ( "Foo" , 3 , 1 , { id : "fake-rule" } ) ;
326+ reporter . report ( "Bar" , 3 , 1 , { id : "fake-rule2" } ) ;
327+
328+ Assert . areEqual ( 0 , reporter . messages . length ) ;
284329 }
285330
286331 } ) ) ;
@@ -2437,7 +2482,7 @@ background: -o-linear-gradient(top, #1e5799 ,#2989d8 ,#207cca ,#7db9e8 );
24372482 YUITest . TestRunner . add ( new YUITest . TestCase ( {
24382483
24392484 name : "Import IE Limit Rule Error" ,
2440-
2485+
24412486 "Using @import <= 31 times should not result in error" : function ( ) {
24422487
24432488 var result = CSSLint . verify ( withinLimitCss , { "import-ie-limit" : 1 } ) ;
0 commit comments