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 <script src="../assert_selection.js"></script> | 4 <script src="../assert_selection.js"></script> |
5 <script src="spellcheck_test.js"></script> | 5 <script src="spellcheck_test.js"></script> |
6 | 6 |
7 <script> | 7 <script> |
8 test(() => assert_not_equals(window.internals, undefined), | 8 test(() => assert_not_equals(window.internals, undefined), |
9 'This test requires internals to inspect INPUT elements.'); | 9 'This test requires internals to inspect INPUT elements.'); |
10 | 10 |
11 test(() => assert_not_equals(window.eventSender, undefined), | 11 test(() => assert_not_equals(window.eventSender, undefined), |
12 'This test requires event sender to simulate keyboard and mouse actions.'); | 12 'This test requires event sender to simulate keyboard and mouse actions.'); |
13 | 13 |
14 const kNumTests = 4; | 14 const kNumTests = 4; |
15 const heldTest = async_test( | 15 const heldTest = async_test( |
16 () => assert_true(true), | 16 () => assert_true(true), |
17 'Dummy async test for blocking test harness.', | 17 'Dummy async test for blocking test harness.', |
18 {finishCount: 0}); | 18 {finishCount: 0}); |
19 | 19 |
20 add_result_callback(testObj => { | 20 add_result_callback(testObj => { |
21 if (!testObj.properties.blockHeldTest) | 21 if (!testObj.properties.blockHeldTest) |
22 return; | 22 return; |
| 23 testObj.properties.sample.remove(); |
23 if (++heldTest.properties.finishCount === kNumTests) | 24 if (++heldTest.properties.finishCount === kNumTests) |
24 heldTest.done(); | 25 heldTest.done(); |
25 }); | 26 }); |
26 | 27 |
27 function findTextNode(node) { | 28 function findTextNode(node) { |
28 if (node.nodeName !== 'INPUT' && node.nodeName !== 'TEXTAREA') | 29 if (node.nodeName !== 'INPUT' && node.nodeName !== 'TEXTAREA') |
29 return node.firstChild; | 30 return node.firstChild; |
30 return internals.shadowRoot(node).getElementById('inner-editor').firstChild; | 31 return internals.shadowRoot(node).getElementById('inner-editor').firstChild; |
31 } | 32 } |
32 | 33 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 assertContextClickSelection( | 79 assertContextClickSelection( |
79 container, 11, 'home', | 80 container, 11, 'home', |
80 'Context clicking "home" selects the correctly spelled word'); | 81 'Context clicking "home" selects the correctly spelled word'); |
81 return; | 82 return; |
82 } | 83 } |
83 assertContextClickSelection( | 84 assertContextClickSelection( |
84 container, 11, '', | 85 container, 11, '', |
85 'Context clicking "home" does not select the correctly spelled word'
); | 86 'Context clicking "home" does not select the correctly spelled word'
); |
86 }, | 87 }, |
87 'Context clicking misspelled word in INPUT selects the word.', | 88 'Context clicking misspelled word in INPUT selects the word.', |
88 {blockHeldTest: true}) | 89 {sample: sample, blockHeldTest: true}) |
89 }); | 90 }); |
90 | 91 |
91 spellcheck_test( | 92 spellcheck_test( |
92 '<div contenteditable>wellcome home.|</div>', | 93 '<div contenteditable>wellcome home.|</div>', |
93 '', | 94 '', |
94 '<div contenteditable>#wellcome# home.</div>', | 95 '<div contenteditable>#wellcome# home.</div>', |
95 { | 96 { |
96 title: 'Mark initial misspelling "wellcome" in editable DIV.', | 97 title: 'Mark initial misspelling "wellcome" in editable DIV.', |
97 callback: sample => test(() => { | 98 callback: sample => test(() => { |
98 const container = sample.document.querySelector('div'); | 99 const container = sample.document.querySelector('div'); |
99 assertContextClickSelection( | 100 assertContextClickSelection( |
100 container, 4, 'wellcome', | 101 container, 4, 'wellcome', |
101 'Context clicking "wellcome" selects the misspelled word', | 102 'Context clicking "wellcome" selects the misspelled word', |
102 'welcome'); | 103 'welcome'); |
103 | 104 |
104 const shouldSelect = isMac(navigator.platform); | 105 const shouldSelect = isMac(navigator.platform); |
105 if (shouldSelect) { | 106 if (shouldSelect) { |
106 assertContextClickSelection( | 107 assertContextClickSelection( |
107 container, 11, 'home', | 108 container, 11, 'home', |
108 'Context clicking "home" selects the correctly spelled word', ''); | 109 'Context clicking "home" selects the correctly spelled word', ''); |
109 return; | 110 return; |
110 } | 111 } |
111 assertContextClickSelection( | 112 assertContextClickSelection( |
112 container, 11, '', | 113 container, 11, '', |
113 'Context clicking "home" does not select the correctly spelled word'
, | 114 'Context clicking "home" does not select the correctly spelled word'
, |
114 ''); | 115 ''); |
115 }, | 116 }, |
116 'Context clicking misspelled word in editable DIV selects the word.', | 117 'Context clicking misspelled word in editable DIV selects the word.', |
117 {blockHeldTest: true}) | 118 {sample: sample, blockHeldTest: true}) |
118 }); | 119 }); |
119 | 120 |
120 spellcheck_test( | 121 spellcheck_test( |
121 '<div contenteditable>Helllo wordl.|</div>', | 122 '<div contenteditable>Helllo wordl.|</div>', |
122 '', | 123 '', |
123 '<div contenteditable>#Helllo# #wordl#.</div>', | 124 '<div contenteditable>#Helllo# #wordl#.</div>', |
124 { | 125 { |
125 title: 'Mark initial misspelling "Helllo" and "wordl" in editable DIV.', | 126 title: 'Mark initial misspelling "Helllo" and "wordl" in editable DIV.', |
126 callback: sample => test(() => { | 127 callback: sample => test(() => { |
127 const container = sample.document.querySelector('div'); | 128 const container = sample.document.querySelector('div'); |
128 assertContextClickSelection( | 129 assertContextClickSelection( |
129 container, 9, 'wordl', | 130 container, 9, 'wordl', |
130 'Context clicking "wordl" selects the misspelled word.'); | 131 'Context clicking "wordl" selects the misspelled word.'); |
131 }, | 132 }, |
132 'Context clicking the second misspelled word "wordl" in editable DIV selec
ts the word.', | 133 'Context clicking the second misspelled word "wordl" in editable DIV selec
ts the word.', |
133 {blockHeldTest: true}) | 134 {sample: sample, blockHeldTest: true}) |
134 }); | 135 }); |
135 | 136 |
136 spellcheck_test( | 137 spellcheck_test( |
137 '<div contenteditable>It should be upper case.|</div>', | 138 '<div contenteditable>It should be upper case.|</div>', |
138 '', | 139 '', |
139 '<div contenteditable>It should be #upper case#.</div>', | 140 '<div contenteditable>It should be #upper case#.</div>', |
140 { | 141 { |
141 title: 'Mark initial multi-word misspelling "upper case" in editable DIV.'
, | 142 title: 'Mark initial multi-word misspelling "upper case" in editable DIV.'
, |
142 callback: sample => test(() => { | 143 callback: sample => test(() => { |
143 const container = sample.document.querySelector('div'); | 144 const container = sample.document.querySelector('div'); |
144 assertContextClickSelection( | 145 assertContextClickSelection( |
145 container, 17, 'upper case', | 146 container, 17, 'upper case', |
146 'Context clicking "upper case" selects the misspelling.', | 147 'Context clicking "upper case" selects the misspelling.', |
147 'uppercase'); | 148 'uppercase'); |
148 }, | 149 }, |
149 'Context clicking multi-word misspelling "upper case" in editable DIV sele
cts the words.', | 150 'Context clicking multi-word misspelling "upper case" in editable DIV sele
cts the words.', |
150 {blockHeldTest: true}) | 151 {sample: sample, blockHeldTest: true}) |
151 }); | 152 }); |
152 </script> | 153 </script> |
OLD | NEW |