OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../js/resources/js-test-pre.js"></script> | 3 <script src="../js/resources/js-test-pre.js"></script> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
| 6 <input id="input"><input id="input2"> |
6 <script> | 7 <script> |
7 description("This tests inputMethodContext attribute which is an additional inte
rface for HTMLElement."); | 8 description("This tests inputMethodContext attribute which is an additional inte
rface for HTMLElement."); |
8 | 9 |
9 var html = document.documentElement; | 10 var html = document.documentElement; |
10 | 11 |
11 // Checks creating an InputMethodContext object via new throws exception. | 12 // Checks creating an InputMethodContext object via new throws exception. |
12 shouldThrow('new InputMethodContext()'); | 13 shouldThrow('new InputMethodContext()'); |
13 | 14 |
14 // Checks existence of .inputMethodContext attribute. | 15 // Checks existence of .inputMethodContext attribute. |
15 shouldBeNonNull(html.inputMethodContext); | 16 shouldBeNonNull(html.inputMethodContext); |
16 shouldBeEqualToString('typeof(html.inputMethodContext)', 'object'); | 17 shouldBeEqualToString('typeof(html.inputMethodContext)', 'object'); |
17 | 18 |
18 // Checks inputMethodContext returns an InputMethodContext object. | 19 // Checks inputMethodContext returns an InputMethodContext object. |
19 var context = html.inputMethodContext; | 20 var context = html.inputMethodContext; |
20 shouldBeTrue('context instanceof InputMethodContext'); | 21 shouldBeTrue('context instanceof InputMethodContext'); |
21 | 22 |
22 // Checks the same InputMethodContext objects are returned from an element. | 23 // Checks the same InputMethodContext objects are returned from an element. |
23 var context2 = html.inputMethodContext; | 24 var context2 = html.inputMethodContext; |
24 shouldBeTrue('context2 instanceof InputMethodContext'); | 25 shouldBeTrue('context2 instanceof InputMethodContext'); |
25 shouldBeTrue('context === context2'); | 26 shouldBeTrue('context === context2'); |
| 27 |
| 28 // Checks if contexts for different elements are different. |
| 29 var inputContext = document.getElementById('input').inputMethodContext; |
| 30 var input2Context = document.getElementById('input2').inputMethodContext; |
| 31 shouldNotBe('inputContext', 'input2Context'); |
26 </script> | 32 </script> |
27 <script src="../js/resources/js-test-post.js"></script> | 33 <script src="../js/resources/js-test-post.js"></script> |
28 </body> | 34 </body> |
29 </html> | 35 </html> |
OLD | NEW |