From 43d35a3dbbce0236c082f82144fdb53e539c50f3 Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Thu, 3 Feb 2011 22:28:57 +0800 Subject: [PATCH] Bug 630841 - add mochitest for bug 630841, r=surkov, a=test --- .../mochitest/hypertext/test_update.html | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/accessible/tests/mochitest/hypertext/test_update.html b/accessible/tests/mochitest/hypertext/test_update.html index f470b10064bf..761f3fcce7f4 100644 --- a/accessible/tests/mochitest/hypertext/test_update.html +++ b/accessible/tests/mochitest/hypertext/test_update.html @@ -90,6 +90,44 @@ } } + /** + * Text offsets must be updated when hypertext child is removed. + */ + function removeChild(aContainerID, aChildID, aInitialText, aFinalText) + { + this.containerNode = getNode(aContainerID); + this.container = getAccessible(this.containerNode, nsIAccessibleText); + this.childNode = getNode(aChildID); + + // Call first to getText so offsets are cached + is(this.container.getText(0, -1), aInitialText, + "Wrong text before child removal"); + + this.eventSeq = [ + new invokerChecker(EVENT_REORDER, this.containerNode) + ]; + + this.invoke = function removeChild_invoke() + { + this.containerNode.removeChild(this.childNode); + } + + this.finalCheck = function removeChild_finalCheck() + { + is(this.container.getText(0, -1), aFinalText, + "Wrong text after child removal"); + is(this.container.characterCount, aFinalText.length, + "Wrong text after child removal"); + } + + this.getID = function removeChild_getID() + { + return "check text after removing child from '" + aContainerID + "'"; + } + } + + + //gA11yEventDumpToConsole = true; // debug stuff var gQueue = null; @@ -98,6 +136,8 @@ gQueue = new eventQueue(); gQueue.push(new addLinks("p1")); gQueue.push(new updateText("p2")); + gQueue.push(new removeChild("div1","div2", + "hello my good friend", "hello friend")); gQueue.invoke(); // Will call SimpleTest.finish(); } @@ -117,6 +157,11 @@ title="Text offsets don't get updated when text of first child text accessible is changed" href="https://bugzilla.mozilla.org/show_bug.cgi?id=625009"> Mozilla Bug 625009 + + + Mozilla Bug 630841

@@ -125,5 +170,6 @@

hellofriend

+
hello my good friend