File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 88 //-------------------------------------------------------------------------
99
1010 function ValidationTestCase ( info ) {
11- var i , len , prop ;
11+ var i , len , prop , msg ;
1212
1313 YUITest . TestCase . call ( this , info ) ;
1414 this . valid = info . valid ;
1515 this . invalid = info . invalid ;
1616 this . property = info . property ;
1717 this . name = "Tests for " + this . property ;
18+ this . _should . error = { } ;
1819
1920 for ( i = 0 , len = this . valid . length ; i < len ; i ++ ) {
2021 this [ "'" + this . valid [ i ] + "' is a valid value for '" + this . property + "'" ] = function ( value ) {
3334 } ( prop , this . invalid [ prop ] ) ;
3435 }
3536 }
37+
38+ for ( prop in this . error ) {
39+ if ( this . error . hasOwnProperty ( prop ) ) {
40+ msg = "'" + prop + "' is an invalid value for '" + this . property + "'" ;
41+ this [ msg ] = function ( value ) {
42+ return function ( ) {
43+ this . _testSyntaxError ( value ) ;
44+ } ;
45+ } ( prop ) ;
46+ this . _should . error [ msg ] = this . error [ prop ] ;
47+ }
48+ }
3649 }
3750
3851 ValidationTestCase . prototype = new YUITest . TestCase ( ) ;
5467 var result = parser . parse ( ".foo { " + this . property + ":" + value + "}" ) ;
5568 } ;
5669
70+ ValidationTestCase . prototype . _testSyntaxError = function ( value ) {
71+ var parser = new Parser ( { strict : true , starHack : true , underscoreHack : true } ) ;
72+ var result = parser . parse ( ".foo { " + this . property + ":" + value + "}" ) ;
73+ } ;
74+
5775
5876 //-------------------------------------------------------------------------
5977 // Validation Tests
You can’t perform that action at this time.
0 commit comments