diff --git a/accessible/tests/mochitest/events/test_textattrchange.html b/accessible/tests/mochitest/events/test_textattrchange.html index a69a8df15e08..e990f3f9d1d8 100644 --- a/accessible/tests/mochitest/events/test_textattrchange.html +++ b/accessible/tests/mochitest/events/test_textattrchange.html @@ -29,7 +29,7 @@ Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); - function spelledTextInvoker(aID) + function spelledTextInvoker(aID, aText, aTests) { this.DOMNode = getNode(aID); @@ -46,7 +46,7 @@ //var spellchecker = editor.getInlineSpellChecker(true); //spellchecker.enableRealTimeSpell = true; - this.DOMNode.value = "valid text inalid tixt"; + this.DOMNode.value = aText; } this.finalCheck = function spelledTextInvoker_finalCheck() @@ -61,10 +61,11 @@ "invalid": "spelling" }; - testTextAttrs(aID, 0, attrs, defAttrs, 0, 11); - testTextAttrs(aID, 11, misspelledAttrs, defAttrs, 11, 17); - testTextAttrs(aID, 17, attrs, defAttrs, 17, 18); - testTextAttrs(aID, 18, misspelledAttrs, defAttrs, 18, 22); + for (var i = 0; i < aTests.length; i++) { + testTextAttrs(aID, aTests[i].start, + aTests[i].misspelled ? misspelledAttrs : attrs, + defAttrs, aTests[i].start, aTests[i].end); + } } this.getID = function spelledTextInvoker_getID() @@ -87,7 +88,32 @@ gQueue = new eventQueue(); gQueue.push(new synthFocus("input")); - gQueue.push(new spelledTextInvoker("input")); + + var tests = [ + { misspelled: false, start: 0, end: 11}, + { misspelled: true, start: 11, end: 17}, + { misspelled: false, start: 17, end: 18}, + { misspelled: true, start: 18, end: 22} + ]; + gQueue.push(new spelledTextInvoker("input", "valid text inalid tixt", + tests)); + + tests = [ + { misspelled: false, start: 0, end: 4} + ]; + gQueue.push(new spelledTextInvoker("input", "that", tests)); + + tests = [ + { misspelled: true, start: 0, end: 4} + ]; + gQueue.push(new spelledTextInvoker("input", "taht", tests)); + + tests = [ + { misspelled: true, start: 0, end: 4}, + { misspelled: false, start: 4, end: 8} + ]; + gQueue.push(new spelledTextInvoker("input", "taht cat", tests)); + gQueue.invoke(); // Will call SimpleTest.finish(); } @@ -103,6 +129,11 @@ title="Implement text attributes"> Mozilla Bug 345759 +