Closed Bug 1250509 Opened 4 years ago Closed 4 years ago

make pretty print nicer for accessible trees in testing

Categories

(Core :: Disability Access APIs, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: surkov, Assigned: surkov)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
No description provided.
Attachment #8722509 - Flags: review?(yzenevich)
Comment on attachment 8722509 [details] [diff] [review]
patch

Review of attachment 8722509 [details] [diff] [review]:
-----------------------------------------------------------------

good with just a couple of nits.

::: accessible/tests/mochitest/common.js
@@ +762,5 @@
>      return "[ " + getNodePrettyName(aIdentifier) + " ]";
>  
>    if (aIdentifier && typeof aIdentifier === "object" ) {
> +    var treeObj = normalizeAccTreeObj(aIdentifier);
> +    if ("role" in treeObj) {

nit: if (treeObj.role) {..}

@@ +765,5 @@
> +    var treeObj = normalizeAccTreeObj(aIdentifier);
> +    if ("role" in treeObj) {
> +      function stringifyTree(aObj) {
> +        var text = roleToString(aObj.role) + ": [ ";
> +        if ("children" in aObj) {

nit: if (aObj.children)

@@ +776,5 @@
> +          }
> +        }
> +        return text + "] ";
> +      }
> +      return "{ " + stringifyTree(treeObj) + " }";

nit: `{ ${stringifyTree(treeObj)} }`
Attachment #8722509 - Flags: review?(yzenevich) → review+
(In reply to Yura Zenevich [:yzen] from comment #1)

> ::: accessible/tests/mochitest/common.js
> @@ +762,5 @@
> >      return "[ " + getNodePrettyName(aIdentifier) + " ]";
> >  
> >    if (aIdentifier && typeof aIdentifier === "object" ) {
> > +    var treeObj = normalizeAccTreeObj(aIdentifier);
> > +    if ("role" in treeObj) {
> 
> nit: if (treeObj.role) {..}

isn't if (prop in obj) a correct way to check if property is presented in the object? I realize that role is never 0, so they are identical but anyway

> nit: `{ ${stringifyTree(treeObj)} }`

k
https://hg.mozilla.org/mozilla-central/rev/405edcc5dbfa
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Assignee: nobody → surkov.alexander
You need to log in before you can comment on or make changes to this bug.