2015-05-13 22:42:36 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("User Preferences", { loggedIn: true });
|
|
|
|
|
|
|
|
test("update some fields", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/preferences");
|
2015-05-13 22:42:36 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2016-11-11 02:33:31 +08:00
|
|
|
ok($('body.user-preferences-page').length, "has the body class");
|
2017-04-27 04:18:16 +08:00
|
|
|
equal(currentURL(), '/u/eviltrout/preferences/account', "defaults to account tab");
|
2015-05-13 22:42:36 +08:00
|
|
|
ok(exists('.user-preferences'), 'it shows the preferences');
|
|
|
|
});
|
|
|
|
|
2017-04-27 04:18:16 +08:00
|
|
|
click(".preferences-nav .nav-profile a");
|
|
|
|
|
2015-05-13 22:42:36 +08:00
|
|
|
fillIn("#edit-location", "Westeros");
|
|
|
|
|
|
|
|
click('.save-user');
|
|
|
|
ok(!exists('.saved-user'), "it hasn't been saved yet");
|
|
|
|
andThen(() => {
|
|
|
|
ok(exists('.saved-user'), 'it displays the saved message');
|
|
|
|
});
|
|
|
|
});
|
2016-11-11 04:54:21 +08:00
|
|
|
|
2016-11-11 05:20:31 +08:00
|
|
|
test("username", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/preferences/username");
|
2016-11-11 04:54:21 +08:00
|
|
|
andThen(() => {
|
2016-11-11 05:20:31 +08:00
|
|
|
ok(exists("#change_username"), "it has the input element");
|
2016-11-11 04:54:21 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-11-11 05:20:31 +08:00
|
|
|
test("about me", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/preferences/about-me");
|
2016-11-11 04:54:21 +08:00
|
|
|
andThen(() => {
|
2016-11-11 05:20:31 +08:00
|
|
|
ok(exists(".raw-bio"), "it has the input element");
|
2016-11-11 04:54:21 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-11-11 05:20:31 +08:00
|
|
|
test("email", () => {
|
2017-03-29 02:27:54 +08:00
|
|
|
visit("/u/eviltrout/preferences/email");
|
2016-11-11 05:20:31 +08:00
|
|
|
andThen(() => {
|
2016-12-21 17:00:45 +08:00
|
|
|
ok(exists("#change-email"), "it has the input element");
|
|
|
|
});
|
|
|
|
|
|
|
|
fillIn("#change-email", 'invalidemail');
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
equal(find('.tip.bad').text().trim(), I18n.t('user.email.invalid'), 'it should display invalid email tip');
|
2016-11-11 05:20:31 +08:00
|
|
|
});
|
|
|
|
});
|