Bug 963067 - 'Cut' in the cut, copy, paste menu is always active after a browser launch. r=jimm
authorAleh Zasypkin <aleh.zasypkin@gmail.com>
Mon, 03 Feb 2014 09:43:43 -0500
changeset 166620 5188634e8e195777524b39b80343ff2f1f0a4069
parent 166619 9ea9e72a11b60bf62734868cdf4219d4a181cd05
child 166621 d33aff1eaaedf0418077b089efcb1065fce6e50d
push id4802
push userryanvm@gmail.com
push dateMon, 03 Feb 2014 14:44:08 +0000
treeherderfx-team@5188634e8e19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs963067
milestone29.0a1
Bug 963067 - 'Cut' in the cut, copy, paste menu is always active after a browser launch. r=jimm
browser/metro/base/content/helperui/MenuUI.js
browser/metro/base/tests/mochitest/browser_context_menu_tests.js
--- a/browser/metro/base/content/helperui/MenuUI.js
+++ b/browser/metro/base/content/helperui/MenuUI.js
@@ -162,16 +162,17 @@ var ContextMenuUI = {
     if (contentTypes.indexOf("link") != -1 &&
         (contentTypes.indexOf("image") != -1  ||
          contentTypes.indexOf("video") != -1 ||
          contentTypes.indexOf("selected-text") != -1))
       multipleMediaTypes = true;
 
     for (let command of Array.slice(this.commands.childNodes)) {
       command.hidden = true;
+      command.selected = false;
     }
 
     let optionsAvailable = false;
     for (let command of Array.slice(this.commands.childNodes)) {
       let types = command.getAttribute("type").split(",");
       let lowPriority = (command.hasAttribute("priority") &&
         command.getAttribute("priority") == "low");
       let searchTextItem = (command.id == "context-search");
--- a/browser/metro/base/tests/mochitest/browser_context_menu_tests.js
+++ b/browser/metro/base/tests/mochitest/browser_context_menu_tests.js
@@ -869,12 +869,49 @@ gTests.push({
       return clipboardContent == contentToCopy;
     });
     ok(clipboardContent == contentToCopy, "Rich content copied.");
 
     Browser.closeTab(Browser.selectedTab, { forceClose: true });
   }
 });
 
+gTests.push({
+  desc: "Bug 963067 - 'Cut' in the cut, copy, paste menu is always active " +
+        "after a browser launch.",
+  run: function test() {
+    info(chromeRoot + "browser_context_menu_tests_02.html");
+    yield addTab(chromeRoot + "browser_context_menu_tests_02.html");
+
+    purgeEventQueue();
+    emptyClipboard();
+
+    ContextUI.dismiss();
+    yield waitForCondition(() => !ContextUI.navbarVisible);
+
+    let tabWindow = Browser.selectedTab.browser.contentWindow;
+    let input = tabWindow.document.getElementById("text3-input");
+    let cutMenuItem = document.getElementById("context-cut");
+
+    input.select();
+
+    // Emulate RichListBox's behavior and set first item selected by default.
+    cutMenuItem.selected = true;
+
+    let promise = waitForEvent(document, "popupshown");
+    sendContextMenuClickToElement(tabWindow, input);
+    yield promise;
+
+    ok(!cutMenuItem.hidden && !cutMenuItem.selected,
+       "Cut menu item is visible and not selected.");
+
+    promise = waitForEvent(document, "popuphidden");
+    ContextMenuUI.hide();
+    yield promise;
+
+    Browser.closeTab(Browser.selectedTab, { forceClose: true });
+  }
+});
+
 function test() {
   setDevPixelEqualToPx();
   runTests();
 }