Closed Bug 480294 Opened 14 years ago Closed 14 years ago

Refactor nsIAccessibleHyperLink mochitests.

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: MarcoZ, Assigned: MarcoZ)

References

Details

(Keywords: access)

Attachments

(1 file)

Make these oldest of Mochitest files I wrote use the new infrastructure.
This patch essentially works, with one exception: For both "area1" and "area2", I get an "Can't get DOM element..." failure from the getAccessible function. I'm passing in an accessible, but for some reason this function tries to get a DOM element and thinks what's passed in is an ID. Alex, any idea why that might be?
Attachment #364299 - Flags: review?(surkov.alexander)
Comment on attachment 364299 [details] [diff] [review]
Almost complete patch

Marco, I think it should work for us if we will assume

var blablaAcc = getAccessible("blablaID", [nsIAccessibleHyperLink]);

won't ever be null :) So we don't need to have huge amount of whitespace changes. Really if it will be ever null then we get test failure any way with the first error "can't get accessible for") - it's ok with us.

Any way r=me. Thanks for reorg. Much nicer.
Attachment #364299 - Flags: review?(surkov.alexander) → review+
Well, I have to change the testStates... function calls anyway, since the one in the original file had an extra parameter which the common one does not have, so these lines, along with the capitalizations, needs to be changed anyway.

Any idea on my question why area1 and area2 may gifve me an "Can't get DOM node for ..." error message? The patch as it is currently has these 2 failing test, one for area1, one for area2 when getting the accessibles.

I'll remove the if statements and extra indentation.

But before I push the patch, I need to find a way to deal with these two failures. So any idea would be appreciated!
Comment on attachment 364299 [details] [diff] [review]
Almost complete patch

Hi Marco, I think I see the problem:

>     function testThis(aID, aAcc, aRole, aAnchors, aName, aValid, aStartIndex,
>                       aEndIndex)
>     {
>-      is(aAcc.finalRole, aRole, "Wrong role for ID " + aID + "!");
>+      testRole(aID, aRole);

For area1, you called testThis, passing in "Area1" as the id, but there is no element with that id.

>+
>+        var area1 = getAccessible(imageMapHyperlinkAcc.firstChild,
>+                                  [nsIAccessibleHyperLink]);
>+        if (area1) {
>+          testThis("Area1", area1, ROLE_LINK, 1, "b", true, 0, 1);

Here's where you pass in id "Area1" (same with area2).

testRole ends up calling getAccessible, which ends up calling getElementById and failing.
Pushed with Surkov's comment addressed in changeset:
http://hg.mozilla.org/mozilla-central/rev/f20205a9bbd8
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 483391
You need to log in before you can comment on or make changes to this bug.