FIX: Full name validation regression (#24178)

Regressed in 351cbab1a8568c06e138cf5d31fa66552c3ef352
This commit is contained in:
Jarek Radosz 2023-10-31 14:44:27 +01:00 committed by GitHub
parent 05e810e3bf
commit dbb532bae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -53,6 +53,8 @@ export default class CreateAccount extends Component.extend(
@alias("model.authOptions") authOptions;
@alias("model.accountEmail") accountEmail;
@alias("model.accountUsername") accountUsername;
// For NameValidation mixin
@alias("model.accountName") accountName;
init() {
super.init(...arguments);

View File

@ -79,3 +79,38 @@ acceptance("Create Account", function () {
assert.verifySteps(["buildPostForm"]);
});
});
acceptance("Create Account - full_name_required", function (needs) {
needs.settings({ full_name_required: true });
test("full_name_required", async function (assert) {
await visit("/");
await click("header .sign-up-button");
await fillIn("#new-account-email", "z@z.co");
await fillIn("#new-account-username", "good-tuna");
await fillIn("#new-account-password", "cool password bro");
await click(".modal-footer .btn-primary");
assert.dom("#fullname-validation").hasText(I18n.t("user.name.required"));
await fillIn("#new-account-name", "Full Name");
pretender.post("/u", (request) => {
assert.step("request");
const data = parsePostData(request.requestBody);
assert.strictEqual(data.name, "Full Name");
assert.strictEqual(data.password, "cool password bro");
assert.strictEqual(data.email, "z@z.co");
assert.strictEqual(data.username, "good-tuna");
return response({ success: true });
});
await click(".modal-footer .btn-primary");
assert
.dom(".modal-footer .btn-primary:disabled")
.exists("create account is disabled");
assert.verifySteps(["request"]);
});
});