Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Side by Side Diff: third_party/WebKit/LayoutTests/css3/filters/script-tests/filter-property-parsing.js

Issue 1987943002: [wip] unprefix filter Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 description("Test the parsing of the -webkit-filter property."); 1 description("Test the parsing of the filter property.");
2 2
3 // These have to be global for the test helpers to see them. 3 // These have to be global for the test helpers to see them.
4 var stylesheet, cssRule, declaration; 4 var stylesheet, cssRule, declaration;
5 var styleElement = document.createElement("style"); 5 var styleElement = document.createElement("style");
6 document.head.appendChild(styleElement); 6 document.head.appendChild(styleElement);
7 stylesheet = styleElement.sheet; 7 stylesheet = styleElement.sheet;
8 8
9 function testFilterRule(description, rule, expectedValue) 9 function testFilterRule(description, rule, expectedValue)
10 { 10 {
11 if (expectedValue === undefined) 11 if (expectedValue === undefined)
12 expectedValue = rule; 12 expectedValue = rule;
13 13
14 debug(""); 14 debug("");
15 debug(description + " : " + rule); 15 debug(description + " : " + rule);
16 16
17 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0); 17 stylesheet.insertRule("body { filter: " + rule + "; }", 0);
18 cssRule = stylesheet.cssRules.item(0); 18 cssRule = stylesheet.cssRules.item(0);
19 19
20 shouldBe("cssRule.type", "1"); 20 shouldBe("cssRule.type", "1");
21 21
22 declaration = cssRule.style; 22 declaration = cssRule.style;
23 shouldBe("declaration.length", "1"); 23 shouldBe("declaration.length", "1");
24 shouldBeEqualToString("declaration.getPropertyValue('-webkit-filter')", expe ctedValue); 24 shouldBeEqualToString("declaration.getPropertyValue('filter')", expectedValu e);
25 } 25 }
26 26
27 testFilterRule("Basic reference", "url('#a')", 'url("#a")'); 27 testFilterRule("Basic reference", "url('#a')", 'url("#a")');
28 testFilterRule("Bare unquoted reference converting to quoted form", "url(#a)", ' url("#a")'); 28 testFilterRule("Bare unquoted reference converting to quoted form", "url(#a)", ' url("#a")');
29 testFilterRule("Multiple references", "url('#a') url('#b')", 'url("#a") url("#b" )'); 29 testFilterRule("Multiple references", "url('#a') url('#b')", 'url("#a") url("#b" )');
30 testFilterRule("Reference as 2nd value", "grayscale(1) url('#a')", 'grayscale(1) url("#a")'); 30 testFilterRule("Reference as 2nd value", "grayscale(1) url('#a')", 'grayscale(1) url("#a")');
31 testFilterRule("Integer value", "grayscale(1)"); 31 testFilterRule("Integer value", "grayscale(1)");
32 testFilterRule("Percentage value", "grayscale(50%)"); 32 testFilterRule("Percentage value", "grayscale(50%)");
33 testFilterRule("Float value converts to integer", "grayscale(1.0)", "grayscale(1 )"); 33 testFilterRule("Float value converts to integer", "grayscale(1.0)", "grayscale(1 )");
34 testFilterRule("Zero value", "grayscale(0)"); 34 testFilterRule("Zero value", "grayscale(0)");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 testFilterRule("Three values with zero length", 104 testFilterRule("Three values with zero length",
105 "drop-shadow(0 0 0)", "drop-shadow(0px 0px 0px)"); 105 "drop-shadow(0 0 0)", "drop-shadow(0px 0px 0px)");
106 106
107 testFilterRule("Two values no color", "drop-shadow(1px 2px)"); 107 testFilterRule("Two values no color", "drop-shadow(1px 2px)");
108 108
109 testFilterRule("Multiple operations", 109 testFilterRule("Multiple operations",
110 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) inve rt(0.2) opacity(0.9) blur(5px) drop-shadow(green 1px 2px 3px)"); 110 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) inve rt(0.2) opacity(0.9) blur(5px) drop-shadow(green 1px 2px 3px)");
111 111
112 successfullyParsed = true; 112 successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698