blob: 2a7b58f12167d8de8101860b78da2332293f93b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* 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 { uiWindow, promiseResult } = yield FormAutofillTest.showUI(
TestData.requestEmailOnly);
// Accept the dialog.
let acceptButton = uiWindow.document.getElementById("accept");
EventUtils.synthesizeMouseAtCenter(acceptButton, {}, uiWindow);
let result = yield promiseResult;
Assert.equal(result.fields.length, 1);
Assert.equal(result.fields[0].section, "");
Assert.equal(result.fields[0].addressType, "");
Assert.equal(result.fields[0].contactType, "");
Assert.equal(result.fields[0].fieldName, "email");
Assert.equal(result.fields[0].value, "email@example.org");
});
/**
* Open the requestAutocomplete UI and cancel the dialog.
*/
add_task(function* test_cancel() {
// Request an e-mail address.
let { uiWindow, promiseResult } = yield FormAutofillTest.showUI(
TestData.requestEmailOnly);
// Cancel the dialog.
let acceptButton = uiWindow.document.getElementById("cancel");
EventUtils.synthesizeMouseAtCenter(acceptButton, {}, uiWindow);
let result = yield promiseResult;
Assert.ok(result.canceled);
});
add_task(terminationTaskFn);
|