2017-02-14 05:19:41 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2018-06-15 23:03:24 +08:00
|
|
|
import PreloadStore from "preload-store";
|
2017-02-14 05:19:41 +08:00
|
|
|
|
2017-05-29 15:45:01 +08:00
|
|
|
acceptance("Invite Accept", {
|
|
|
|
settings: {
|
|
|
|
full_name_required: true
|
|
|
|
}
|
|
|
|
});
|
2017-02-14 05:19:41 +08:00
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("Invite Acceptance Page", assert => {
|
2018-06-15 23:03:24 +08:00
|
|
|
PreloadStore.store("invite_info", {
|
|
|
|
invited_by: {
|
|
|
|
id: 123,
|
|
|
|
username: "neil",
|
|
|
|
avatar_template: "/user_avatar/localhost/neil/{size}/25_1.png",
|
|
|
|
name: "Neil Lalonde",
|
|
|
|
title: "team"
|
|
|
|
},
|
2017-02-14 05:19:41 +08:00
|
|
|
email: "invited@asdf.com",
|
|
|
|
username: "invited"
|
|
|
|
});
|
|
|
|
|
|
|
|
visit("/invites/myvalidinvitetoken");
|
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists("#new-account-username"), "shows the username input");
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(
|
|
|
|
find("#new-account-username").val(),
|
|
|
|
"invited",
|
|
|
|
"username is prefilled"
|
|
|
|
);
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists("#new-account-name"), "shows the name input");
|
|
|
|
assert.ok(exists("#new-account-password"), "shows the password input");
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(
|
|
|
|
exists(".invites-show .btn-primary:disabled"),
|
|
|
|
"submit is disabled because name is not filled"
|
|
|
|
);
|
2017-05-29 15:45:01 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
fillIn("#new-account-name", "John Doe");
|
2017-05-29 15:45:01 +08:00
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.not(
|
|
|
|
exists(".invites-show .btn-primary:disabled"),
|
|
|
|
"submit is enabled"
|
|
|
|
);
|
2017-02-14 05:19:41 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
fillIn("#new-account-username", "a");
|
2017-02-14 05:19:41 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists(".username-input .bad"), "username is not valid");
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(
|
|
|
|
exists(".invites-show .btn-primary:disabled"),
|
|
|
|
"submit is disabled"
|
|
|
|
);
|
2017-02-14 05:19:41 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
fillIn("#new-account-password", "aaa");
|
2017-02-14 05:19:41 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists(".password-input .bad"), "password is not valid");
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(
|
|
|
|
exists(".invites-show .btn-primary:disabled"),
|
|
|
|
"submit is disabled"
|
|
|
|
);
|
2017-02-14 05:19:41 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
fillIn("#new-account-username", "validname");
|
|
|
|
fillIn("#new-account-password", "secur3ty4Y0uAndMe");
|
2017-02-14 05:19:41 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists(".username-input .good"), "username is valid");
|
|
|
|
assert.ok(exists(".password-input .good"), "password is valid");
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.not(
|
|
|
|
exists(".invites-show .btn-primary:disabled"),
|
|
|
|
"submit is enabled"
|
|
|
|
);
|
2017-02-14 05:19:41 +08:00
|
|
|
});
|
|
|
|
});
|