tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / forms / script-tests / shadow-tree-exposure.js
1 description("Test to make sure shadow nodes are not exposed.");
2
3 var container = document.createElement("p");
4 document.body.appendChild(container);
5
6 container.appendChild(document.createTextNode("Some text: "));
7
8 shouldBe("getSelection().anchorNode", "null");
9 shouldBe("getSelection().anchorOffset", "0");
10 shouldBe("getSelection().focusNode", "null");
11 shouldBe("getSelection().focusOffset", "0");
12 shouldBe("getSelection().isCollapsed", "true");
13 shouldBe("getSelection().rangeCount", "0");
14
15 shouldBe("getSelection().baseNode", "null");
16 shouldBe("getSelection().baseOffset", "0");
17 shouldBe("getSelection().extentNode", "null");
18 shouldBe("getSelection().extentOffset", "0");
19 shouldBe("getSelection().type", "'None'");
20
21 debug("\nAdd an input element.\n");
22
23 var input = document.createElement("input");
24 container.appendChild(input);
25 input.value = "text";
26 input.focus();
27 input.select();
28
29 shouldBe("getSelection().anchorNode", "container");
30 shouldBe("getSelection().anchorOffset", "1");
31 shouldBe("getSelection().focusNode", "container");
32 shouldBe("getSelection().focusOffset", "1");
33 shouldBe("getSelection().isCollapsed", "true");
34 shouldBe("getSelection().rangeCount", "1");
35 shouldBe("getSelection().getRangeAt(0).startContainer", "container");
36 shouldBe("getSelection().getRangeAt(0).startOffset", "1");
37 shouldBe("getSelection().getRangeAt(0).endContainer", "container");
38 shouldBe("getSelection().getRangeAt(0).endOffset", "1");
39
40 shouldBe("getSelection().baseNode", "container");
41 shouldBe("getSelection().baseOffset", "1");
42 shouldBe("getSelection().extentNode", "container");
43 shouldBe("getSelection().extentOffset", "1");
44 shouldBe("getSelection().type", "'Range'");
45
46 debug("\nAdd a textarea element.\n");
47
48 var textarea = document.createElement("textarea");
49 container.appendChild(textarea);
50 textarea.value = "text";
51 textarea.focus();
52 textarea.select();
53
54 shouldBe("getSelection().anchorNode", "container");
55 shouldBe("getSelection().anchorOffset", "2");
56 shouldBe("getSelection().focusNode", "container");
57 shouldBe("getSelection().focusOffset", "2");
58 shouldBe("getSelection().isCollapsed", "true");
59 shouldBe("getSelection().rangeCount", "1");
60 shouldBe("getSelection().getRangeAt(0).startContainer", "container");
61 shouldBe("getSelection().getRangeAt(0).startOffset", "2");
62 shouldBe("getSelection().getRangeAt(0).endContainer", "container");
63 shouldBe("getSelection().getRangeAt(0).endOffset", "2");
64
65 shouldBe("getSelection().baseNode", "container");
66 shouldBe("getSelection().baseOffset", "2");
67 shouldBe("getSelection().extentNode", "container");
68 shouldBe("getSelection().extentOffset", "2");
69 shouldBe("getSelection().type", "'Range'");
70
71 document.body.removeChild(container);
72
73 debug("");