|
1477 | 1477 | var result = parser.parse(".foo {\n color: #fff;\n}"); |
1478 | 1478 | }, |
1479 | 1479 |
|
| 1480 | + "Test rule with star hack property": function(){ |
| 1481 | + var parser = new Parser({ strict: true, starHack: true}); |
| 1482 | + parser.addListener("property", function(event){ |
| 1483 | + Assert.areEqual("*color", event.property.toString()); |
| 1484 | + Assert.areEqual("color", event.property.text); |
| 1485 | + Assert.areEqual("#fff", event.value.toString()); |
| 1486 | + Assert.areEqual(5, event.property.col, "Property column should be 5."); |
| 1487 | + Assert.areEqual(2, event.property.line, "Property line should be 2."); |
| 1488 | + Assert.areEqual(5, event.col, "Event column should be 5."); |
| 1489 | + Assert.areEqual(2, event.line, "Event line should be 2."); |
| 1490 | + Assert.areEqual(13, event.value.parts[0].col, "First part column should be 13."); |
| 1491 | + Assert.areEqual(2, event.value.parts[0].line, "First part line should be 2."); |
| 1492 | + }); |
| 1493 | + var result = parser.parse(".foo {\n *color: #fff;\n}"); |
| 1494 | + }, |
| 1495 | + |
1480 | 1496 | "Test rule with space after property name": function(){ |
1481 | 1497 | var parser = new Parser({ strict: true}); |
1482 | 1498 | parser.addListener("property", function(event){ |
|
2271 | 2287 | ValidationTestCase.prototype = new YUITest.TestCase(); |
2272 | 2288 |
|
2273 | 2289 | ValidationTestCase.prototype._testValidValue = function(value){ |
2274 | | - var parser = new Parser({ strict: true}); |
| 2290 | + var parser = new Parser({ strict: true, starHack: true, underscoreHack: true }); |
2275 | 2291 | parser.addListener("property", function(event){ |
2276 | 2292 | Assert.isNull(event.invalid); |
2277 | 2293 | }); |
2278 | 2294 | var result = parser.parse(".foo { " + this.property + ":" + value + "}"); |
2279 | 2295 | }; |
2280 | 2296 |
|
2281 | 2297 | ValidationTestCase.prototype._testInvalidValue = function(value, message){ |
2282 | | - var parser = new Parser({ strict: true}); |
| 2298 | + var parser = new Parser({ strict: true, starHack: true, underscoreHack: true }); |
2283 | 2299 | parser.addListener("property", function(event){ |
2284 | 2300 | Assert.isNotNull(event.invalid); |
2285 | 2301 | Assert.areEqual(message, event.invalid.message); |
|
2750 | 2766 | } |
2751 | 2767 | })); |
2752 | 2768 |
|
| 2769 | + // Test star hack |
| 2770 | + suite.add(new ValidationTestCase({ |
| 2771 | + property: "*z-index", |
| 2772 | + |
| 2773 | + valid: [ |
| 2774 | + "1", |
| 2775 | + "auto", |
| 2776 | + "inherit" |
| 2777 | + ], |
| 2778 | + |
| 2779 | + invalid: { |
| 2780 | + "foo" : "Expected (<integer> | auto | inherit) but found 'foo'." |
| 2781 | + } |
| 2782 | + })); |
| 2783 | + |
2753 | 2784 |
|
2754 | 2785 |
|
2755 | 2786 | YUITest.TestRunner.add(suite); |
|
0 commit comments