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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLProgressElement/script-tests/set-progress-properties.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 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
(Empty)
1 description('Test setting valid and invalid properties of HTMLProgressElement.') ;
2
3 var p = document.createElement('progress');
4
5 debug("Test values before properties were set");
6 shouldBe("p.value", "0");
7 shouldBe("p.max", "1");
8 shouldBe("p.position", "-1");
9
10 debug("Set valid values");
11 p.value = 7e1;
12 p.max = "1e2";
13 shouldBe("p.value", "70");
14 shouldBe("p.max", "100");
15 shouldBe("p.position", "0.7");
16
17 debug("Set value bigger than max");
18 p.value = 200;
19 p.max = 100.0;
20 shouldBe("p.value", "100");
21 shouldBe("p.max", "100");
22 shouldBe("p.position", "1");
23
24 debug("Set value less than zero");
25 p.value = -42;
26 shouldBe('p.value', '0');
27 shouldBe('p.position', '0');
28
29 debug("Set invalid value, should throw");
30 shouldThrow('p.value = "200A";');
31
32 debug("Set invalid max, should throw");
33 shouldThrow('p.max = "max";');
34
35 debug("Set max to Infinity, should throw");
36 shouldThrow('p.max = Infinity;');
37
38 debug("Set value to NaN, should throw");
39 shouldThrow('p.value = NaN;');
40
41 debug("Set value to null and max to 0");
42 p.value = null;
43 p.max = 0;
44 shouldBe("p.value", "0");
45 shouldBe("p.max", "1");
46 shouldBe("p.position", "0");
47
48 debug("Set attributes to valid numbers");
49 p.setAttribute("value", 5);
50 p.setAttribute("max", 10);
51 shouldBe("p.value", "5");
52 shouldBe("p.max", "10");
53 shouldBe("parseInt(p.getAttribute('value'))", "5");
54 shouldBe("parseInt(p.getAttribute('max'))", "10");
55
56 debug("Set attributes to invalid values");
57 p.setAttribute("value", "ABC");
58 p.setAttribute("max", "#");
59 shouldBe("p.value", "0");
60 shouldBe("p.max", "1");
61 shouldBe("p.getAttribute('value')", "'ABC'");
62 shouldBe("p.getAttribute('max')", "'#'");
63
64 debug("Set value and max to numbers with leading spaces");
65 p.setAttribute("value", " 5");
66 p.setAttribute("max", " 10");
67 shouldBe("p.value", "0");
68 shouldBe("p.max", "1");
69 shouldBe("p.position", "0");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698