DEV: Use qunit-dom's `isDisabled`/`isEnabled` (#29675)
This commit is contained in:
parent
d67a6002eb
commit
16a9663557
|
@ -48,8 +48,8 @@ acceptance("Create Account", function () {
|
|||
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("create account is disabled");
|
||||
.dom(".d-modal__footer .btn-primary")
|
||||
.isDisabled("create account is disabled");
|
||||
|
||||
assert.verifySteps(["request"]);
|
||||
});
|
||||
|
@ -119,8 +119,8 @@ acceptance("Create Account - full_name_required", function (needs) {
|
|||
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("create account is disabled");
|
||||
.dom(".d-modal__footer .btn-primary")
|
||||
.isDisabled("create account is disabled");
|
||||
|
||||
assert.verifySteps(["request"]);
|
||||
});
|
||||
|
|
|
@ -19,10 +19,9 @@ acceptance("Forgot password", function (needs) {
|
|||
await click("header .login-button");
|
||||
await click("#forgot-password-link");
|
||||
|
||||
assert.ok(
|
||||
query(".forgot-password-reset").disabled,
|
||||
"it should disable the button until the field is filled"
|
||||
);
|
||||
assert
|
||||
.dom(".forgot-password-reset")
|
||||
.isDisabled("disables the button until the field is filled");
|
||||
|
||||
await fillIn("#username-or-email", "someuser");
|
||||
await click(".forgot-password-reset");
|
||||
|
@ -94,10 +93,9 @@ acceptance(
|
|||
await click("header .login-button");
|
||||
await click("#forgot-password-link");
|
||||
|
||||
assert.ok(
|
||||
query(".forgot-password-reset").disabled,
|
||||
"it should disable the button until the field is filled"
|
||||
);
|
||||
assert
|
||||
.dom(".forgot-password-reset")
|
||||
.isDisabled("disables the button until the field is filled");
|
||||
|
||||
await fillIn("#username-or-email", "someuser");
|
||||
await click(".forgot-password-reset");
|
||||
|
|
|
@ -44,9 +44,7 @@ acceptance("Accept Invite - User Fields", function (needs) {
|
|||
await visit("/invites/myvalidinvitetoken");
|
||||
assert.dom(".invites-show").exists("shows the accept invite page");
|
||||
assert.dom(".user-field").exists("has at least one user field");
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("submit is disabled");
|
||||
assert.dom(".invites-show .btn-primary").isDisabled("submit is disabled");
|
||||
|
||||
await fillIn("#new-account-name", "John Doe");
|
||||
await fillIn("#new-account-username", "validname");
|
||||
|
@ -54,23 +52,23 @@ acceptance("Accept Invite - User Fields", function (needs) {
|
|||
|
||||
assert.dom(".username-input .good").exists("username is valid");
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("submit is still disabled due to lack of user fields");
|
||||
.dom(".invites-show .btn-primary")
|
||||
.isDisabled("submit is still disabled due to lack of user fields");
|
||||
|
||||
await fillIn(".user-field input[type=text]:nth-of-type(1)", "Barky");
|
||||
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("submit is disabled because field is not checked");
|
||||
.dom(".invites-show .btn-primary")
|
||||
.isDisabled("submit is disabled because field is not checked");
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.doesNotExist("submit is enabled because field is checked");
|
||||
.dom(".invites-show .btn-primary")
|
||||
.isEnabled("submit is enabled because field is checked");
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert
|
||||
.dom(".invites-show .btn-primary:disabled")
|
||||
.exists("unclicking the checkbox disables the submit");
|
||||
.dom(".invites-show .btn-primary")
|
||||
.isDisabled("toggling the checkbox disables the submit");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,8 +14,8 @@ acceptance("Signing In", function () {
|
|||
await click(".d-modal__footer .btn-primary");
|
||||
assert.dom("#modal-alert").exists("displays the login error");
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.doesNotExist("enables the login button");
|
||||
.dom(".d-modal__footer .btn-primary")
|
||||
.isEnabled("enables the login button");
|
||||
|
||||
// Test password unmasking
|
||||
assert
|
||||
|
@ -30,8 +30,8 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-account-password", "correct");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("disables the login button");
|
||||
.dom(".d-modal__footer .btn-primary")
|
||||
.isDisabled("disables the login button");
|
||||
});
|
||||
|
||||
test("sign in - not activated", async function (assert) {
|
||||
|
@ -92,15 +92,15 @@ acceptance("Signing In", function () {
|
|||
.isNotVisible("hides the username and password prompt");
|
||||
assert.dom("#second-factor").isVisible("displays the second factor prompt");
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.doesNotExist("enables the login button");
|
||||
.dom(".d-modal__footer .btn-primary")
|
||||
.isEnabled("enables the login button");
|
||||
|
||||
await fillIn("#login-second-factor", "123456");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("disables the login button");
|
||||
.dom(".d-modal__footer .btn-primary")
|
||||
.isDisabled("disables the login button");
|
||||
});
|
||||
|
||||
test("security key", async function (assert) {
|
||||
|
@ -133,9 +133,7 @@ acceptance("Signing In", function () {
|
|||
await fillIn("#login-second-factor", "123456");
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
assert
|
||||
.dom(".d-modal__footer .btn-primary:disabled")
|
||||
.exists("closes the modal when the code is valid");
|
||||
assert.dom(".d-modal__footer .btn-primary").isDisabled();
|
||||
});
|
||||
|
||||
test("second factor backup - invalid token", async function (assert) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { setPrefix } from "discourse-common/lib/get-url";
|
||||
|
||||
|
@ -54,7 +54,7 @@ acceptance("Tag Groups", function (needs) {
|
|||
|
||||
await tags.expand();
|
||||
await tags.deselectItemByValue("monkey");
|
||||
assert.ok(!query(".tag-group-content .btn.btn-danger").disabled);
|
||||
assert.dom(".tag-group-content .btn.btn-danger").isEnabled();
|
||||
});
|
||||
|
||||
test("tag groups can have multiple groups added to them", async function (assert) {
|
||||
|
@ -73,7 +73,7 @@ acceptance("Tag Groups", function (needs) {
|
|||
await groups.selectRowByIndex(1);
|
||||
await groups.selectRowByIndex(0);
|
||||
|
||||
assert.ok(!query(".tag-group-content .btn.btn-primary").disabled);
|
||||
assert.dom(".tag-group-content .btn.btn-primary").isEnabled();
|
||||
|
||||
await click(".tag-group-content .btn.btn-primary");
|
||||
await click(".tag-groups-sidebar li:first-child a");
|
||||
|
|
|
@ -235,7 +235,7 @@ acceptance("Tags listed by group", function (needs) {
|
|||
updateCurrentUser({ moderator: false, admin: false });
|
||||
|
||||
await visit("/tag/regular-tag");
|
||||
assert.dom("#create-topic:disabled").doesNotExist();
|
||||
assert.dom("#create-topic").isEnabled();
|
||||
|
||||
await visit("/tag/staff-only-tag");
|
||||
assert.dom("#create-topic").isDisabled();
|
||||
|
@ -243,10 +243,10 @@ acceptance("Tags listed by group", function (needs) {
|
|||
updateCurrentUser({ moderator: true });
|
||||
|
||||
await visit("/tag/regular-tag");
|
||||
assert.dom("#create-topic:disabled").doesNotExist();
|
||||
assert.dom("#create-topic").isEnabled();
|
||||
|
||||
await visit("/tag/staff-only-tag");
|
||||
assert.dom("#create-topic:disabled").doesNotExist();
|
||||
assert.dom("#create-topic").isEnabled();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -78,10 +78,10 @@ acceptance("User Preferences - Account", function (needs) {
|
|||
await click(".username-preference__edit-username");
|
||||
|
||||
assert.dom(".username-preference__input").hasValue("eviltrout");
|
||||
assert.true(query(".username-preference__submit").disabled);
|
||||
assert.dom(".username-preference__submit").isDisabled();
|
||||
|
||||
await fillIn(query(".username-preference__input"), "good_trout");
|
||||
assert.false(query(".username-preference__submit").disabled);
|
||||
assert.dom(".username-preference__submit").isEnabled();
|
||||
|
||||
await click(".username-preference__submit");
|
||||
await click(".dialog-container .btn-primary");
|
||||
|
|
|
@ -31,7 +31,7 @@ module("Integration | Component | invite-panel", function (hooks) {
|
|||
await input.expand();
|
||||
await input.fillInFilter("eviltrout@example.com");
|
||||
await input.selectRowByValue("eviltrout@example.com");
|
||||
assert.dom(".send-invite:disabled").doesNotExist();
|
||||
assert.dom(".send-invite").isEnabled();
|
||||
|
||||
await click(".generate-invite-link");
|
||||
assert.strictEqual(
|
||||
|
|
|
@ -201,7 +201,7 @@ module("Poll | Component | poll", function (hooks) {
|
|||
});
|
||||
await render(hbs`<Poll @post={{this.post}} @poll={{this.poll}} />`);
|
||||
|
||||
assert.dom(".poll-buttons .cast-votes:disabled").exists();
|
||||
assert.dom(".poll-buttons .cast-votes").isDisabled();
|
||||
|
||||
await click(
|
||||
"li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29'] button"
|
||||
|
|
Loading…
Reference in New Issue