discourse/test/javascripts/acceptance/admin-suspend-user-test.js.es6

36 lines
954 B
Plaintext
Raw Normal View History

2017-09-13 05:07:42 +08:00
import { acceptance } from "helpers/qunit-helpers";
acceptance("Admin - Suspend User", { loggedIn: true });
QUnit.test("suspend a user - cancel", assert => {
visit("/admin/users/1234/regular");
click(".suspend-user");
andThen(() => {
assert.equal(find('.suspend-user-modal:visible').length, 1);
});
click('.cancel-suspend');
andThen(() => {
assert.equal(find('.suspend-user-modal:visible').length, 0);
});
});
QUnit.test("suspend a user", assert => {
visit("/admin/users/1234/regular");
click(".suspend-user");
andThen(() => {
assert.equal(find('.perform-suspend[disabled]').length, 1, 'disabled by default');
});
fillIn('.suspend-duration', 12);
fillIn('.suspend-reason', "for breaking the rules");
andThen(() => {
assert.equal(find('.perform-suspend[disabled]').length, 0);
});
click('.perform-suspend');
andThen(() => {
assert.equal(find('.suspend-user-modal:visible').length, 0);
});
});