discourse/test/javascripts/acceptance/preferences-test.js.es6

50 lines
1.3 KiB
Plaintext
Raw Normal View History

import { acceptance } from "helpers/qunit-helpers";
acceptance("User Preferences", { loggedIn: true });
test("update some fields", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/preferences");
andThen(() => {
ok($('body.user-preferences-page').length, "has the body class");
equal(currentURL(), '/u/eviltrout/preferences/account', "defaults to account tab");
ok(exists('.user-preferences'), 'it shows the preferences');
});
click(".preferences-nav .nav-profile a");
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-10 16:20:31 -05:00
test("username", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/preferences/username");
andThen(() => {
2016-11-10 16:20:31 -05:00
ok(exists("#change_username"), "it has the input element");
});
});
2016-11-10 16:20:31 -05:00
test("about me", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/preferences/about-me");
andThen(() => {
2016-11-10 16:20:31 -05:00
ok(exists(".raw-bio"), "it has the input element");
});
});
2016-11-10 16:20:31 -05:00
test("email", () => {
2017-03-28 14:27:54 -04:00
visit("/u/eviltrout/preferences/email");
2016-11-10 16:20:31 -05:00
andThen(() => {
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-10 16:20:31 -05:00
});
});