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 8
8
//-------------------------------------------------------------------------
9
9
10
10
function ValidationTestCase ( info ) {
11
- var i , len , prop ;
11
+ var i , len , prop , msg ;
12
12
13
13
YUITest . TestCase . call ( this , info ) ;
14
14
this . valid = info . valid ;
15
15
this . invalid = info . invalid ;
16
16
this . property = info . property ;
17
17
this . name = "Tests for " + this . property ;
18
+ this . _should . error = { } ;
18
19
19
20
for ( i = 0 , len = this . valid . length ; i < len ; i ++ ) {
20
21
this [ "'" + this . valid [ i ] + "' is a valid value for '" + this . property + "'" ] = function ( value ) {
33
34
} ( prop , this . invalid [ prop ] ) ;
34
35
}
35
36
}
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
+ }
36
49
}
37
50
38
51
ValidationTestCase . prototype = new YUITest . TestCase ( ) ;
54
67
var result = parser . parse ( ".foo { " + this . property + ":" + value + "}" ) ;
55
68
} ;
56
69
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
+
57
75
58
76
//-------------------------------------------------------------------------
59
77
// Validation Tests
You can’t perform that action at this time.
0 commit comments