2015-04-07 02:14:00 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2014-09-27 02:48:34 +08:00
|
|
|
|
2015-04-07 02:14:00 +08:00
|
|
|
acceptance("Create Account - User Fields", {
|
2014-09-27 02:48:34 +08:00
|
|
|
site: {
|
2014-10-09 02:38:18 +08:00
|
|
|
user_fields: [{"id":34,"name":"I've read the terms of service","field_type":"confirm","required":true},
|
|
|
|
{"id":35,"name":"What is your pet's name?","field_type":"text","required":true},
|
|
|
|
{"id":36,"name":"What's your dad like?","field_type":"text","required":false}]
|
2014-09-27 02:48:34 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-06-15 01:57:58 +08:00
|
|
|
QUnit.test("create account with user fields", assert => {
|
2014-09-27 02:48:34 +08:00
|
|
|
visit("/");
|
|
|
|
click("header .sign-up-button");
|
|
|
|
|
2015-03-19 19:22:56 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
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');
|
2014-09-27 02:48:34 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
fillIn('#new-account-name', 'Dr. Good Tuna');
|
|
|
|
fillIn('#new-account-password', 'cool password bro');
|
|
|
|
fillIn('#new-account-email', 'good.tuna@test.com');
|
|
|
|
fillIn('#new-account-username', 'goodtuna');
|
|
|
|
|
2015-03-19 19:22:56 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists('#username-validation.good'), 'the username validation is good');
|
|
|
|
assert.ok(exists('.modal-footer .btn-primary:disabled'), 'create account is still disabled due to lack of user fields');
|
2014-09-27 02:48:34 +08:00
|
|
|
});
|
|
|
|
|
2014-10-09 02:38:18 +08:00
|
|
|
fillIn(".user-field input[type=text]:first", "Barky");
|
2014-09-27 02:48:34 +08:00
|
|
|
|
2015-03-19 19:22:56 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled because field is not checked');
|
2014-09-27 02:48:34 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
click(".user-field input[type=checkbox]");
|
2015-03-19 19:22:56 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.not(exists('.modal-footer .btn-primary:disabled'), 'create account is enabled because field is not checked');
|
2014-09-27 02:48:34 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
click(".user-field input[type=checkbox]");
|
2015-03-19 19:22:56 +08:00
|
|
|
andThen(() => {
|
2017-06-15 01:57:58 +08:00
|
|
|
assert.ok(exists('.modal-footer .btn-primary:disabled'), 'unclicking the checkbox disables the submit');
|
2014-09-27 02:48:34 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|