| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 | 4 |
| 5 <!-- Layout tests use a mock spell checker with only a few words in its dictiona
ry. --> | 5 <!-- Layout tests use a mock spell checker with only a few words in its dictiona
ry. --> |
| 6 | 6 |
| 7 <div id="editable" contentEditable="true" spellcheck="true"></div> | 7 <div id="editable" contentEditable="true" spellcheck="true"></div> |
| 8 | 8 |
| 9 <p id="paragraph" tabIndex="0" spellcheck="true">Hi, how adaasj sdklj?</p> | 9 <p id="paragraph" tabIndex="0" spellcheck="true">Hi, how adaasj sdklj?</p> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 var axEditable = accessibilityController.accessibleElementById('edit
able'); | 29 var axEditable = accessibilityController.accessibleElementById('edit
able'); |
| 30 var axStaticText = axEditable.childAtIndex(0); | 30 var axStaticText = axEditable.childAtIndex(0); |
| 31 | 31 |
| 32 assert_equals(axStaticText.misspellingsCount, 3); | 32 assert_equals(axStaticText.misspellingsCount, 3); |
| 33 assert_equals(axStaticText.misspellingAtIndex(0), 'Foo'); | 33 assert_equals(axStaticText.misspellingAtIndex(0), 'Foo'); |
| 34 assert_equals(axStaticText.misspellingAtIndex(1), 'baz'); | 34 assert_equals(axStaticText.misspellingAtIndex(1), 'baz'); |
| 35 assert_equals(axStaticText.misspellingAtIndex(2), 'chello'); | 35 assert_equals(axStaticText.misspellingAtIndex(2), 'chello'); |
| 36 | 36 |
| 37 document.getElementById('editable').style.display = "none";; | 37 document.getElementById('editable').style.display = "none";; |
| 38 t.done(); | 38 t.done(); |
| 39 }, 100); | 39 }, 50); |
| 40 }, 'Misspellings should be reported in content editables.'); | 40 }, 'Misspellings should be reported in content editables.'); |
| 41 | 41 |
| 42 async_test(function(t) | 42 async_test(function(t) |
| 43 { | 43 { |
| 44 document.designMode = 'on'; | 44 step_timeout(function() { |
| 45 document.designMode = 'on'; |
| 46 window.getSelection().collapse(document.getElementById('paragraph'),
0); |
| 45 | 47 |
| 46 step_timeout(function() | 48 step_timeout(function() |
| 47 { | 49 { |
| 48 var axParagraph = accessibilityController.accessibleElementById('par
agraph'); | 50 var axParagraph = accessibilityController.accessibleElementById(
'paragraph'); |
| 49 var axStaticText = axParagraph.childAtIndex(0); | 51 var axStaticText = axParagraph.childAtIndex(0); |
| 50 | 52 |
| 51 assert_equals(axStaticText.misspellingsCount, 2); | 53 assert_equals(axStaticText.misspellingsCount, 2); |
| 52 assert_equals(axStaticText.misspellingAtIndex(0), 'adaasj'); | 54 assert_equals(axStaticText.misspellingAtIndex(0), 'adaasj'); |
| 53 assert_equals(axStaticText.misspellingAtIndex(1), 'sdklj'); | 55 assert_equals(axStaticText.misspellingAtIndex(1), 'sdklj'); |
| 54 | 56 |
| 55 document.designMode = 'off'; | 57 document.designMode = 'off'; |
| 56 document.getElementById('paragraph').style.display = "none";; | 58 document.getElementById('paragraph').style.display = "none";; |
| 57 t.done(); | 59 t.done(); |
| 60 }, 50); |
| 58 }, 100); | 61 }, 100); |
| 59 }, 'Misspellings should be reported in static text when design mode is on.')
; | 62 }, 'Misspellings should be reported in static text when design mode is on.')
; |
| 60 | 63 |
| 61 async_test(function(t) | 64 async_test(function(t) |
| 62 { | 65 { |
| 63 document.getElementById('input').focus(); | 66 step_timeout(function() { |
| 64 document.execCommand('InsertText', false, 'contentEditable '); | 67 document.getElementById('input').focus(); |
| 68 document.execCommand('InsertText', false, 'contentEditable '); |
| 65 | 69 |
| 66 step_timeout(function() | 70 step_timeout(function() |
| 67 { | 71 { |
| 68 var axInput = accessibilityController.accessibleElementById('input')
; | 72 var axInput = accessibilityController.accessibleElementById('inp
ut'); |
| 69 // If input's shadow DOM changes, this logic might need to be modifi
ed. | 73 // If input's shadow DOM changes, this logic might need to be mo
dified. |
| 70 assert_equals(axInput.childrenCount, 1); | 74 assert_equals(axInput.childrenCount, 1); |
| 71 var axDiv = axInput.childAtIndex(0); | 75 var axDiv = axInput.childAtIndex(0); |
| 72 assert_equals(axDiv.childrenCount, 1); | 76 assert_equals(axDiv.childrenCount, 1); |
| 73 var axStaticText = axDiv.childAtIndex(0); | 77 var axStaticText = axDiv.childAtIndex(0); |
| 74 | 78 |
| 75 assert_equals(axStaticText.misspellingsCount, 1); | 79 assert_equals(axStaticText.misspellingsCount, 1); |
| 76 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditable')
; | 80 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditab
le'); |
| 77 | 81 |
| 78 document.getElementById('input').style.display = "none";; | 82 document.getElementById('input').style.display = "none";; |
| 79 t.done(); | 83 t.done(); |
| 80 }, 100); | 84 }, 50); |
| 85 }, 200); |
| 81 }, 'Misspellings should be reported in single-line text fields.'); | 86 }, 'Misspellings should be reported in single-line text fields.'); |
| 82 | 87 |
| 83 async_test(function(t) | 88 async_test(function(t) |
| 84 { | 89 { |
| 85 document.getElementById('textarea').focus(); | 90 step_timeout(function() { |
| 86 document.execCommand('InsertText', false, 'contentEditable '); | 91 document.getElementById('textarea').focus(); |
| 92 document.execCommand('InsertText', false, 'contentEditable '); |
| 87 | 93 |
| 88 step_timeout(function() | 94 step_timeout(function() |
| 89 { | 95 { |
| 90 var axTextarea = accessibilityController.accessibleElementById('text
area'); | 96 var axTextarea = accessibilityController.accessibleElementById('
textarea'); |
| 91 // If textarea's shadow DOM changes, this logic might need to be mod
ified. | 97 // If textarea's shadow DOM changes, this logic might need to be
modified. |
| 92 assert_equals(axTextarea.childrenCount, 1); | 98 assert_equals(axTextarea.childrenCount, 1); |
| 93 var axDiv = axTextarea.childAtIndex(0); | 99 var axDiv = axTextarea.childAtIndex(0); |
| 94 assert_equals(axDiv.childrenCount, 1); | 100 assert_equals(axDiv.childrenCount, 1); |
| 95 var axStaticText = axDiv.childAtIndex(0); | 101 var axStaticText = axDiv.childAtIndex(0); |
| 96 | 102 |
| 97 assert_equals(axStaticText.misspellingsCount, 1); | 103 assert_equals(axStaticText.misspellingsCount, 1); |
| 98 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditable')
; | 104 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditab
le'); |
| 99 | 105 |
| 100 document.getElementById('textarea').style.display = "none";; | 106 document.getElementById('textarea').style.display = "none";; |
| 101 t.done(); | 107 t.done(); |
| 102 }, 100); | 108 }, 50); |
| 109 }, 300); |
| 103 }, 'Misspellings should be reported in textareas.'); | 110 }, 'Misspellings should be reported in textareas.'); |
| 104 </script> | 111 </script> |
| OLD | NEW |