Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / label / labels-change-htmlFor-attribute.html
blob7dbcd307780bbdae3eb5b32066daf66188d61064
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/common.js"></script>
6 <script src="../resources/label-test-util.js"></script>
7 </head>
8 <body>
9 <p id="description"></p>
10 <div id="console"></div>
11 <script>
12 description('Test that the labels list of a form control is dynamically updated when the htmlFor attribute of a label changes to point to that control. ');
14 var tester = setupLabelsTest(withNoLabel, '<label id="labelId"></label>');
15 for (var name in tester.dataSet) {
16 var data = tester.getLabelableElementData(name);
17 if (data == null)
18 continue;
20 debug('Check ' + data.name);
21 var element = data.element;
22 shouldBe('element.labels.length', '0');
24 var label = document.getElementById("labelId");
25 label.htmlFor = element.id;
26 shouldBe('element.labels.length', '1');
28 </script>
29 </body>
30 </html>