Bug 1262006 - Swap narrate start/stop button tooltip states. r=Gijs draft
authorEitan Isaacson <eitan@monotonous.org>
Thu, 07 Apr 2016 16:15:06 -0700
changeset 348954 01c109d8536a55bb1455fd785922fea668b6cdcc
parent 348659 06678484909cc3712756f82d070548ac144d09c0
child 517987 1d54377ab86e0cee4d7921c0f42badc7a3ba4c46
push id14974
push userbmo:eitan@monotonous.org
push dateFri, 08 Apr 2016 16:49:01 +0000
reviewersGijs
bugs1262006
milestone48.0a1
Bug 1262006 - Swap narrate start/stop button tooltip states. r=Gijs MozReview-Commit-ID: 4cRneVhQclY
toolkit/components/narrate/NarrateControls.jsm
toolkit/components/narrate/test/NarrateTestUtils.jsm
toolkit/components/narrate/test/browser.ini
--- a/toolkit/components/narrate/NarrateControls.jsm
+++ b/toolkit/components/narrate/NarrateControls.jsm
@@ -185,17 +185,17 @@ NarrateControls.prototype = {
 
   _updateSpeechControls: function(speaking) {
     let dropdown = this._doc.getElementById("narrate-dropdown");
     dropdown.classList.toggle("keep-open", speaking);
 
     let startStopButton = this._doc.getElementById("narrate-start-stop");
     startStopButton.classList.toggle("speaking", speaking);
     startStopButton.title =
-      gStrings.GetStringFromName(speaking ? "start" : "stop");
+      gStrings.GetStringFromName(speaking ? "stop" : "start");
 
     this._doc.getElementById("narrate-skip-previous").disabled = !speaking;
     this._doc.getElementById("narrate-skip-next").disabled = !speaking;
   },
 
   _createVoiceLabel: function(voice) {
     // This is a highly imperfect method of making human-readable labels
     // for system voices. Because each platform has a different naming scheme
--- a/toolkit/components/narrate/test/NarrateTestUtils.jsm
+++ b/toolkit/components/narrate/test/NarrateTestUtils.jsm
@@ -42,24 +42,28 @@ this.NarrateTestUtils = {
   },
 
   isStoppedState: function(window, ok) {
     let $ = window.document.querySelector.bind(window.document);
     ok($(this.BACK).disabled, "back button is disabled");
     ok($(this.FORWARD).disabled, "forward button is disabled");
     ok(!!$(this.START), "start button is showing");
     ok(!$(this.STOP), "stop button is hidden");
+    // This checks for a localized label. Not the best...
+    ok($(this.START).title == "Start", "Button tooltip is correct");
   },
 
   isStartedState: function(window, ok) {
     let $ = window.document.querySelector.bind(window.document);
     ok(!$(this.BACK).disabled, "back button is enabled");
     ok(!$(this.FORWARD).disabled, "forward button is enabled");
     ok(!$(this.START), "start button is hidden");
     ok(!!$(this.STOP), "stop button is showing");
+    // This checks for a localized label. Not the best...
+    ok($(this.STOP).title == "Stop", "Button tooltip is correct");
   },
 
   selectVoice: function(window, voiceUri) {
     if (!this.isVisible(window.document.querySelector(this.VOICE_OPTIONS))) {
       window.document.querySelector(this.VOICE_SELECT).click();
     }
 
     let voiceOption = window.document.querySelector(
--- a/toolkit/components/narrate/test/browser.ini
+++ b/toolkit/components/narrate/test/browser.ini
@@ -1,8 +1,9 @@
 [DEFAULT]
 support-files =
   head.js
   NarrateTestUtils.jsm
+  !/browser/base/content/test/general/readerModeArticle.html
 
 [browser_narrate.js]
 [browser_narrate_disable.js]
 [browser_voiceselect.js]