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

Side by Side Diff: LayoutTests/fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js

Issue 131483008: Correctly report TypeError for HTML{Meter,Progress}Element setters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 description('Test setting valid and invalid properties of HTMLMeterElement.'); 1 description('Test setting valid and invalid properties of HTMLMeterElement.');
2 2
3 var m = document.createElement('meter'); 3 var m = document.createElement('meter');
4 4
5 debug("Test values before properties were set"); 5 debug("Test values before properties were set");
6 shouldBe("m.min", "0"); 6 shouldBe("m.min", "0");
7 shouldBe("m.value", "0"); 7 shouldBe("m.value", "0");
8 shouldBe("m.max", "1"); 8 shouldBe("m.max", "1");
9 shouldBe("m.low", "0"); 9 shouldBe("m.low", "0");
10 shouldBe("m.high", "1"); 10 shouldBe("m.high", "1");
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 m.high = 15e2; 70 m.high = 15e2;
71 m.optimum = 12.5; 71 m.optimum = 12.5;
72 shouldBe("m.min", "0.0"); 72 shouldBe("m.min", "0.0");
73 shouldBe("m.value", "200.0"); 73 shouldBe("m.value", "200.0");
74 shouldBe("m.max", "200.0"); 74 shouldBe("m.max", "200.0");
75 shouldBe("m.low", "0.0"); 75 shouldBe("m.low", "0.0");
76 shouldBe("m.high", "200.0"); 76 shouldBe("m.high", "200.0");
77 shouldBe("m.optimum", "12.5"); 77 shouldBe("m.optimum", "12.5");
78 78
79 debug("Set value to invalid value"); 79 debug("Set value to invalid value");
80 shouldThrow('m.value = "value";', '"NotSupportedError: Failed to set the \'value \' property on \'HTMLMeterElement\': The value provided is not a number."'); 80 shouldThrow('m.value = "value";', '"TypeError: Failed to set the \'value\' prope rty on \'HTMLMeterElement\': The value provided is not a number."');
81 81
82 debug("Set min to NaN"); 82 debug("Set min to NaN");
83 shouldThrow('m.min = NaN;', '"NotSupportedError: Failed to set the \'min\' prope rty on \'HTMLMeterElement\': The value provided is not a number."'); 83 shouldThrow('m.min = NaN;', '"TypeError: Failed to set the \'min\' property on \ 'HTMLMeterElement\': The value provided is not a number."');
84 84
85 debug("Set max to Infinity"); 85 debug("Set max to Infinity");
86 shouldThrow('m.max = Infinity;', '"NotSupportedError: Failed to set the \'max\' property on \'HTMLMeterElement\': The value provided is infinite."'); 86 shouldThrow('m.max = Infinity;', '"TypeError: Failed to set the \'max\' property on \'HTMLMeterElement\': The value provided is infinite."');
87 87
88 debug("Set low to invalid value"); 88 debug("Set low to invalid value");
89 shouldThrow('m.low = "low";', '"NotSupportedError: Failed to set the \'low\' pro perty on \'HTMLMeterElement\': The value provided is not a number."'); 89 shouldThrow('m.low = "low";', '"TypeError: Failed to set the \'low\' property on \'HTMLMeterElement\': The value provided is not a number."');
90 90
91 debug("Set high to NaN"); 91 debug("Set high to NaN");
92 shouldThrow('m.high = NaN;', '"NotSupportedError: Failed to set the \'high\' pro perty on \'HTMLMeterElement\': The value provided is not a number."'); 92 shouldThrow('m.high = NaN;', '"TypeError: Failed to set the \'high\' property on \'HTMLMeterElement\': The value provided is not a number."');
93 93
94 debug("Set optimum to Infinity"); 94 debug("Set optimum to Infinity");
95 shouldThrow('m.optimum = Infinity;', '"NotSupportedError: Failed to set the \'op timum\' property on \'HTMLMeterElement\': The value provided is infinite."'); 95 shouldThrow('m.optimum = Infinity;', '"TypeError: Failed to set the \'optimum\' property on \'HTMLMeterElement\': The value provided is infinite."');
96 96
97 debug("Set attributes to valid numbers"); 97 debug("Set attributes to valid numbers");
98 m.setAttribute("min", 0); 98 m.setAttribute("min", 0);
99 m.setAttribute("value", 5); 99 m.setAttribute("value", 5);
100 m.setAttribute("max", 10); 100 m.setAttribute("max", 10);
101 shouldBe("m.value", "5"); 101 shouldBe("m.value", "5");
102 shouldBe("m.max", "10"); 102 shouldBe("m.max", "10");
103 shouldBe("parseInt(m.getAttribute('value'))", "5"); 103 shouldBe("parseInt(m.getAttribute('value'))", "5");
104 shouldBe("parseInt(m.getAttribute('max'))", "10"); 104 shouldBe("parseInt(m.getAttribute('max'))", "10");
105 105
(...skipping 12 matching lines...) Expand all
118 m.setAttribute("low", " 5"); 118 m.setAttribute("low", " 5");
119 m.setAttribute("high", " 5"); 119 m.setAttribute("high", " 5");
120 m.setAttribute("optimum", " 5"); 120 m.setAttribute("optimum", " 5");
121 shouldBe("m.value", "0"); 121 shouldBe("m.value", "0");
122 shouldBe("m.min", "0"); 122 shouldBe("m.min", "0");
123 shouldBe("m.max", "1"); 123 shouldBe("m.max", "1");
124 shouldBe("m.low", "0"); 124 shouldBe("m.low", "0");
125 shouldBe("m.high", "1"); 125 shouldBe("m.high", "1");
126 shouldBe("m.optimum", "0.5"); 126 shouldBe("m.optimum", "0.5");
127 127
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698