blob: b456c693f851d51b381ce2057a80ca03ff9c1ca0 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
const CONTAINERS_URL =
"chrome://browser/content/preferences/dialogs/containers.xhtml";
add_setup(async function() {
await openPreferencesViaOpenPreferencesAPI("containers", { leaveOpen: true });
registerCleanupFunction(async function() {
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
});
add_task(async function() {
async function openDialog() {
let doc = gBrowser.selectedBrowser.contentDocument;
let dialogPromise = promiseLoadSubDialog(CONTAINERS_URL);
let addButton = doc.getElementById("containersAdd");
addButton.doCommand();
let dialog = await dialogPromise;
return dialog.document;
}
let { contentDocument } = gBrowser.selectedBrowser;
let containerNodes = Array.from(
contentDocument.querySelectorAll("[data-category=paneContainers]")
);
ok(
containerNodes.find(node => node.getBoundingClientRect().width > 0),
"Should actually be showing the container nodes."
);
let doc = await openDialog();
let name = doc.getElementById("name");
let btnApplyChanges = doc.querySelector("dialog").getButton("accept");
Assert.equal(name.value, "", "The name textbox should initlally be empty");
Assert.ok(
btnApplyChanges.disabled,
"The done button should initially be disabled"
);
function setName(value) {
name.value = value;
let event = new doc.defaultView.InputEvent("input", { data: value });
SpecialPowers.dispatchEvent(doc.defaultView, name, event);
}
setName("test");
Assert.ok(
!btnApplyChanges.disabled,
"The done button should be enabled when the value is not empty"
);
setName("");
Assert.ok(
btnApplyChanges.disabled,
"The done button should be disabled when the value is empty"
);
});
|