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

Side by Side Diff: LayoutTests/css3/blending/script-tests/blend-mode-property-parsing.js

Issue 684293004: Don't require getPropertyCSSValue in css3 tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 mix-blend-mode property."); 1 description("Test the parsing of the mix-blend-mode property.");
2 2
3 function jsWrapperClass(node)
4 {
5 if (!node)
6 return "[null]";
7 var string = Object.prototype.toString.apply(node);
8 return string.substr(8, string.length - 9);
9 }
10
11 function shouldBeType(expression, className, prototypeName, constructorName)
12 {
13 if (!prototypeName)
14 prototypeName = "Object";
15 if (!constructorName)
16 constructorName = "Function";
17 shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'");
18 shouldBe("jsWrapperClass(" + expression + ".__proto__)", "'" + prototypeName + "'");
19 shouldBe("jsWrapperClass(" + expression + ".constructor)", "'" + constructor Name + "'");
20 }
21
22 // 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.
23 var stylesheet, cssRule, declaration, blendModeRule, subRule; 4 var stylesheet, cssRule, declaration, blendModeRule, subRule;
24 var styleElement = document.createElement("style"); 5 var styleElement = document.createElement("style");
25 document.head.appendChild(styleElement); 6 document.head.appendChild(styleElement);
26 stylesheet = styleElement.sheet; 7 stylesheet = styleElement.sheet;
27 8
28 function testBlendModeRule(description, rule, expectedLength, expectedValue, exp ectedTypes, expectedTexts) 9 function testBlendModeRule(description, rule, expectedLength, expectedValue, exp ectedTypes, expectedTexts)
29 { 10 {
30 debug(""); 11 debug("");
31 debug(description + " : " + rule); 12 debug(description + " : " + rule);
32 13
33 stylesheet.insertRule("body { mix-blend-mode: " + rule + "; }", 0); 14 stylesheet.insertRule("body { mix-blend-mode: " + rule + "; }", 0);
34 cssRule = stylesheet.cssRules.item(0); 15 cssRule = stylesheet.cssRules.item(0);
35 16
36 shouldBe("cssRule.type", "1"); 17 shouldBe("cssRule.type", "1");
37 18
38 declaration = cssRule.style; 19 declaration = cssRule.style;
39 shouldBe("declaration.length", "1"); 20 shouldBe("declaration.length", "1");
40 shouldBe("declaration.getPropertyValue('mix-blend-mode')", "'" + expectedVal ue + "'"); 21 shouldBe("declaration.getPropertyValue('mix-blend-mode')", "'" + expectedVal ue + "'");
41
42 blendModeRule = declaration.getPropertyCSSValue('mix-blend-mode');
43 shouldBeType("blendModeRule", "CSSPrimitiveValue");
44 } 22 }
45 23
46 var blendmodes = ["normal", "multiply", "screen", "overlay", "darken", "lighten" , "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclus ion", "hue", "saturation", "color", "luminosity"]; 24 var blendmodes = ["normal", "multiply", "screen", "overlay", "darken", "lighten" , "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclus ion", "hue", "saturation", "color", "luminosity"];
47 25
48 for(x in blendmodes) 26 for(x in blendmodes)
49 testBlendModeRule("Basic reference", blendmodes[x], 1, blendmodes[x]); 27 testBlendModeRule("Basic reference", blendmodes[x], 1, blendmodes[x]);
50 28
51 29
52 successfullyParsed = true; 30 successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698