Comment 44 for bug 602877

Revision history for this message
In , Alexander Surkov (surkov-alexander) wrote :

(From update of attachment 448030)

>+ /* Now that selection is done, move the focus to the selection. */

nit: use //

>+ test_set_caret_offset.html \

it makes sense to reuse test_text_caret.html

>+ <script type="application/javascript">
>+ function testFocus(aID, aAcc, aSelectedBefore, aSelectedAfter)
>+ {
>+ is(aAcc.selected, aSelectedBefore,
>+ "Wrong selected state before focus for ID " + aID + "!");

I find useful to test nsIAccessibleText::selected but I'd like to see a comment we test here whether it's focused or not.

>+ document.getElementById(aID).focus();
>+ is(aAcc.selected, aSelectedAfter,
>+ "Wrong seleccted state after focus for ID " + aID + "!");
>+ }
>+
>+ function doTest()
>+ {
>+ //////////////////////////////////////////////////////////////////////////
>+ // normal hyperlink
>+ var link4 = getAccessible("link4", [nsIAccessibleHyperLink]);
>+ testFocus("link4", link4, false, true);
>+ heading1 = getAccessible("heading1", [nsIAccessibleText]);
>+ heading1.caretOffset = 3;
>+ testFocus("link4", link4, false, true);

technically you could replace it (see test_text_caret.html) when you add new invoker object for this test:

invoke function:

focus link4
set caret offset for heading

event seq:
caret change (expected, this.eventSeq)
focus (not expected, this.unexpectedEventSeq) and please add todo(false, ) so we can get back later to this to decide if we need to fire focus event here

check function:

caret offset for heading
link4 should stay focused

please rerequest review when comments are addressed
btw, thank you for working on this!