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

Side by Side Diff: LayoutTests/fast/dom/script-tests/setPrimitiveValue-exceptions.js

Issue 689323002: Remove tests which are only testing getPropertyCSSValue, etc. (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
(Empty)
1 description("Test exceptions thrown by the CSSPrimitiveValue APIs. Primitive val ues are currently immutable (see https://bugs.webkit.org/show_bug.cgi?id=31223)" );
2
3 var element = document.createElement('div');
4 element.id = "test-element"
5 document.documentElement.appendChild(element);
6
7 var styleElement = document.createElement('style');
8 styleElement.innerText = "#test-element { position: absolute; left: 10px; font-f amily: Times; }";
9 document.documentElement.appendChild(styleElement);
10
11 function checkThrows(style) {
12 left = style.getPropertyCSSValue("left");
13
14 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "10");
15 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_DIMENSION)", "10");
16 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_PX)", "10");
17
18 shouldThrow("left.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, 25)");
19 shouldThrow("left.setFloatValue(CSSPrimitiveValue.CSS_DIMENSION, 25)");
20 shouldThrow("left.setFloatValue(CSSPrimitiveValue.CSS_PX, 25)");
21 shouldThrow("left.setFloatValue(CSSPrimitiveValue.CSS_UNKNOWN, 25)");
22 shouldThrow("left.setFloatValue(CSSPrimitiveValue.CSS_STRING, 25)");
23 shouldThrow("left.getFloatValue(CSSPrimitiveValue.CSS_UNKNOWN)");
24 shouldThrow("left.getFloatValue(CSSPrimitiveValue.CSS_STRING)");
25
26 shouldThrow("left.getStringValue()");
27 shouldThrow("left.getCounterValue()");
28 shouldThrow("left.getRectValue()");
29 shouldThrow("left.getRGBColorValue()");
30
31 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "10");
32 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_DIMENSION)", "10");
33 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_PX)", "10");
34
35 fontFamily = style.getPropertyCSSValue("font-family")[0];
36
37 shouldBe("fontFamily.getStringValue()", '"Times"');
38
39 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_STRING, 'Hi the re!')");
40 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_ATTR, \"G'day!\ ")");
41 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_UNKNOWN, 'Hi th ere!')");
42 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_DIMENSION, \"G' day!\")");
43 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_COUNTER, 'Hello , world!')");
44
45 shouldThrow("fontFamily.getFloatValue()");
46 shouldThrow("fontFamily.getCounterValue()");
47 shouldThrow("fontFamily.getRectValue()");
48 shouldThrow("fontFamily.getRGBColorValue()");
49
50 shouldBe("fontFamily.getStringValue()", '"Times"');
51 }
52
53 var style = styleElement.sheet.cssRules[0].style;
54 checkThrows(style);
55
56 var computedStyle = window.getComputedStyle(element, null);
57 checkThrows(computedStyle);
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/script-tests/css-RGBValue.js ('k') | LayoutTests/fast/dom/setPrimitiveValue.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698