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

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

Issue 1549001: Merge 56663 - CSSPrimitiveValue::setFloatValue/setStringValue should throw an... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/WebKit/249/
Patch Set: Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/dom/setPrimitiveValue-exceptions.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 description("This test ensures that setting primitive values to an inappropriate unit type will throw an exception.");
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 { left: 10px; font-family: Times; }";
9 document.documentElement.appendChild(styleElement);
10
11 var style = styleElement.sheet.cssRules[0].style;
12
13 var left = style.getPropertyCSSValue("left");
14
15 left.setFloatValue(CSSPrimitiveValue.CSS_NUMBER, 25);
16 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "25");
17
18 left.setFloatValue(CSSPrimitiveValue.CSS_DIMENSION, 25);
19 shouldBe("left.getFloatValue(CSSPrimitiveValue.CSS_DIMENSION)", "25");
20
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
32 var fontFamily = style.getPropertyCSSValue("font-family")[0];
33
34 fontFamily.setStringValue(CSSPrimitiveValue.CSS_STRING, "Hi there!");
35 shouldBe("fontFamily.getStringValue()", '"Hi there!"');
36
37 fontFamily.setStringValue(CSSPrimitiveValue.CSS_ATTR, "G'day!");
38 shouldBe("fontFamily.getStringValue()", '"G\'day!"');
39
40 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_UNKNOWN, 'Hi there! ')");
41 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_DIMENSION, \"G'day! \")");
42 shouldThrow("fontFamily.setStringValue(CSSPrimitiveValue.CSS_COUNTER, 'Hello, wo rld!')");
43
44 shouldThrow("fontFamily.getFloatValue()");
45 shouldThrow("fontFamily.getCounterValue()");
46 shouldThrow("fontFamily.getRectValue()");
47 shouldThrow("fontFamily.getRGBColorValue()");
48
49 successfullyParsed = true;
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/setPrimitiveValue-exceptions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698