Closed
Bug 627379
Opened 14 years ago
Closed 13 years ago
Add test for @hidden attribute
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
mozilla13
People
(Reporter: davidb, Assigned: capella)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [good first bug][mentor=surkov.alexander@gmail.com][lang=js])
Attachments
(1 file, 4 obsolete files)
4.36 KB,
patch
|
surkov
:
review+
|
Details | Diff | Splinter Review |
Filing to keep this on radar (post FF4).
Comment 1•13 years ago
|
||
I don't think we need any special support of @hidden attribute on a11y side.
So let's add mochitest for this. Please add treeupdate/test_hidden.html similar to test_visibility.html in same folder.
Whiteboard: [good first bug][mentor=surkov.alexander@gmail.com][lang=js]
Assignee | ||
Comment 2•13 years ago
|
||
With this request, is the purpose of creating test_hidden.html to have a place to add later testcases associated with style="visibility: hidden", or will the initial version of test_hidden.html also include new testcases?
Comment 3•13 years ago
|
||
(In reply to Mark Capella [:capella] from comment #2)
> With this request, is the purpose of creating test_hidden.html to have a
> place to add later testcases associated with style="visibility: hidden", or
> will the initial version of test_hidden.html also include new testcases?
I think all we should do here is to add two tests for setAttribute("hidden", "true") and removeAttribute("hidden");
test_visibility.html is quite complicated since visibility style handling is not trivial. Just copy some invoker and fit it to your needs. You can handle reorder event on container and then check the container tree.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → markcapella
Assignee | ||
Updated•13 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•13 years ago
|
||
Well ... here's a very rough draft. I say "rough" because there's a lot here I'm not sure about in terms of satisfying this request.
I do know that if I fail to do the removeAttribute("hidden") after doing the setAttribute("hidden", "true") the test FAILS:
Passed: 11
Failed: 2
Todo: 0
failed | Different amount of expected children of ['div@id="t1_parent" node', address: [object HTMLDivElement], role: section, address: [xpconnect wrapped nsIAccessible]]. - got 0, expected 1
failed | Different amount of expected children of ['div@id="t1_container" node', address: [object HTMLDivElement], role: section, address: [xpconnect wrapped nsIAccessible]]. - got 0, expected 1
Comment 5•13 years ago
|
||
Comment on attachment 602199 [details] [diff] [review]
Patch (v1)
Review of attachment 602199 [details] [diff] [review]:
-----------------------------------------------------------------
::: accessible/tests/mochitest/treeupdate/test_hidden.html
@@ +43,5 @@
> + ] }
> + ] };
> + testAccessibleTree(aContainerID, tree);
> +
> + getNode(aParentID).style.visibility = "hidden";
you should set hidden attribute here instead
@@ +75,5 @@
> +
> + function doTest()
> + {
> + document.getElementsByTagName("div")[3].setAttribute("hidden", "true");
> + document.getElementsByTagName("div")[3].removeAttribute("hidden");
this should be part of invokers
@@ +79,5 @@
> + document.getElementsByTagName("div")[3].removeAttribute("hidden");
> +
> + gQueue = new eventQueue();
> +
> + gQueue.push(new test1("t1_container", "t1_parent"));
wrong indentation
@@ +109,5 @@
> + <div id="t1_container">
> + <div id="t1_parent">
> + <div id="t1_parent" style="visibility: visible">XYZZY</div>
> + </div>
> + </div>
that's enough to have:
<div id="contianer"><input id="child"></div>
change @hidden attribute on input and test accessible tree for div
Assignee | ||
Comment 6•13 years ago
|
||
I believe I made all the changes you suggested in Patch (v2), but then also changed a few other things (experimenting). This version as-is tests clean, though oddly the passed/failed/to-do summary dissappears.
Commenting out the line ... document.getElementsByTagName("input")[0].removeAttribute("hidden"); ... causes the passed/failed/to-do summary to re-appear but with one failed test ... failed | Different amount of expected children of ['div@id="container" node', address: [object HTMLDivElement], role: section, address: [xpconnect wrapped nsIAccessible]]. - got 1, expected 0
Comment 7•13 years ago
|
||
Comment on attachment 602252 [details] [diff] [review]
Patch (v2)
Review of attachment 602252 [details] [diff] [review]:
-----------------------------------------------------------------
::: accessible/tests/mochitest/treeupdate/test_hidden.html
@@ +25,5 @@
> +
> + /**
> + * Hide parent while child stays visible.
> + */
> + function test1(aContainerID)
please give function a proper name like setHiddenAttr
@@ +38,5 @@
> + { SECTION: [
> + ] };
> + testAccessibleTree(aContainerID, tree);
> +
> + document.getElementsByTagName("input")[0].setAttribute("hidden", "true");
use getNode("input") to get a node, it's shorter and faster since use getElementById
@@ +39,5 @@
> + ] };
> + testAccessibleTree(aContainerID, tree);
> +
> + document.getElementsByTagName("input")[0].setAttribute("hidden", "true");
> + document.getElementsByTagName("input")[0].removeAttribute("hidden");
I think setting and unsetting attribute may do nothing, you should keep removeAttribute("hidden") in another invoker
Assignee | ||
Comment 8•13 years ago
|
||
This seems to fit the bill ... I took your suggestions and some further clues from test_doc.html ...
Comment 9•13 years ago
|
||
(In reply to Mark Capella [:capella] from comment #8)
> Created attachment 602263 [details] [diff] [review]
> Patch (v3)
>
> This seems to fit the bill ... I took your suggestions and some further
> clues from test_doc.html ...
it fits the part of bill :) please add another invoker to test removeAttribute("hidden")
Assignee | ||
Comment 10•13 years ago
|
||
Ok! I actually had the code in for it, but saw something I wasn't sure about so I pulled it to get to a clean checkpoint ... will add back, address issues, and re-post asap -- mark
Assignee | ||
Comment 11•13 years ago
|
||
Not sure what bothered me before, but this works ...
Attachment #602199 -
Attachment is obsolete: true
Attachment #602252 -
Attachment is obsolete: true
Attachment #602263 -
Attachment is obsolete: true
Comment 12•13 years ago
|
||
Comment on attachment 602267 [details] [diff] [review]
Patch (v4)
Review of attachment 602267 [details] [diff] [review]:
-----------------------------------------------------------------
::: accessible/tests/mochitest/treeupdate/test_hidden.html
@@ +1,5 @@
> +<!DOCTYPE html>
> +<html>
> +
> +<head>
> + <title>change @hidden attribute on input and test accessible tree for div</title>
@hidden attribute testing
@@ +26,5 @@
> + /**
> + * Set @hidden attribute
> + */
> +
> + function setHiddenAttr(aContainerID, aChildID)
no empty line between a comment and function please
@@ +32,5 @@
> + this.eventSeq = [
> + new invokerChecker(EVENT_REORDER, getNode(aContainerID))
> + ];
> +
> + this.invoke = function invoke()
please prefix function names by constructor name like
this.invoke = function setHiddenAttr_invoke()
@@ +34,5 @@
> + ];
> +
> + this.invoke = function invoke()
> + {
> + getNode(aChildID).setAttribute("hidden", "true");
please test the tree before you change attribute to make sure the input in the tree
@@ +69,5 @@
> +
> + this.finalCheck = function finalCheck ()
> + {
> + var tree =
> + { };
why do you test empty object as a tree?
@@ +96,5 @@
> +
> + gQueue.push(new setHiddenAttr("container", "child"));
> + gQueue.push(new removeHiddenAttr("container", "child"));
> +
> + gQueue.invoke(); // SimpleTest.finish() will be called in the end
single space after gQueue.invoke(); and comment
@@ +112,5 @@
> + <a target="_blank"
> + title="change @hidden attribute on input and test accessible tree for div"
> + href="https://bugzilla.mozilla.org/show_bug.cgi?id=627379">
> + Mozilla Bug 627379
> + </a>
you may not add a bug here since all we do is to add mochitests but if you want to then please specify the bug summary
Assignee | ||
Comment 13•13 years ago
|
||
Ever optimistic ...
Comment 14•13 years ago
|
||
Comment on attachment 602285 [details] [diff] [review]
Patch (v5)
Review of attachment 602285 [details] [diff] [review]:
-----------------------------------------------------------------
excellent!
::: accessible/tests/mochitest/treeupdate/test_hidden.html
@@ +43,5 @@
> +
> + getNode(aChildID).setAttribute("hidden", "true");
> + }
> +
> + this.finalCheck = function setHiddenAttr_finalCheck ()
no need whitespace between function name and ()
@@ +76,5 @@
> +
> + getNode(aChildID).removeAttribute("hidden");
> + }
> +
> + this.finalCheck = function removeHiddenAttr_finalCheck ()
same
Attachment #602285 -
Flags: review+
Updated•13 years ago
|
Attachment #602267 -
Attachment is obsolete: true
Updated•13 years ago
|
Summary: Expose @hidden → Add test for @hidden attribute
Comment 15•13 years ago
|
||
Comment 16•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in
before you can comment on or make changes to this bug.
Description
•