mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1402239 - Use oninput to check new container name. r=jaws
This commit is contained in:
parent
6e84ca9226
commit
1505b7e785
@ -32,7 +32,7 @@
|
||||
<vbox class="contentPane largeDialogContainer" flex="1" hidden="true" id="containers-content">
|
||||
<hbox align="start">
|
||||
<label id="nameLabel" control="name" accesskey="&name2.accesskey;">&name2.label;</label>
|
||||
<textbox id="name" placeholder="&name.placeholder;" flex="1" onkeyup="gContainersManager.checkForm();" />
|
||||
<textbox id="name" placeholder="&name.placeholder;" flex="1" oninput="gContainersManager.checkForm();" />
|
||||
</hbox>
|
||||
<hbox align="center" id="iconWrapper">
|
||||
<label id="iconLabel" control="icon" accesskey="&icon2.accesskey;">&icon2.label;</label>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</vbox>
|
||||
<vbox>
|
||||
<hbox flex="1">
|
||||
<button onclick="gContainersPane.onAddButtonClick();" accesskey="&addButton.accesskey;" label="&addButton.label;"/>
|
||||
<button id="containersAdd" onclick="gContainersPane.onAddButtonClick();" accesskey="&addButton.accesskey;" label="&addButton.label;"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
|
@ -79,3 +79,5 @@ support-files =
|
||||
[browser_telemetry.js]
|
||||
# Skip this test on Android as FHR and Telemetry are separate systems there.
|
||||
skip-if = !healthreport || !telemetry || (os == 'linux' && debug) || (os == 'android')
|
||||
[browser_containers_name_input.js]
|
||||
run-if = nightly_build # Containers is enabled only on Nightly
|
||||
|
@ -0,0 +1,50 @@
|
||||
const CONTAINERS_URL = "chrome://browser/content/preferences/containers.xul";
|
||||
|
||||
add_task(async function setup() {
|
||||
await openPreferencesViaOpenPreferencesAPI("containers", { leaveOpen: true });
|
||||
registerCleanupFunction(async function() {
|
||||
await 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.click();
|
||||
|
||||
let dialog = await dialogPromise;
|
||||
|
||||
return dialog.document;
|
||||
}
|
||||
|
||||
let doc = await openDialog();
|
||||
|
||||
let name = doc.getElementById("name");
|
||||
let btnApplyChanges = doc.getElementById("btnApplyChanges");
|
||||
|
||||
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");
|
||||
});
|
Loading…
Reference in New Issue
Block a user