fune/toolkit/components/formautofill/test/browser/browser_ui_requestAutocomplete.js
Paolo Amadini 801b375528 Bug 1020865 - Implement the dialog displayed upon form.requestAutocomplete(). r=MattN
--HG--
rename : toolkit/components/formautofill/test/chrome/test_requestAutocomplete_disabled.html => toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.html
2014-07-14 13:51:56 +01:00

43 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/*
* Tests the requestAutocomplete user interface.
*/
"use strict";
/**
* Open the requestAutocomplete UI and test that selecting a profile results in
* the correct data being sent back to the opener.
*/
add_task(function* test_select_profile() {
// Request an e-mail address.
let data = { "": { "": { "email": null } } };
let { uiWindow, promiseResult } = yield FormAutofillTest.showUI(data);
// Accept the dialog.
let acceptButton = uiWindow.document.getElementById("accept");
EventUtils.synthesizeMouseAtCenter(acceptButton, {}, uiWindow);
let result = yield promiseResult;
Assert.equal(result.email, "email@example.org");
});
/**
* Open the requestAutocomplete UI and cancel the dialog.
*/
add_task(function* test_cancel() {
// Request an e-mail address.
let data = { "": { "": { "email": null } } };
let { uiWindow, promiseResult } = yield FormAutofillTest.showUI(data);
// Cancel the dialog.
let acceptButton = uiWindow.document.getElementById("cancel");
EventUtils.synthesizeMouseAtCenter(acceptButton, {}, uiWindow);
let result = yield promiseResult;
Assert.ok(result.canceled);
});
add_task(terminationTaskFn);