2 "This test checks construction of objects with custom constructors."
6 shouldBeNonNull("new Image()");
7 shouldBeEqualToString("new Image().tagName", "IMG");
9 shouldBe("new Image().height", "0");
10 shouldBe("new Image().width", "0");
11 shouldBe("new Image(0).width", "0");
12 shouldBe("new Image(0, 0).height", "0");
13 shouldBe("new Image(100).width", "100");
14 shouldBe("new Image(100, 200).height", "200");
15 shouldBe("new Image(-100).width", "-100");
16 shouldBe("new Image(-100, -200).height", "-200");
18 shouldBe("new Image().hasAttribute('height')", "false");
19 shouldBe("new Image().hasAttribute('width')", "false");
20 shouldBe("new Image(0).hasAttribute('height')", "false");
21 shouldBe("new Image(0).hasAttribute('width')", "true");
22 shouldBe("new Image(0, 0).hasAttribute('height')", "true");
23 shouldBe("new Image(0, 0).hasAttribute('width')", "true");
25 shouldBeEqualToString("new Image().outerHTML","<img>");
26 // FIXME: shouldBeEqualToString strips quotes from the string.
27 shouldBeEqualToString("new Image(100, 100).outerHTML.replace(/\"/g, \"'\")", "<img width='100' height='100'>");
30 shouldBeNonNull("new Option()");
31 shouldBeEqualToString("new Option().tagName", "OPTION");
33 shouldBeEqualToString("new Option().innerText", "");
34 shouldBeEqualToString("new Option(null).innerText", "null");
35 shouldBeEqualToString("new Option(undefined).innerText", "");
36 shouldBeEqualToString("new Option('somedata').innerText", "somedata");
38 shouldBeEqualToString("new Option().value", "");
39 shouldBeEqualToString("new Option('somedata', null).value", "null");
40 shouldBeEqualToString("new Option('somedata', undefined).value", "somedata");
41 shouldBeEqualToString("new Option('somedata', 'somevalue').value", "somevalue");
43 shouldBeFalse("new Option().defaultSelected");
44 shouldBeFalse("new Option('somedata', 'somevalue').defaultSelected");
45 shouldBeFalse("new Option('somedata', 'somevalue', false).defaultSelected");
46 shouldBeFalse("new Option('somedata', 'somevalue', false, false).defaultSelected");
47 shouldBeTrue("new Option('somedata', 'somevalue', true).defaultSelected");
48 shouldBeTrue("new Option('somedata', 'somevalue', true, false).defaultSelected");
49 shouldBeTrue("new Option('somedata', 'somevalue', true, true).defaultSelected");
51 shouldBeFalse("new Option().selected");
52 shouldBeFalse("new Option('somedata', 'somevalue').selected");
53 shouldBeFalse("new Option('somedata', 'somevalue', false).selected");
54 shouldBeFalse("new Option('somedata', 'somevalue', true).selected");
55 shouldBeFalse("new Option('somedata', 'somevalue', true, false).selected");
56 shouldBeTrue("new Option('somedata', 'somevalue', true, true).selected");
58 shouldBeEqualToString("new Option().outerHTML","<option></option>");
59 shouldBeEqualToString("new Option('somedata', 'somevalue', false).outerHTML.replace(/\"/g,\"'\")", "<option value='somevalue'>somedata</option>");
60 shouldBeEqualToString("new Option('somedata', 'somevalue', true).outerHTML.replace(/\"/g,\"'\")", "<option value='somevalue' selected=''>somedata</option>");
63 shouldBeNonNull("new Audio()");
64 shouldBeEqualToString("new Audio().tagName", "AUDIO");
66 shouldBeEqualToString("new Audio().src", "");
67 shouldBeEqualToString("new Audio().preload", "auto");
68 shouldBeEqualToString("new Audio('http://127.0.0.1/someurl').src", "http://127.0.0.1/someurl");
69 shouldBeEqualToString("new Audio('http://127.0.0.1/someurl').preload", "auto");