summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/select/menulist-disabled-selected-option.html
blob: 352c86f6bd7ef97e183a92c2f9fde8247378475d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('Check that a select control does not produce a form value if the selected option element is disabled.');

var parent = document.createElement('div');
document.body.appendChild(parent);
parent.innerHTML = '<form action="">'
    + '<input type=hidden name="submitted" value="true">'
    + '<select name="select">'
    + '<option disabled>Disabled</option>'
    + '<option>Enabled</option>'
    + '</select>'
    + '</form>';

if (window.testRunner)
    testRunner.waitUntilDone();
var query = window.location.search;
if (query.indexOf('submitted=true') == -1) {
    var select = document.getElementsByTagName('select')[0];
    select.selectedIndex = 0;
    document.forms[0].submit();
} else {
    shouldBe('query.indexOf("select=Disabled")', '-1');
    shouldBe('query.indexOf("select=Enabled")', '-1');
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</body>
</html>