mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Refactor user suspension modal
This commit is contained in:
35
test/javascripts/acceptance/admin-suspend-user-test.js.es6
Normal file
35
test/javascripts/acceptance/admin-suspend-user-test.js.es6
Normal file
@@ -0,0 +1,35 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -23,4 +23,4 @@ QUnit.test('revoke key', function(assert) {
|
||||
return adminUser.revokeApiKey().then(function() {
|
||||
assert.blank(adminUser.get('api_key'), 'it cleared the api_key');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -271,6 +271,10 @@ export default function() {
|
||||
return response(200, fixturesByUrl['/groups.json']);
|
||||
});
|
||||
|
||||
this.get("groups/search.json", () => {
|
||||
return response(200, []);
|
||||
});
|
||||
|
||||
this.get("/groups/discourse/topics.json", () => {
|
||||
return response(200, fixturesByUrl['/groups/discourse/posts.json']);
|
||||
});
|
||||
@@ -345,6 +349,14 @@ export default function() {
|
||||
});
|
||||
|
||||
this.get('/tag_groups', () => response(200, {tag_groups: []}));
|
||||
|
||||
this.get('/admin/users/1234.json', request => {
|
||||
return response(200, {
|
||||
id: 1234,
|
||||
username: 'regular',
|
||||
});
|
||||
});
|
||||
|
||||
this.post('/admin/users/:user_id/generate_api_key', success);
|
||||
this.delete('/admin/users/:user_id/revoke_api_key', success);
|
||||
this.delete('/admin/users/:user_id.json', () => response(200, { deleted: true }));
|
||||
|
||||
Reference in New Issue
Block a user