| 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 // Trigger spell checking on originally static text. |
| 47 window.getSelection().collapse(document.getElementById('paragraph'),
0); |
| 45 | 48 |
| 46 step_timeout(function() | 49 step_timeout(function() |
| 47 { | 50 { |
| 48 var axParagraph = accessibilityController.accessibleElementById('par
agraph'); | 51 var axParagraph = accessibilityController.accessibleElementById(
'paragraph'); |
| 49 var axStaticText = axParagraph.childAtIndex(0); | 52 var axStaticText = axParagraph.childAtIndex(0); |
| 50 | 53 |
| 51 assert_equals(axStaticText.misspellingsCount, 2); | 54 assert_equals(axStaticText.misspellingsCount, 2); |
| 52 assert_equals(axStaticText.misspellingAtIndex(0), 'adaasj'); | 55 assert_equals(axStaticText.misspellingAtIndex(0), 'adaasj'); |
| 53 assert_equals(axStaticText.misspellingAtIndex(1), 'sdklj'); | 56 assert_equals(axStaticText.misspellingAtIndex(1), 'sdklj'); |
| 54 | 57 |
| 55 document.designMode = 'off'; | 58 document.designMode = 'off'; |
| 56 document.getElementById('paragraph').style.display = "none";; | 59 document.getElementById('paragraph').style.display = "none";; |
| 57 t.done(); | 60 t.done(); |
| 61 }, 50); |
| 58 }, 100); | 62 }, 100); |
| 59 }, 'Misspellings should be reported in static text when design mode is on.')
; | 63 }, 'Misspellings should be reported in static text when design mode is on.')
; |
| 60 | 64 |
| 61 async_test(function(t) | 65 async_test(function(t) |
| 62 { | 66 { |
| 63 document.getElementById('input').focus(); | 67 step_timeout(function() { |
| 64 document.execCommand('InsertText', false, 'contentEditable '); | 68 document.getElementById('input').focus(); |
| 69 document.execCommand('InsertText', false, 'contentEditable '); |
| 65 | 70 |
| 66 step_timeout(function() | 71 step_timeout(function() |
| 67 { | 72 { |
| 68 var axInput = accessibilityController.accessibleElementById('input')
; | 73 var axInput = accessibilityController.accessibleElementById('inp
ut'); |
| 69 // If input's shadow DOM changes, this logic might need to be modifi
ed. | 74 // If input's shadow DOM changes, this logic might need to be mo
dified. |
| 70 assert_equals(axInput.childrenCount, 1); | 75 assert_equals(axInput.childrenCount, 1); |
| 71 var axDiv = axInput.childAtIndex(0); | 76 var axDiv = axInput.childAtIndex(0); |
| 72 assert_equals(axDiv.childrenCount, 1); | 77 assert_equals(axDiv.childrenCount, 1); |
| 73 var axStaticText = axDiv.childAtIndex(0); | 78 var axStaticText = axDiv.childAtIndex(0); |
| 74 | 79 |
| 75 assert_equals(axStaticText.misspellingsCount, 1); | 80 assert_equals(axStaticText.misspellingsCount, 1); |
| 76 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditable')
; | 81 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditab
le'); |
| 77 | 82 |
| 78 document.getElementById('input').style.display = "none";; | 83 document.getElementById('input').style.display = "none";; |
| 79 t.done(); | 84 t.done(); |
| 80 }, 100); | 85 }, 50); |
| 86 }, 200); |
| 81 }, 'Misspellings should be reported in single-line text fields.'); | 87 }, 'Misspellings should be reported in single-line text fields.'); |
| 82 | 88 |
| 83 async_test(function(t) | 89 async_test(function(t) |
| 84 { | 90 { |
| 85 document.getElementById('textarea').focus(); | 91 step_timeout(function() { |
| 86 document.execCommand('InsertText', false, 'contentEditable '); | 92 document.getElementById('textarea').focus(); |
| 93 document.execCommand('InsertText', false, 'contentEditable '); |
| 87 | 94 |
| 88 step_timeout(function() | 95 step_timeout(function() |
| 89 { | 96 { |
| 90 var axTextarea = accessibilityController.accessibleElementById('text
area'); | 97 var axTextarea = accessibilityController.accessibleElementById('
textarea'); |
| 91 // If textarea's shadow DOM changes, this logic might need to be mod
ified. | 98 // If textarea's shadow DOM changes, this logic might need to be
modified. |
| 92 assert_equals(axTextarea.childrenCount, 1); | 99 assert_equals(axTextarea.childrenCount, 1); |
| 93 var axDiv = axTextarea.childAtIndex(0); | 100 var axDiv = axTextarea.childAtIndex(0); |
| 94 assert_equals(axDiv.childrenCount, 1); | 101 assert_equals(axDiv.childrenCount, 1); |
| 95 var axStaticText = axDiv.childAtIndex(0); | 102 var axStaticText = axDiv.childAtIndex(0); |
| 96 | 103 |
| 97 assert_equals(axStaticText.misspellingsCount, 1); | 104 assert_equals(axStaticText.misspellingsCount, 1); |
| 98 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditable')
; | 105 assert_equals(axStaticText.misspellingAtIndex(0), 'contentEditab
le'); |
| 99 | 106 |
| 100 document.getElementById('textarea').style.display = "none";; | 107 document.getElementById('textarea').style.display = "none";; |
| 101 t.done(); | 108 t.done(); |
| 102 }, 100); | 109 }, 50); |
| 110 }, 300); |
| 103 }, 'Misspellings should be reported in textareas.'); | 111 }, 'Misspellings should be reported in textareas.'); |
| 104 </script> | 112 </script> |
| OLD | NEW |