mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: upgrades from Ember 2.13 to Ember 3.5.1 (#6808)
Co-Authored-By: Bianca Nenciu <nbianca@users.noreply.github.com> Co-Authored-By: David Taylor <david@taylorhq.com>
This commit is contained in:
@@ -38,6 +38,9 @@ QUnit.test("create account with user fields", async assert => {
|
||||
|
||||
await fillIn("#new-account-name", "Dr. Good Tuna");
|
||||
await fillIn("#new-account-password", "cool password bro");
|
||||
// without this double fill, field will sometimes being empty
|
||||
// got consistent repro by having browser search bar focused when starting test
|
||||
await fillIn("#new-account-email", "good.tuna@test.com");
|
||||
await fillIn("#new-account-email", "good.tuna@test.com");
|
||||
await fillIn("#new-account-username", "goodtuna");
|
||||
|
||||
@@ -45,6 +48,10 @@ QUnit.test("create account with user fields", async assert => {
|
||||
exists("#username-validation.good"),
|
||||
"the username validation is good"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#account-email-validation.good"),
|
||||
"the email validation is good"
|
||||
);
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is still disabled due to lack of user fields"
|
||||
@@ -58,14 +65,15 @@ QUnit.test("create account with user fields", async assert => {
|
||||
);
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.not(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is enabled because field is not checked"
|
||||
|
||||
assert.ok(
|
||||
!exists(".modal-footer .btn-primary:disabled"),
|
||||
"create account is enabled because field is checked"
|
||||
);
|
||||
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.ok(
|
||||
exists(".modal-footer .btn-primary:disabled"),
|
||||
"unclicking the checkbox disables the submit"
|
||||
"unchecking the checkbox disables the create account button"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3,6 +3,8 @@ import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Jump to", {
|
||||
loggedIn: true,
|
||||
|
||||
mobileView: true,
|
||||
|
||||
pretend(server, helper) {
|
||||
server.get("/t/280/excerpts.json", () => helper.response(200, []));
|
||||
server.get("/t/280/3.json", () => helper.response(200, {}));
|
||||
@@ -20,7 +22,6 @@ acceptance("Jump to", {
|
||||
|
||||
QUnit.test("default", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click("nav#topic-progress .nums");
|
||||
await click("button.jump-to-post");
|
||||
|
||||
|
||||
@@ -57,12 +57,11 @@ QUnit.test("update some fields", async assert => {
|
||||
);
|
||||
assert.ok(exists(".user-preferences"), "it shows the preferences");
|
||||
|
||||
const savePreferences = () => {
|
||||
click(".save-user");
|
||||
const savePreferences = async () => {
|
||||
assert.ok(!exists(".saved-user"), "it hasn't been saved yet");
|
||||
andThen(() => {
|
||||
assert.ok(exists(".saved-user"), "it displays the saved message");
|
||||
});
|
||||
await click(".save-user");
|
||||
assert.ok(exists(".saved-user"), "it displays the saved message");
|
||||
find(".saved-user").remove();
|
||||
};
|
||||
|
||||
fillIn(".pref-name input[type=text]", "Jon Snow");
|
||||
|
||||
@@ -114,8 +114,12 @@ QUnit.test("create account", async assert => {
|
||||
await fillIn("#new-account-name", "Dr. Good Tuna");
|
||||
await fillIn("#new-account-password", "cool password bro");
|
||||
|
||||
// Check username
|
||||
// without this double fill, field will sometimes being empty
|
||||
// got consistent repro by having browser search bar focused when starting test
|
||||
await fillIn("#new-account-email", "good.tuna@test.com");
|
||||
await fillIn("#new-account-email", "good.tuna@test.com");
|
||||
|
||||
// Check username
|
||||
await fillIn("#new-account-username", "taken");
|
||||
assert.ok(
|
||||
exists("#username-validation.bad"),
|
||||
|
||||
@@ -25,6 +25,7 @@ acceptance("Topic - Edit timer", {
|
||||
});
|
||||
|
||||
QUnit.test("default", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
@@ -45,6 +46,7 @@ QUnit.test("default", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("autoclose - specific time", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
@@ -65,6 +67,7 @@ QUnit.test("autoclose - specific time", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("autoclose", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
@@ -119,6 +122,7 @@ QUnit.test("autoclose", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("close temporarily", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
@@ -160,6 +164,7 @@ QUnit.test("close temporarily", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("schedule", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const categoryChooser = selectKit(".modal-body .category-chooser");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
@@ -208,6 +213,7 @@ QUnit.test("TL4 can't auto-delete", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("auto delete", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
@@ -237,6 +243,7 @@ QUnit.test("auto delete", async assert => {
|
||||
QUnit.test(
|
||||
"Manually closing before the timer will clear the status text",
|
||||
async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
|
||||
@@ -286,3 +286,10 @@ QUnit.test("select below", async assert => {
|
||||
"it should select the right number of posts"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("View Hidden Replies", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".gap");
|
||||
|
||||
assert.equal(find(".gap").length, 0, "it hides gap");
|
||||
});
|
||||
|
||||
@@ -30,6 +30,7 @@ QUnit.test("Root URL - Viewing Self", async assert => {
|
||||
|
||||
QUnit.test("Viewing Summary", async assert => {
|
||||
await visit("/u/eviltrout/summary");
|
||||
|
||||
assert.ok(exists(".replies-section li a"), "replies");
|
||||
assert.ok(exists(".topics-section li a"), "topics");
|
||||
assert.ok(exists(".links-section li a"), "links");
|
||||
|
||||
@@ -686,7 +686,7 @@ componentTest("emoji", {
|
||||
id: "emoji",
|
||||
group: "extras",
|
||||
icon: "smile-o",
|
||||
action: "emoji"
|
||||
action: () => toolbar.context.send("emoji")
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ Object.keys(pathBindings).forEach(path => {
|
||||
var testName = binding + " goes to " + path;
|
||||
|
||||
test(testName, function(assert) {
|
||||
KeyboardShortcuts.bindEvents(testMouseTrap);
|
||||
KeyboardShortcuts.bindEvents(testMouseTrap, Discourse.__container__);
|
||||
testMouseTrap.trigger(binding);
|
||||
|
||||
assert.ok(DiscourseURL.routeTo.calledWith(path));
|
||||
@@ -88,7 +88,7 @@ Object.keys(clickBindings).forEach(selector => {
|
||||
var testName = binding + " clicks on " + selector;
|
||||
|
||||
test(testName, function(assert) {
|
||||
KeyboardShortcuts.bindEvents(testMouseTrap);
|
||||
KeyboardShortcuts.bindEvents(testMouseTrap, Discourse.__container__);
|
||||
$(selector).on("click", function() {
|
||||
assert.ok(true, selector + " was clicked");
|
||||
});
|
||||
@@ -108,24 +108,24 @@ Object.keys(functionBindings).forEach(func => {
|
||||
sandbox.stub(KeyboardShortcuts, func, function() {
|
||||
assert.ok(true, func + " is called when " + binding + " is triggered");
|
||||
});
|
||||
KeyboardShortcuts.bindEvents(testMouseTrap);
|
||||
KeyboardShortcuts.bindEvents(testMouseTrap, Discourse.__container__);
|
||||
|
||||
testMouseTrap.trigger(binding);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("selectDown calls _moveSelection with 1", assert => {
|
||||
var spy = sandbox.spy(KeyboardShortcuts, "_moveSelection");
|
||||
var stub = sandbox.stub(KeyboardShortcuts, "_moveSelection");
|
||||
|
||||
KeyboardShortcuts.selectDown();
|
||||
assert.ok(spy.calledWith(1), "_moveSelection is called with 1");
|
||||
assert.ok(stub.calledWith(1), "_moveSelection is called with 1");
|
||||
});
|
||||
|
||||
QUnit.test("selectUp calls _moveSelection with -1", assert => {
|
||||
var spy = sandbox.spy(KeyboardShortcuts, "_moveSelection");
|
||||
var stub = sandbox.stub(KeyboardShortcuts, "_moveSelection");
|
||||
|
||||
KeyboardShortcuts.selectUp();
|
||||
assert.ok(spy.calledWith(-1), "_moveSelection is called with -1");
|
||||
assert.ok(stub.calledWith(-1), "_moveSelection is called with -1");
|
||||
});
|
||||
|
||||
QUnit.test("goBack calls history.back", assert => {
|
||||
|
||||
@@ -8,7 +8,7 @@ const buildTopic = function(archetype) {
|
||||
details: {
|
||||
notification_level: 1
|
||||
},
|
||||
archetype: archetype
|
||||
archetype
|
||||
});
|
||||
};
|
||||
|
||||
@@ -70,6 +70,7 @@ componentTest("PM topic notification level descriptions", {
|
||||
descriptions.length,
|
||||
"it has the correct copy"
|
||||
);
|
||||
|
||||
uiTexts.forEach((text, index) => {
|
||||
assert.equal(
|
||||
text.trim(),
|
||||
|
||||
@@ -7,12 +7,13 @@ moduleFor("controller:create-account", "controller:create-account", {
|
||||
needs: ["controller:modal", "controller:login"]
|
||||
});
|
||||
|
||||
QUnit.test("basicUsernameValidation", function(assert) {
|
||||
var subject = this.subject;
|
||||
test("basicUsernameValidation", async function(assert) {
|
||||
const subject = this.subject;
|
||||
|
||||
var testInvalidUsername = function(username, expectedReason) {
|
||||
var controller = subject({ siteSettings: Discourse.SiteSettings });
|
||||
const testInvalidUsername = async (username, expectedReason) => {
|
||||
const controller = await subject({ siteSettings: Discourse.SiteSettings });
|
||||
controller.set("accountUsername", username);
|
||||
|
||||
assert.equal(
|
||||
controller.get("basicUsernameValidation.failed"),
|
||||
true,
|
||||
@@ -32,9 +33,12 @@ QUnit.test("basicUsernameValidation", function(assert) {
|
||||
I18n.t("user.username.too_long")
|
||||
);
|
||||
|
||||
var controller = subject({ siteSettings: Discourse.SiteSettings });
|
||||
controller.set("accountUsername", "porkchops");
|
||||
controller.set("prefilledUsername", "porkchops");
|
||||
const controller = await subject({ siteSettings: Discourse.SiteSettings });
|
||||
controller.setProperties({
|
||||
accountUsername: "porkchops",
|
||||
prefilledUsername: "porkchops"
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
controller.get("basicUsernameValidation.ok"),
|
||||
true,
|
||||
@@ -47,16 +51,17 @@ QUnit.test("basicUsernameValidation", function(assert) {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("passwordValidation", function(assert) {
|
||||
var subject = this.subject;
|
||||
test("passwordValidation", async function(assert) {
|
||||
const controller = await this.subject({
|
||||
siteSettings: Discourse.SiteSettings
|
||||
});
|
||||
|
||||
var controller = subject({ siteSettings: Discourse.SiteSettings });
|
||||
controller.set("passwordRequired", true);
|
||||
controller.set("accountEmail", "pork@chops.com");
|
||||
controller.set("accountUsername", "porkchops");
|
||||
controller.set("prefilledUsername", "porkchops");
|
||||
|
||||
controller.set("accountPassword", "b4fcdae11f9167");
|
||||
|
||||
assert.equal(controller.get("passwordValidation.ok"), true, "Password is ok");
|
||||
assert.equal(
|
||||
controller.get("passwordValidation.reason"),
|
||||
@@ -64,16 +69,16 @@ QUnit.test("passwordValidation", function(assert) {
|
||||
"Password is valid"
|
||||
);
|
||||
|
||||
var testInvalidPassword = function(password, expectedReason) {
|
||||
var c = subject({ siteSettings: Discourse.SiteSettings });
|
||||
c.set("accountPassword", password);
|
||||
const testInvalidPassword = (password, expectedReason) => {
|
||||
controller.set("accountPassword", password);
|
||||
|
||||
assert.equal(
|
||||
c.get("passwordValidation.failed"),
|
||||
controller.get("passwordValidation.failed"),
|
||||
true,
|
||||
"password should be invalid: " + password
|
||||
);
|
||||
assert.equal(
|
||||
c.get("passwordValidation.reason"),
|
||||
controller.get("passwordValidation.reason"),
|
||||
expectedReason,
|
||||
"password validation reason: " + password + ", " + expectedReason
|
||||
);
|
||||
@@ -85,7 +90,7 @@ QUnit.test("passwordValidation", function(assert) {
|
||||
testInvalidPassword("pork@chops.com", I18n.t("user.password.same_as_email"));
|
||||
});
|
||||
|
||||
QUnit.test("authProviderDisplayName", function(assert) {
|
||||
test("authProviderDisplayName", async function(assert) {
|
||||
const controller = this.subject({ siteSettings: Discourse.SiteSettings });
|
||||
|
||||
assert.equal(
|
||||
@@ -93,6 +98,7 @@ QUnit.test("authProviderDisplayName", function(assert) {
|
||||
I18n.t("login.facebook.name"),
|
||||
"provider name is translated correctly"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
controller.authProviderDisplayName("idontexist"),
|
||||
"idontexist",
|
||||
|
||||
@@ -2106,7 +2106,7 @@ export default {
|
||||
4009,
|
||||
4012
|
||||
],
|
||||
gaps: { before: { "20706": [20125] }, after: {} }
|
||||
gaps: { before: {}, after: { 398: [4012] } }
|
||||
},
|
||||
id: 280,
|
||||
title: "Internationalization / localization",
|
||||
|
||||
@@ -505,6 +505,10 @@ export default function() {
|
||||
this.post("/admin/badges", success);
|
||||
this.delete("/admin/badges/:id", success);
|
||||
|
||||
this.get("/admin/logs/staff_action_logs.json", () => {
|
||||
return response(200, { staff_action_logs: [], user_history_actions: [] });
|
||||
});
|
||||
|
||||
this.get("/admin/logs/watched_words", () => {
|
||||
return response(200, fixturesByUrl["/admin/logs/watched_words.json"]);
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ widgetTest("undo", {
|
||||
|
||||
widgetTest("deferFlags", {
|
||||
template:
|
||||
'{{mount-widget widget="actions-summary" args=args deferPostActionFlags="deferPostActionFlags"}}',
|
||||
'{{mount-widget widget="actions-summary" args=args deferPostActionFlags=(action "deferPostActionFlags")}}',
|
||||
beforeEach() {
|
||||
this.set("args", {
|
||||
actionsSummary: [
|
||||
|
||||
@@ -12,7 +12,7 @@ widgetTest("rendering basics", {
|
||||
|
||||
widgetTest("sign up / login buttons", {
|
||||
template:
|
||||
'{{mount-widget widget="header" showCreateAccount="showCreateAccount" showLogin="showLogin" args=args}}',
|
||||
'{{mount-widget widget="header" showCreateAccount=(action "showCreateAccount") showLogin=(action "showLogin") args=args}}',
|
||||
anonymous: true,
|
||||
|
||||
beforeEach() {
|
||||
@@ -35,7 +35,7 @@ widgetTest("sign up / login buttons", {
|
||||
|
||||
widgetTest("anon when login required", {
|
||||
template:
|
||||
'{{mount-widget widget="header" showCreateAccount="showCreateAccount" showLogin="showLogin" args=args}}',
|
||||
'{{mount-widget widget="header" showCreateAccount=(action "showCreateAccount") showLogin=(action "showLogin") args=args}}',
|
||||
anonymous: true,
|
||||
|
||||
beforeEach() {
|
||||
@@ -55,7 +55,7 @@ widgetTest("anon when login required", {
|
||||
|
||||
widgetTest("logged in when login required", {
|
||||
template:
|
||||
'{{mount-widget widget="header" showCreateAccount="showCreateAccount" showLogin="showLogin" args=args}}',
|
||||
'{{mount-widget widget="header" showCreateAccount=(action "showCreateAccount") showLogin=(action "showLogin") args=args}}',
|
||||
|
||||
beforeEach() {
|
||||
this.set("args", { canSignUp: true });
|
||||
|
||||
@@ -18,7 +18,7 @@ widgetTest("basic elements", {
|
||||
|
||||
widgetTest("wiki", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args showHistory="showHistory"}}',
|
||||
'{{mount-widget widget="post" args=args showHistory=(action "showHistory")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { wiki: true, version: 2, canViewEditHistory: true });
|
||||
this.on("showHistory", () => (this.historyShown = true));
|
||||
@@ -33,7 +33,8 @@ widgetTest("wiki", {
|
||||
});
|
||||
|
||||
widgetTest("wiki without revision", {
|
||||
template: '{{mount-widget widget="post" args=args editPost="editPost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args editPost=(action "editPost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { wiki: true, version: 1, canViewEditHistory: true });
|
||||
this.on("editPost", () => (this.editPostCalled = true));
|
||||
@@ -46,7 +47,7 @@ widgetTest("wiki without revision", {
|
||||
|
||||
widgetTest("via-email", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args showRawEmail="showRawEmail"}}',
|
||||
'{{mount-widget widget="post" args=args showRawEmail=(action "showRawEmail")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { via_email: true, canViewRawEmail: true });
|
||||
this.on("showRawEmail", () => (this.rawEmailShown = true));
|
||||
@@ -59,7 +60,7 @@ widgetTest("via-email", {
|
||||
|
||||
widgetTest("via-email without permission", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args showRawEmail="showRawEmail"}}',
|
||||
'{{mount-widget widget="post" args=args showRawEmail=(action "showRawEmail")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { via_email: true, canViewRawEmail: false });
|
||||
this.on("showRawEmail", () => (this.rawEmailShown = true));
|
||||
@@ -75,7 +76,7 @@ widgetTest("via-email without permission", {
|
||||
|
||||
widgetTest("history", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args showHistory="showHistory"}}',
|
||||
'{{mount-widget widget="post" args=args showHistory=(action "showHistory")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { version: 3, canViewEditHistory: true });
|
||||
this.on("showHistory", () => (this.historyShown = true));
|
||||
@@ -88,7 +89,7 @@ widgetTest("history", {
|
||||
|
||||
widgetTest("history without view permission", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args showHistory="showHistory"}}',
|
||||
'{{mount-widget widget="post" args=args showHistory=(action "showHistory")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { version: 3, canViewEditHistory: false });
|
||||
this.on("showHistory", () => (this.historyShown = true));
|
||||
@@ -168,7 +169,7 @@ widgetTest("share button", {
|
||||
|
||||
widgetTest("liking", {
|
||||
template:
|
||||
'{{mount-widget widget="post-menu" args=args toggleLike="toggleLike"}}',
|
||||
'{{mount-widget widget="post-menu" args=args toggleLike=(action "toggleLike")}}',
|
||||
beforeEach() {
|
||||
const args = { showLike: true, canToggleLike: true };
|
||||
this.set("args", args);
|
||||
@@ -195,7 +196,7 @@ widgetTest("liking", {
|
||||
|
||||
widgetTest("anon liking", {
|
||||
template:
|
||||
'{{mount-widget widget="post-menu" args=args showLogin="showLogin"}}',
|
||||
'{{mount-widget widget="post-menu" args=args showLogin=(action "showLogin")}}',
|
||||
anonymous: true,
|
||||
beforeEach() {
|
||||
const args = { showLike: true };
|
||||
@@ -218,7 +219,8 @@ widgetTest("anon liking", {
|
||||
});
|
||||
|
||||
widgetTest("edit button", {
|
||||
template: '{{mount-widget widget="post" args=args editPost="editPost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args editPost=(action "editPost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canEdit: true });
|
||||
this.on("editPost", () => (this.editPostCalled = true));
|
||||
@@ -230,7 +232,7 @@ widgetTest("edit button", {
|
||||
});
|
||||
|
||||
widgetTest(`edit button - can't edit`, {
|
||||
template: '{{mount-widget widget="post" args=args editPost="editPost"}}',
|
||||
template: '{{mount-widget widget="post" args=args}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canEdit: false });
|
||||
},
|
||||
@@ -240,7 +242,8 @@ widgetTest(`edit button - can't edit`, {
|
||||
});
|
||||
|
||||
widgetTest("recover button", {
|
||||
template: '{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args deletePost=(action "deletePost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canDelete: true });
|
||||
this.on("deletePost", () => (this.deletePostCalled = true));
|
||||
@@ -252,7 +255,8 @@ widgetTest("recover button", {
|
||||
});
|
||||
|
||||
widgetTest("delete topic button", {
|
||||
template: '{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args deletePost=(action "deletePost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canDeleteTopic: true });
|
||||
this.on("deletePost", () => (this.deletePostCalled = true));
|
||||
@@ -264,7 +268,7 @@ widgetTest("delete topic button", {
|
||||
});
|
||||
|
||||
widgetTest(`delete topic button - can't delete`, {
|
||||
template: '{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template: '{{mount-widget widget="post" args=args}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canDeleteTopic: false });
|
||||
},
|
||||
@@ -276,8 +280,7 @@ widgetTest(`delete topic button - can't delete`, {
|
||||
widgetTest(
|
||||
`delete topic button - can't delete when topic author without permission`,
|
||||
{
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template: '{{mount-widget widget="post" args=args}}',
|
||||
beforeEach() {
|
||||
this.set("args", {
|
||||
canDeleteTopic: false,
|
||||
@@ -299,7 +302,7 @@ widgetTest(
|
||||
|
||||
widgetTest("recover topic button", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args recoverPost="recoverPost"}}',
|
||||
'{{mount-widget widget="post" args=args recoverPost=(action "recoverPost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canRecoverTopic: true });
|
||||
this.on("recoverPost", () => (this.recovered = true));
|
||||
@@ -311,7 +314,7 @@ widgetTest("recover topic button", {
|
||||
});
|
||||
|
||||
widgetTest(`recover topic button - can't recover`, {
|
||||
template: '{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template: '{{mount-widget widget="post" args=args}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canRecoverTopic: false });
|
||||
},
|
||||
@@ -321,7 +324,8 @@ widgetTest(`recover topic button - can't recover`, {
|
||||
});
|
||||
|
||||
widgetTest("delete post button", {
|
||||
template: '{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args deletePost=(action "deletePost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canDelete: true });
|
||||
this.on("deletePost", () => (this.deletePostCalled = true));
|
||||
@@ -344,7 +348,7 @@ widgetTest(`delete post button - can't delete`, {
|
||||
|
||||
widgetTest("recover post button", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args recoverPost="recoverPost"}}',
|
||||
'{{mount-widget widget="post" args=args recoverPost=(action "recoverPost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canRecover: true });
|
||||
this.on("recoverPost", () => (this.recovered = true));
|
||||
@@ -356,7 +360,7 @@ widgetTest("recover post button", {
|
||||
});
|
||||
|
||||
widgetTest(`recover post button - can't recover`, {
|
||||
template: '{{mount-widget widget="post" args=args deletePost="deletePost"}}',
|
||||
template: '{{mount-widget widget="post" args=args}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canRecover: false });
|
||||
},
|
||||
@@ -366,7 +370,8 @@ widgetTest(`recover post button - can't recover`, {
|
||||
});
|
||||
|
||||
widgetTest(`flagging`, {
|
||||
template: '{{mount-widget widget="post" args=args showFlags="showFlags"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args showFlags=(action "showFlags")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canFlag: true });
|
||||
this.on("showFlags", () => (this.flagsShown = true));
|
||||
@@ -473,7 +478,7 @@ widgetTest("reply directly above", {
|
||||
|
||||
widgetTest("cooked content hidden", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args expandHidden="expandHidden"}}',
|
||||
'{{mount-widget widget="post" args=args expandHidden=(action "expandHidden")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { cooked_hidden: true });
|
||||
this.on("expandHidden", () => (this.unhidden = true));
|
||||
@@ -509,7 +514,7 @@ widgetTest("can't bookmark", {
|
||||
|
||||
widgetTest("bookmark", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args toggleBookmark="toggleBookmark"}}',
|
||||
'{{mount-widget widget="post" args=args toggleBookmark=(action "toggleBookmark")}}',
|
||||
beforeEach() {
|
||||
const args = { canBookmark: true };
|
||||
|
||||
@@ -555,35 +560,40 @@ widgetTest("show admin menu", {
|
||||
|
||||
widgetTest("toggle moderator post", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args togglePostType="togglePostType"}}',
|
||||
'{{mount-widget widget="post" args=args togglePostType=(action "togglePostType")}}',
|
||||
beforeEach() {
|
||||
this.currentUser.set("staff", true);
|
||||
this.set("args", { canManage: true });
|
||||
this.on("togglePostType", () => (this.toggled = true));
|
||||
},
|
||||
async test(assert) {
|
||||
await click(".post-menu-area .show-post-admin-menu");
|
||||
await click(".post-admin-menu .toggle-post-type");
|
||||
|
||||
assert.ok(this.toggled);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
widgetTest("toggle moderator post", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args togglePostType="togglePostType"}}',
|
||||
'{{mount-widget widget="post" args=args togglePostType=(action "togglePostType")}}',
|
||||
beforeEach() {
|
||||
this.currentUser.set("staff", true);
|
||||
this.set("args", { canManage: true });
|
||||
this.on("togglePostType", () => (this.toggled = true));
|
||||
},
|
||||
async test(assert) {
|
||||
await click(".post-menu-area .show-post-admin-menu");
|
||||
await click(".post-admin-menu .toggle-post-type");
|
||||
|
||||
assert.ok(this.toggled);
|
||||
assert.equal(this.$(".post-admin-menu").length, 0, "also hides the menu");
|
||||
}
|
||||
});
|
||||
|
||||
widgetTest("rebake post", {
|
||||
template: '{{mount-widget widget="post" args=args rebakePost="rebakePost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args rebakePost=(action "rebakePost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canManage: true });
|
||||
this.on("rebakePost", () => (this.baked = true));
|
||||
@@ -597,7 +607,8 @@ widgetTest("rebake post", {
|
||||
});
|
||||
|
||||
widgetTest("unhide post", {
|
||||
template: '{{mount-widget widget="post" args=args unhidePost="unhidePost"}}',
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args unhidePost=(action "unhidePost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canManage: true, hidden: true });
|
||||
this.on("unhidePost", () => (this.unhidden = true));
|
||||
@@ -612,7 +623,7 @@ widgetTest("unhide post", {
|
||||
|
||||
widgetTest("change owner", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args changePostOwner="changePostOwner"}}',
|
||||
'{{mount-widget widget="post" args=args changePostOwner=(action "changePostOwner")}}',
|
||||
beforeEach() {
|
||||
this.currentUser.admin = true;
|
||||
this.set("args", { canManage: true });
|
||||
@@ -628,7 +639,7 @@ widgetTest("change owner", {
|
||||
|
||||
widgetTest("reply", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args replyToPost="replyToPost"}}',
|
||||
'{{mount-widget widget="post" args=args replyToPost=(action "replyToPost")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { canCreatePost: true });
|
||||
this.on("replyToPost", () => (this.replied = true));
|
||||
@@ -813,7 +824,7 @@ widgetTest("topic map - no summary", {
|
||||
|
||||
widgetTest("topic map - has summary", {
|
||||
template:
|
||||
'{{mount-widget widget="post" args=args toggleSummary="toggleSummary"}}',
|
||||
'{{mount-widget widget="post" args=args toggleSummary=(action "toggleSummary")}}',
|
||||
beforeEach() {
|
||||
this.set("args", { showTopicMap: true, hasTopicSummary: true });
|
||||
this.on("toggleSummary", () => (this.summaryToggled = true));
|
||||
|
||||
@@ -16,7 +16,7 @@ widgetTest("basics", {
|
||||
});
|
||||
|
||||
widgetTest("log out", {
|
||||
template: '{{mount-widget widget="user-menu" logout="logout"}}',
|
||||
template: '{{mount-widget widget="user-menu" logout=(action "logout")}}',
|
||||
|
||||
beforeEach() {
|
||||
this.on("logout", () => (this.loggedOut = true));
|
||||
@@ -54,7 +54,7 @@ widgetTest("private messages - enabled", {
|
||||
|
||||
widgetTest("anonymous", {
|
||||
template:
|
||||
'{{mount-widget widget="user-menu" toggleAnonymous="toggleAnonymous"}}',
|
||||
'{{mount-widget widget="user-menu" toggleAnonymous=(action "toggleAnonymous")}}',
|
||||
|
||||
beforeEach() {
|
||||
this.currentUser.setProperties({ is_anonymous: false, trust_level: 3 });
|
||||
@@ -85,7 +85,7 @@ widgetTest("anonymous - disabled", {
|
||||
|
||||
widgetTest("anonymous - switch back", {
|
||||
template:
|
||||
'{{mount-widget widget="user-menu" toggleAnonymous="toggleAnonymous"}}',
|
||||
'{{mount-widget widget="user-menu" toggleAnonymous=(action "toggleAnonymous")}}',
|
||||
|
||||
beforeEach() {
|
||||
this.currentUser.setProperties({ is_anonymous: true });
|
||||
|
||||
Reference in New Issue
Block a user