OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <p id="description">This test setting suggested values on an input element | 4 <p id="description">This test setting suggested values on an input element |
5 and a textarea element. The dump below should have the "suggested value" | 5 and a textarea element. The dump below should have the "suggested value" |
6 instead of "initial value".</p> | 6 instead of "initial value".</p> |
7 <pre><input id="test" type="text" value="initial value"><textarea id="textarea">
</textarea></pre> | 7 <pre><input id="test" type="text" value="initial value"><input id="month" type="
month"><textarea id="textarea"></textarea></pre> |
8 <script src="../../resources/dump-as-markup.js"></script> | 8 <script src="../../resources/dump-as-markup.js"></script> |
9 <script> | 9 <script> |
10 | 10 |
11 var input = document.getElementById('test'); | 11 var input = document.getElementById('test'); |
| 12 var month = document.getElementById('month'); |
12 var textarea = document.getElementById('textarea'); | 13 var textarea = document.getElementById('textarea'); |
13 textarea.value = "initial value"; | 14 textarea.value = "initial value"; |
14 var result = document.getElementById('result'); | 15 var result = document.getElementById('result'); |
15 if (!window.internals) | 16 if (!window.internals) |
16 testFailed('This test requires internals object'); | 17 testFailed('This test requires internals object'); |
17 else { | 18 else { |
18 input.focus(); | 19 input.focus(); |
19 input.selectionStart = input.selectionEnd = 0; | 20 input.selectionStart = input.selectionEnd = 0; |
20 | 21 |
21 internals.setSuggestedValue(input, 'suggested value'); | 22 internals.setSuggestedValue(input, 'suggested value'); |
| 23 internals.setSuggestedValue(month, '2014-01'); |
22 internals.setSuggestedValue(textarea, 'suggested value'); | 24 internals.setSuggestedValue(textarea, 'suggested value'); |
23 | 25 |
24 Markup.description(document.getElementById('description').textContent) | 26 Markup.description(document.getElementById('description').textContent) |
25 | 27 |
26 function addTextResult(value) { input.parentNode.appendChild(document.create
TextNode(value + ': ' + eval(value))); } | 28 function addTextResult(value) { input.parentNode.appendChild(document.create
TextNode(value + ': ' + eval(value))); } |
27 addTextResult('input.value'); | 29 addTextResult('input.value'); |
28 addTextResult('internals.suggestedValue(input)'); | 30 addTextResult('internals.suggestedValue(input)'); |
29 addTextResult('input.selectionStart'); | 31 addTextResult('input.selectionStart'); |
30 addTextResult('input.selectionEnd'); | 32 addTextResult('input.selectionEnd'); |
| 33 addTextResult('month.value'); |
| 34 addTextResult('internals.suggestedValue(month)'); |
31 addTextResult('textarea.value'); | 35 addTextResult('textarea.value'); |
32 addTextResult('internals.suggestedValue(textarea)'); | 36 addTextResult('internals.suggestedValue(textarea)'); |
33 | 37 |
34 Markup.dump(input.parentNode); | 38 Markup.dump(input.parentNode); |
35 } | 39 } |
36 | 40 |
37 </script> | 41 </script> |
38 </body> | 42 </body> |
39 </html> | 43 </html> |
OLD | NEW |