2020-07-14 12:36:19 -04:00
|
|
|
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
|
|
|
|
|
|
|
acceptance("Topic - Admin Menu Anonymous Users", { loggedIn: false });
|
|
|
|
|
|
|
|
QUnit.test("Enter as a regular user", async (assert) => {
|
|
|
|
await visit("/t/internationalization-localization/280");
|
|
|
|
assert.ok(exists("#topic"), "The topic was rendered");
|
2020-08-20 05:38:18 -04:00
|
|
|
assert.ok(
|
|
|
|
!exists(".toggle-admin-menu"),
|
|
|
|
"The admin menu button was not rendered"
|
|
|
|
);
|
2020-07-14 12:36:19 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
acceptance("Topic - Admin Menu", { loggedIn: true });
|
|
|
|
|
|
|
|
QUnit.test(
|
|
|
|
"Enter as a user with group moderator permissions",
|
|
|
|
async (assert) => {
|
|
|
|
updateCurrentUser({ moderator: false, admin: false, trust_level: 1 });
|
|
|
|
|
|
|
|
await visit("/t/topic-for-group-moderators/2480");
|
|
|
|
assert.ok(exists("#topic"), "The topic was rendered");
|
|
|
|
assert.ok(
|
|
|
|
exists(".toggle-admin-menu"),
|
|
|
|
"The admin menu button was rendered"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2020-08-20 05:38:18 -04:00
|
|
|
QUnit.test(
|
|
|
|
"Enter as a user with moderator and admin permissions",
|
|
|
|
async (assert) => {
|
|
|
|
updateCurrentUser({ moderator: true, admin: true, trust_level: 4 });
|
|
|
|
|
|
|
|
await visit("/t/internationalization-localization/280");
|
|
|
|
assert.ok(exists("#topic"), "The topic was rendered");
|
|
|
|
assert.ok(
|
|
|
|
exists(".toggle-admin-menu"),
|
|
|
|
"The admin menu button was rendered"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2020-08-31 20:29:35 -04:00
|
|
|
|
|
|
|
QUnit.test(
|
|
|
|
"Toggle the menu as admin focuses the first item",
|
|
|
|
async (assert) => {
|
|
|
|
updateCurrentUser({ admin: true });
|
|
|
|
|
|
|
|
await visit("/t/internationalization-localization/280");
|
|
|
|
assert.ok(exists("#topic"), "The topic was rendered");
|
|
|
|
await click(".toggle-admin-menu");
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
document.activeElement,
|
|
|
|
document.querySelector(".topic-admin-multi-select > button")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|