Bug 1418102 - fixed jsat addName method when name is an empty string. Updated tests. r=surkov
authorYura Zenevich <yura.zenevich@gmail.com>
Mon, 20 Nov 2017 11:37:48 -0500
changeset 392739 ad911d3cc87c0f36791d00b9e8ba74c6e5369d2f
parent 392738 64bbd3645b620d604862a77f605e736747711790
child 392740 3ff4641c1cc525cfc15839f325196e3d40b34f83
push id32940
push usercsabou@mozilla.com
push dateMon, 20 Nov 2017 22:02:04 +0000
treeherdermozilla-central@081c06e175b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1418102
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1418102 - fixed jsat addName method when name is an empty string. Updated tests. r=surkov MozReview-Commit-ID: HoKtFOmua9U
accessible/jsat/OutputGenerator.jsm
accessible/tests/mochitest/jsat/test_output.html
--- a/accessible/jsat/OutputGenerator.jsm
+++ b/accessible/jsat/OutputGenerator.jsm
@@ -172,20 +172,23 @@ var OutputGenerator = {
     }
 
     let description = aAccessible.description;
     if (description) {
       // Compare against the calculated name unconditionally, regardless of name rule,
       // so we can make sure we don't speak duplicated descriptions
       let tmpName = name || aAccessible.name;
       if (tmpName && (description !== tmpName)) {
-        name = name || "";
-        name = this.outputOrder === OUTPUT_DESC_FIRST ?
-          description + " - " + name :
-          name + " - " + description;
+        if (name) {
+          name = this.outputOrder === OUTPUT_DESC_FIRST ?
+            description + " - " + name :
+            name + " - " + description;
+        } else {
+          name = description;
+        }
       }
     }
 
     if (!name || !name.trim()) {
       return;
     }
     aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? "push" : "unshift"](name);
   },
--- a/accessible/tests/mochitest/jsat/test_output.html
+++ b/accessible/tests/mochitest/jsat/test_output.html
@@ -25,20 +25,20 @@ https://bugzilla.mozilla.org/show_bug.cg
         var tests = [{
           accOrElmOrID: "anchor",
           expectedUtterance: [[{"string": "link"}, "title"],
             ["title", {"string": "link"}]],
           expectedBraille: [[{"string": "linkAbbr"}, "title"],
             ["title", {"string": "linkAbbr"}]]
         }, {
           accOrElmOrID: "anchor_titleandtext",
-          expectedUtterance: [[{"string": "link"}, "goes to the tests -",
-            "Tests"], ["Tests", "- goes to the tests", {"string": "link"}]],
-          expectedBraille:   [[{"string": "linkAbbr"}, "goes to the tests -",
-            "Tests"], ["Tests", "- goes to the tests", {"string": "linkAbbr"}]],
+          expectedUtterance: [[{"string": "link"}, "goes to the tests",
+            "Tests"], ["Tests", "goes to the tests", {"string": "link"}]],
+          expectedBraille:   [[{"string": "linkAbbr"}, "goes to the tests",
+            "Tests"], ["Tests", "goes to the tests", {"string": "linkAbbr"}]],
         }, {
           accOrElmOrID: "anchor_duplicatedtitleandtext",
           expectedUtterance: [[{"string": "link"}, "Tests"],
             ["Tests", {"string": "link"}]],
           expectedBraille: [[{"string": "linkAbbr"}, "Tests"],
             ["Tests", {"string": "linkAbbr"}]]
         }, {
           accOrElmOrID: "anchor_arialabelandtext",