[WK2] selection does not disappear after coping the text
[framework/web/webkit-efl.git] / LayoutTests / fast / forms / form-attribute-elements-order.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description("This test examines the order of the elements attribute of a form element.");
11
12 var container = document.createElement('div');
13 document.body.appendChild(container);
14 container.innerHTML = '<input name=victim id=before1 form=owner />' +
15     '<input name=victim id=before2 form=owner />' +
16     '<form id=owner action= method=GET>' +
17     '    <input name=victim id=inner1 form=owner />' +
18     '    <input name=victim id=inner2 form=owner />' +
19     '</form>' +
20     '<input name=victim id=after1 form=owner />' +
21     '<input name=victim id=after2 form=owner />';
22
23 var owner = document.getElementById('owner');
24 var before1 = document.getElementById('before1');
25 var before2 = document.getElementById('before2');
26 var inner1 = document.getElementById('inner1');
27 var inner2 = document.getElementById('inner2');
28 var after1 = document.getElementById('after1');
29 var after2 = document.getElementById('after2');
30
31 debug('- Test for the case where some elements are outside of the form.');
32 shouldBe('owner.elements.length', '6');
33 shouldBe('owner.elements[0]', 'before1');
34 shouldBe('owner.elements[1]', 'before2');
35 shouldBe('owner.elements[2]', 'inner1');
36 shouldBe('owner.elements[3]', 'inner2');
37 shouldBe('owner.elements[4]', 'after1');
38 shouldBe('owner.elements[5]', 'after2');
39
40 debug('');
41 debug('- Test for changing the value of the form attribute of a element which is located before the form owner.');
42 before2.attributes['form'].value = '';
43 shouldBe('owner.elements.length', '5');
44 shouldBe('owner.elements[0]', 'before1');
45 shouldBe('owner.elements[1]', 'inner1');
46 shouldBe('owner.elements[2]', 'inner2');
47 shouldBe('owner.elements[3]', 'after1');
48 shouldBe('owner.elements[4]', 'after2');
49 before2.attributes['form'].value = 'owner';
50 shouldBe('owner.elements.length', '6');
51 shouldBe('owner.elements[0]', 'before1');
52 shouldBe('owner.elements[1]', 'before2');
53 shouldBe('owner.elements[2]', 'inner1');
54 shouldBe('owner.elements[3]', 'inner2');
55 shouldBe('owner.elements[4]', 'after1');
56 shouldBe('owner.elements[5]', 'after2');
57
58 debug('');
59 debug('- Test for changing the value of the form attribute of a element which is located inside of the form owner.');
60 inner2.attributes['form'].value = '';
61 shouldBe('owner.elements.length', '5');
62 shouldBe('owner.elements[0]', 'before1');
63 shouldBe('owner.elements[1]', 'before2');
64 shouldBe('owner.elements[2]', 'inner1');
65 shouldBe('owner.elements[3]', 'after1');
66 shouldBe('owner.elements[4]', 'after2');
67 inner2.attributes['form'].value = 'owner';
68 shouldBe('owner.elements.length', '6');
69 shouldBe('owner.elements[0]', 'before1');
70 shouldBe('owner.elements[1]', 'before2');
71 shouldBe('owner.elements[2]', 'inner1');
72 shouldBe('owner.elements[3]', 'inner2');
73 shouldBe('owner.elements[4]', 'after1');
74 shouldBe('owner.elements[5]', 'after2');
75
76 debug('');
77 debug('- Test for changing the value of the form attribute of a element which is located after the form owner.');
78 after1.attributes['form'].value = '';
79 shouldBe('owner.elements.length', '5');
80 shouldBe('owner.elements[0]', 'before1');
81 shouldBe('owner.elements[1]', 'before2');
82 shouldBe('owner.elements[2]', 'inner1');
83 shouldBe('owner.elements[3]', 'inner2');
84 shouldBe('owner.elements[4]', 'after2');
85 after1.attributes['form'].value = 'owner';
86 shouldBe('owner.elements.length', '6');
87 shouldBe('owner.elements[0]', 'before1');
88 shouldBe('owner.elements[1]', 'before2');
89 shouldBe('owner.elements[2]', 'inner1');
90 shouldBe('owner.elements[3]', 'inner2');
91 shouldBe('owner.elements[4]', 'after1');
92 shouldBe('owner.elements[5]', 'after2');
93
94 debug('');
95 debug('- Test for setting form attribute of elements in reverse order.');
96 before1.attributes['form'].value = '';
97 before2.attributes['form'].value = '';
98 inner1.attributes['form'].value = '';
99 inner2.attributes['form'].value = '';
100 after1.attributes['form'].value = '';
101 after2.attributes['form'].value = '';
102
103 after2.attributes['form'].value = 'owner';
104 after1.attributes['form'].value = 'owner';
105 inner2.attributes['form'].value = 'owner';
106 inner1.attributes['form'].value = 'owner';
107 before2.attributes['form'].value = 'owner';
108 before1.attributes['form'].value = 'owner';
109
110 shouldBe('owner.elements.length', '6');
111 shouldBe('owner.elements[0]', 'before1');
112 shouldBe('owner.elements[1]', 'before2');
113 shouldBe('owner.elements[2]', 'inner1');
114 shouldBe('owner.elements[3]', 'inner2');
115 shouldBe('owner.elements[4]', 'after1');
116 shouldBe('owner.elements[5]', 'after2');
117
118 debug('');
119 debug('- Test for setting form attribute of elements in random order.');
120 before1.attributes['form'].value = '';
121 before2.attributes['form'].value = '';
122 inner1.attributes['form'].value = '';
123 inner2.attributes['form'].value = '';
124 after1.attributes['form'].value = '';
125 after2.attributes['form'].value = '';
126
127 after1.attributes['form'].value = 'owner';
128 before1.attributes['form'].value = 'owner';
129 inner2.attributes['form'].value = 'owner';
130 before2.attributes['form'].value = 'owner';
131 after2.attributes['form'].value = 'owner';
132 inner1.attributes['form'].value = 'owner';
133
134 shouldBe('owner.elements.length', '6');
135 shouldBe('owner.elements[0]', 'before1');
136 shouldBe('owner.elements[1]', 'before2');
137 shouldBe('owner.elements[2]', 'inner1');
138 shouldBe('owner.elements[3]', 'inner2');
139 shouldBe('owner.elements[4]', 'after1');
140 shouldBe('owner.elements[5]', 'after2');
141
142 debug('');
143 debug('- Test for removing/adding elements');
144 container.removeChild(before2);
145 owner.removeChild(inner2);
146 container.removeChild(after1);
147 shouldBe('owner.elements.length', '3');
148 shouldBe('owner.elements[0]', 'before1');
149 shouldBe('owner.elements[1]', 'inner1');
150 shouldBe('owner.elements[2]', 'after2');
151 container.insertBefore(before2, owner);
152 owner.appendChild(inner2);
153 container.insertBefore(after1, after2);
154 shouldBe('owner.elements.length', '6');
155 shouldBe('owner.elements[0]', 'before1');
156 shouldBe('owner.elements[1]', 'before2');
157 shouldBe('owner.elements[2]', 'inner1');
158 shouldBe('owner.elements[3]', 'inner2');
159 shouldBe('owner.elements[4]', 'after1');
160 shouldBe('owner.elements[5]', 'after2');
161 </script>
162 <script src="../../fast/js/resources/js-test-post.js"></script>
163 </body>
164 </html>