Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / script-tests / unsigned-long-attribute-reflection.js
blob660270e2c40a4432fc57b96adee8f2cb64a3dfa4
1 // http://whatwg.org/html#reflecting-content-attributes-in-idl-attributes
2 // http://whatwg.org/html#rules-for-parsing-non-negative-integers
3 function testUnsignedLong(interface, createElement, attribute)
5 test(function()
7 var element = createElement();
9 assert_equals(element[attribute], 0);
11 function t(input, output)
13 element.setAttribute(attribute, input);
14 assert_equals(element[attribute], output);
17 t("", 0);
18 t("0", 0);
19 t("1", 1);
20 t("2147483647", 2147483647);
21 t("2147483648", 0);
22 t("-1", 0);
23 t("+42", 42);
24 t(" 42", 42);
25 t("42!", 42);
26 }, "get " + interface + "." + attribute);
28 test(function()
30 var element = createElement();
32 assert_false(element.hasAttribute(attribute));
34 function t(input, output)
36 element[attribute] = input;
37 assert_equals(element.getAttribute(attribute), output);
40 t(0, "0");
41 t(2147483647, "2147483647");
42 t(2147483648, "0");
43 t(2147483700, "0");
44 t(-1, "0");
45 t(-3, "0");
46 }, "set " + interface + "." + attribute);