mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
UX: don't disable "create account" button & display error message for required fields. (#9643)
This commit is contained in:
@ -31,10 +31,10 @@ QUnit.test("create account with user fields", async assert => {
|
||||
|
||||
assert.ok(exists(".create-account"), "it shows the create account modal");
|
||||
assert.ok(exists(".user-field"), "it has at least one user field");
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is disabled at first"
|
||||
);
|
||||
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.ok(exists("#modal-alert"), "it shows the required field alert");
|
||||
assert.equal(find("#modal-alert").text(), "Please enter an email address");
|
||||
|
||||
await fillIn("#new-account-name", "Dr. Good Tuna");
|
||||
await fillIn("#new-account-password", "cool password bro");
|
||||
@ -52,28 +52,13 @@ QUnit.test("create account with user fields", async assert => {
|
||||
exists("#account-email-validation.good"),
|
||||
"the email validation is good"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is still disabled due to lack of user fields"
|
||||
);
|
||||
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.equal(find("#modal-alert")[0].style.display, "");
|
||||
|
||||
await fillIn(".user-field input[type=text]:first", "Barky");
|
||||
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is disabled because field is not checked"
|
||||
);
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
|
||||
assert.ok(
|
||||
!exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is enabled because field is checked"
|
||||
);
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"unchecking the checkbox disables the create account button"
|
||||
);
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.equal(find("#modal-alert")[0].style.display, "none");
|
||||
});
|
||||
|
@ -132,10 +132,6 @@ QUnit.test("create account", async assert => {
|
||||
await click("header .sign-up-button");
|
||||
|
||||
assert.ok(exists(".create-account"), "it shows the create account modal");
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is disabled at first"
|
||||
);
|
||||
|
||||
await fillIn("#new-account-name", "Dr. Good Tuna");
|
||||
await fillIn("#new-account-password", "cool password bro");
|
||||
@ -151,20 +147,14 @@ QUnit.test("create account", async assert => {
|
||||
exists("#username-validation.bad"),
|
||||
"the username validation is bad"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is still disabled"
|
||||
);
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.ok(exists("#new-account-username:focus"), "username field is focused");
|
||||
|
||||
await fillIn("#new-account-username", "goodtuna");
|
||||
assert.ok(
|
||||
exists("#username-validation.good"),
|
||||
"the username validation is good"
|
||||
);
|
||||
assert.not(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is enabled"
|
||||
);
|
||||
|
||||
await click(".modal-footer .btn-primary");
|
||||
assert.ok(
|
||||
|
Reference in New Issue
Block a user