зеркало из https://github.com/mozilla/pjs.git
Bug 568287 - Expand test for 'Copy Password' context menu item in Password Manager [r=dolske]
This commit is contained in:
Родитель
fc409beff8
Коммит
a14771fc6f
|
@ -65,13 +65,13 @@
|
|||
</keyset>
|
||||
|
||||
<popupset id="signonsTreeContextSet">
|
||||
<popup id="signonsTreeContextMenu"
|
||||
<menupopup id="signonsTreeContextMenu"
|
||||
onpopupshowing="UpdateCopyPassword()">
|
||||
<menuitem id="context-copypassword"
|
||||
label="©PasswordCmd.label;"
|
||||
accesskey="©PasswordCmd.accesskey;"
|
||||
oncommand="CopyPassword()"/>
|
||||
</popup>
|
||||
</menupopup>
|
||||
</popupset>
|
||||
|
||||
<!-- saved signons -->
|
||||
|
|
|
@ -71,14 +71,28 @@ function test() {
|
|||
|
||||
// Test if "Copy Password" works
|
||||
function doTest() {
|
||||
let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
|
||||
let data = "";
|
||||
let polls = 0;
|
||||
let doc = pwmgrdlg.document;
|
||||
let selection = doc.getElementById("signonsTree").view.selection;
|
||||
let menuitem = doc.getElementById("context-copypassword");
|
||||
|
||||
function copyPassword() {
|
||||
let doc = pwmgrdlg.document;
|
||||
doc.getElementById("signonsTree").currentIndex = 2;
|
||||
doc.getElementById("context-copypassword").doCommand();
|
||||
selection.selectAll();
|
||||
is(isMenuitemEnabled(), false, "Copy Password should be disabled");
|
||||
|
||||
selection.select(0);
|
||||
is(isMenuitemEnabled(), true, "Copy Password should be enabled");
|
||||
|
||||
selection.clearSelection();
|
||||
is(isMenuitemEnabled(), false, "Copy Password should be disabled");
|
||||
|
||||
selection.select(2);
|
||||
is(isMenuitemEnabled(), true, "Copy Password should be enabled");
|
||||
menuitem.doCommand();
|
||||
}
|
||||
|
||||
function isMenuitemEnabled() {
|
||||
doc.defaultView.UpdateCopyPassword();
|
||||
return !menuitem.getAttribute("disabled");
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче