tests
This commit is contained in:
parent
995f8b7130
commit
6d3e7c11ed
|
|
@ -14,6 +14,6 @@ acceptance("Discourse Assign | Assign disabled mobile", function (needs) {
|
||||||
const menu = selectKit(".topic-footer-mobile-dropdown");
|
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||||
await menu.expand();
|
await menu.expand();
|
||||||
|
|
||||||
assert.notOk(menu.rowByValue("assign").exists());
|
assert.false(menu.rowByValue("assign").exists());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { cloneJSON } from "discourse-common/lib/object";
|
||||||
import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, visit } from "@ember/test-helpers";
|
import { click, visit } from "@ember/test-helpers";
|
||||||
|
|
@ -43,9 +42,9 @@ acceptance("Discourse Assign | Assign mobile", function (needs) {
|
||||||
const menu = selectKit(".topic-footer-mobile-dropdown");
|
const menu = selectKit(".topic-footer-mobile-dropdown");
|
||||||
await menu.expand();
|
await menu.expand();
|
||||||
|
|
||||||
assert.ok(menu.rowByValue("assign").exists());
|
assert.true(menu.rowByValue("assign").exists());
|
||||||
await menu.selectRowByValue("assign");
|
await menu.selectRowByValue("assign");
|
||||||
assert.ok(exists(".assign.modal-body"), "assign modal opens");
|
assert.dom(".assign.modal-body").exists("assign modal opens");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -81,25 +80,23 @@ acceptance("Discourse Assign | Assign desktop", function (needs) {
|
||||||
test("Post contains hidden assign button", async function (assert) {
|
test("Post contains hidden assign button", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
assert.ok(
|
assert
|
||||||
!exists("#post_2 .extra-buttons .d-icon-user-plus"),
|
.dom("#post_2 .extra-buttons .d-icon-user-plus")
|
||||||
"assign to post button is hidden"
|
.doesNotExist("assign to post button is hidden");
|
||||||
);
|
|
||||||
await click("#post_2 button.show-more-actions");
|
await click("#post_2 button.show-more-actions");
|
||||||
|
|
||||||
assert.ok(
|
assert
|
||||||
exists("#post_2 .extra-buttons .d-icon-user-plus"),
|
.dom("#post_2 .extra-buttons .d-icon-user-plus")
|
||||||
"assign to post button exists"
|
.exists("assign to post button exists");
|
||||||
);
|
|
||||||
await click("#post_2 .extra-buttons .d-icon-user-plus");
|
await click("#post_2 .extra-buttons .d-icon-user-plus");
|
||||||
assert.ok(exists(".assign.modal-body"), "assign modal opens");
|
assert.dom(".assign.modal-body").exists("assign modal opens");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Footer dropdown contains button", async function (assert) {
|
test("Footer dropdown contains button", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#topic-footer-button-assign");
|
await click("#topic-footer-button-assign");
|
||||||
|
|
||||||
assert.ok(exists(".assign.modal-body"), "assign modal opens");
|
assert.dom(".assign.modal-body").exists("assign modal opens");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -140,10 +137,9 @@ acceptance("Discourse Assign | Assign Status enabled", function (needs) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#topic-footer-button-assign");
|
await click("#topic-footer-button-assign");
|
||||||
|
|
||||||
assert.ok(
|
assert
|
||||||
exists(".assign.modal-body #assign-status"),
|
.dom(".assign.modal-body #assign-status")
|
||||||
"assign status dropdown exists"
|
.exists("assign status dropdown exists");
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -180,10 +176,9 @@ acceptance("Discourse Assign | Assign Status disabled", function (needs) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#topic-footer-button-assign");
|
await click("#topic-footer-button-assign");
|
||||||
|
|
||||||
assert.notOk(
|
assert
|
||||||
exists(".assign.modal-body #assign-status"),
|
.dom(".assign.modal-body #assign-status")
|
||||||
"assign status dropdown doesn't exists"
|
.doesNotExist("assign status dropdown doesn't exists");
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
|
||||||
query,
|
query,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
|
@ -99,60 +98,57 @@ acceptance("Discourse Assign | Assigned topic", function (needs) {
|
||||||
updateCurrentUser({ can_assign: true });
|
updateCurrentUser({ can_assign: true });
|
||||||
await visit("/t/assignment-topic/44");
|
await visit("/t/assignment-topic/44");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert
|
||||||
query("#topic-title .assigned-to").innerText.trim(),
|
.dom("#topic-title .assigned-to")
|
||||||
"eviltrout",
|
.hasText("eviltrout", "shows assignment in the header");
|
||||||
"shows assignment in the header"
|
assert
|
||||||
);
|
.dom("#post_1 .assigned-to")
|
||||||
assert.strictEqual(
|
.hasText(
|
||||||
query("#post_1 .assigned-to").innerText,
|
|
||||||
"Assigned topic to eviltrout#2 to Developers",
|
"Assigned topic to eviltrout#2 to Developers",
|
||||||
"shows assignment and indirect assignments in the first post"
|
"shows assignment and indirect assignments in the first post"
|
||||||
);
|
);
|
||||||
assert.ok(exists("#post_1 .assigned-to svg.d-icon-user-plus"));
|
assert.dom("#post_1 .assigned-to svg.d-icon-user-plus").exists();
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".discourse-tags .assigned-to[href='/t/28830'] span").title,
|
.dom(".discourse-tags .assigned-to[href='/t/28830'] span")
|
||||||
"Shark Doododooo",
|
.hasAttribute("title", "Shark Doododooo", "shows topic assign notes");
|
||||||
"shows topic assign notes"
|
assert
|
||||||
);
|
.dom(".discourse-tags .assigned-to[href='/p/2'] span")
|
||||||
assert.strictEqual(
|
.hasAttribute(
|
||||||
query(".discourse-tags .assigned-to[href='/p/2'] span").title,
|
"title",
|
||||||
'<script>alert("xss")</script>',
|
'<script>alert("xss")</script>',
|
||||||
"shows indirect assign notes"
|
"shows indirect assign notes"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert
|
||||||
exists("#topic-footer-dropdown-reassign"),
|
.dom("#topic-footer-dropdown-reassign")
|
||||||
"shows reassign dropdown at the bottom of the topic"
|
.exists("shows reassign dropdown at the bottom of the topic");
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Shows group assignment info", async function (assert) {
|
test("Shows group assignment info", async function (assert) {
|
||||||
updateCurrentUser({ can_assign: true });
|
updateCurrentUser({ can_assign: true });
|
||||||
await visit("/t/assignment-topic/45");
|
await visit("/t/assignment-topic/45");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert
|
||||||
query("#topic-title .assigned-to").innerText.trim(),
|
.dom("#topic-title .assigned-to")
|
||||||
"Developers",
|
.hasText("Developers", "shows assignment in the header");
|
||||||
"shows assignment in the header"
|
assert
|
||||||
);
|
.dom("#post_1 .assigned-to--group")
|
||||||
assert.strictEqual(
|
.hasText(
|
||||||
query("#post_1 .assigned-to--group").innerText.trim(),
|
|
||||||
"Assigned topic to Developers",
|
"Assigned topic to Developers",
|
||||||
"shows assignment in the first post"
|
"shows assignment in the first post"
|
||||||
);
|
);
|
||||||
assert.ok(exists("#post_1 .assigned-to svg.d-icon-group-plus"));
|
assert.dom("#post_1 .assigned-to svg.d-icon-group-plus").exists();
|
||||||
assert.ok(
|
assert
|
||||||
exists("#topic-footer-dropdown-reassign"),
|
.dom("#topic-footer-dropdown-reassign")
|
||||||
"shows reassign dropdown at the bottom of the topic"
|
.exists("shows reassign dropdown at the bottom of the topic");
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("User without assign ability cannot see footer button", async function (assert) {
|
test("User without assign ability cannot see footer button", async function (assert) {
|
||||||
updateCurrentUser({ can_assign: false, admin: false, moderator: false });
|
updateCurrentUser({ can_assign: false, admin: false, moderator: false });
|
||||||
await visit("/t/assignment-topic/45");
|
await visit("/t/assignment-topic/45");
|
||||||
|
|
||||||
assert.notOk(
|
assert
|
||||||
exists("#topic-footer-dropdown-reassign"),
|
.dom("#topic-footer-dropdown-reassign")
|
||||||
|
.doesNotExist(
|
||||||
"does not show reassign dropdown at the bottom of the topic"
|
"does not show reassign dropdown at the bottom of the topic"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -166,7 +162,7 @@ acceptance("Discourse Assign | Assigned topic", function (needs) {
|
||||||
"section.user-content ul.notifications li.item.notification"
|
"section.user-content ul.notifications li.item.notification"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.true(
|
||||||
notification.children[0].classList.contains("assigned"),
|
notification.children[0].classList.contains("assigned"),
|
||||||
"with correct assigned class"
|
"with correct assigned class"
|
||||||
);
|
);
|
||||||
|
|
@ -201,9 +197,9 @@ acceptance("Discourse Assign | Reassign topic", function (needs) {
|
||||||
await visit("/t/assignment-topic/44");
|
await visit("/t/assignment-topic/44");
|
||||||
await menu.expand();
|
await menu.expand();
|
||||||
|
|
||||||
assert.ok(menu.rowByValue("unassign").exists());
|
assert.true(menu.rowByValue("unassign").exists());
|
||||||
assert.ok(menu.rowByValue("reassign").exists());
|
assert.true(menu.rowByValue("reassign").exists());
|
||||||
assert.ok(menu.rowByValue("reassign-self").exists());
|
assert.true(menu.rowByValue("reassign-self").exists());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -225,9 +221,9 @@ acceptance("Discourse Assign | Reassign topic | mobile", function (needs) {
|
||||||
await visit("/t/assignment-topic/44");
|
await visit("/t/assignment-topic/44");
|
||||||
await menu.expand();
|
await menu.expand();
|
||||||
|
|
||||||
assert.ok(menu.rowByValue("unassign-mobile").exists());
|
assert.true(menu.rowByValue("unassign-mobile").exists());
|
||||||
assert.ok(menu.rowByValue("reassign-mobile").exists());
|
assert.true(menu.rowByValue("reassign-mobile").exists());
|
||||||
assert.ok(menu.rowByValue("reassign-self-mobile").exists());
|
assert.true(menu.rowByValue("reassign-self-mobile").exists());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -248,6 +244,6 @@ acceptance("Discourse Assign | Reassign topic conditionals", function (needs) {
|
||||||
await visit("/t/assignment-topic/44");
|
await visit("/t/assignment-topic/44");
|
||||||
await menu.expand();
|
await menu.expand();
|
||||||
|
|
||||||
assert.notOk(menu.rowByValue("reassign-self").exists());
|
assert.false(menu.rowByValue("reassign-self").exists());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
|
||||||
query,
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
|
|
@ -211,7 +210,7 @@ acceptance(
|
||||||
test("the assigns tab is not shown", async function (assert) {
|
test("the assigns tab is not shown", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click(".d-header-icons .current-user");
|
await click(".d-header-icons .current-user");
|
||||||
assert.notOk(exists("#user-menu-button-assign-list"));
|
assert.dom("#user-menu-button-assign-list").doesNotExist();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -229,7 +228,7 @@ acceptance(
|
||||||
test("the assigns tab is not shown", async function (assert) {
|
test("the assigns tab is not shown", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click(".d-header-icons .current-user");
|
await click(".d-header-icons .current-user");
|
||||||
assert.notOk(exists("#user-menu-button-assign-list"));
|
assert.dom("#user-menu-button-assign-list").doesNotExist();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -284,31 +283,24 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
test("assigns tab", async function (assert) {
|
test("assigns tab", async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click(".d-header-icons .current-user");
|
await click(".d-header-icons .current-user");
|
||||||
assert.ok(exists("#user-menu-button-assign-list"), "assigns tab exists");
|
assert.dom("#user-menu-button-assign-list").exists("assigns tab exists");
|
||||||
assert.ok(
|
assert
|
||||||
exists("#user-menu-button-assign-list .d-icon-user-plus"),
|
.dom("#user-menu-button-assign-list .d-icon-user-plus")
|
||||||
"assigns tab has the user-plus icon"
|
.exists("assigns tab has the user-plus icon");
|
||||||
);
|
assert
|
||||||
assert.strictEqual(
|
.dom("#user-menu-button-assign-list .badge-notification")
|
||||||
query(
|
.hasText("173", "assigns tab has a count badge");
|
||||||
"#user-menu-button-assign-list .badge-notification"
|
|
||||||
).textContent.trim(),
|
|
||||||
"173",
|
|
||||||
"assigns tab has a count badge"
|
|
||||||
);
|
|
||||||
|
|
||||||
updateCurrentUser({
|
updateCurrentUser({
|
||||||
grouped_unread_notifications: {},
|
grouped_unread_notifications: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.notOk(
|
assert
|
||||||
exists("#user-menu-button-assign-list .badge-notification"),
|
.dom("#user-menu-button-assign-list .badge-notification")
|
||||||
"badge count disappears when it goes to zero"
|
.doesNotExist("badge count disappears when it goes to zero");
|
||||||
);
|
assert
|
||||||
assert.ok(
|
.dom("#user-menu-button-assign-list")
|
||||||
exists("#user-menu-button-assign-list"),
|
.exists("assigns tab still exists");
|
||||||
"assigns tab still exists"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("clicking on the assign tab when it's already selected navigates to the user's assignments page", async function (assert) {
|
test("clicking on the assign tab when it's already selected navigates to the user's assignments page", async function (assert) {
|
||||||
|
|
@ -335,11 +327,11 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
1,
|
1,
|
||||||
"there is one unread notification"
|
"there is one unread notification"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.true(
|
||||||
notifications[0].classList.contains("unread"),
|
notifications[0].classList.contains("unread"),
|
||||||
"the notification is unread"
|
"the notification is unread"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.true(
|
||||||
notifications[0].classList.contains("assigned"),
|
notifications[0].classList.contains("assigned"),
|
||||||
"the notification is of type assigned"
|
"the notification is of type assigned"
|
||||||
);
|
);
|
||||||
|
|
@ -358,13 +350,13 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
"group assign has the right icon"
|
"group assign has the right icon"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.ok(
|
assert.true(
|
||||||
userAssign
|
userAssign
|
||||||
.querySelector("a")
|
.querySelector("a")
|
||||||
.href.endsWith("/t/howdy-this-a-test-topic/209/3"),
|
.href.endsWith("/t/howdy-this-a-test-topic/209/3"),
|
||||||
"user assign links to the first unread post (last read post + 1)"
|
"user assign links to the first unread post (last read post + 1)"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.true(
|
||||||
groupAssign
|
groupAssign
|
||||||
.querySelector("a")
|
.querySelector("a")
|
||||||
.href.endsWith(
|
.href.endsWith(
|
||||||
|
|
@ -382,7 +374,7 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
userAssign.querySelector(".item-description img.emoji"),
|
userAssign.querySelector(".item-description img.emoji"),
|
||||||
"emojis are rendered in user assign"
|
"emojis are rendered in user assign"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.strictEqual(
|
||||||
userAssign.querySelector(".item-description b").textContent.trim(),
|
userAssign.querySelector(".item-description b").textContent.trim(),
|
||||||
"my test topic",
|
"my test topic",
|
||||||
"user assign topic title is trusted"
|
"user assign topic title is trusted"
|
||||||
|
|
@ -423,13 +415,12 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
await click(".d-header-icons .current-user");
|
await click(".d-header-icons .current-user");
|
||||||
await click("#user-menu-button-assign-list");
|
await click("#user-menu-button-assign-list");
|
||||||
|
|
||||||
assert.ok(
|
assert
|
||||||
exists("#user-menu-button-assign-list .badge-notification"),
|
.dom("#user-menu-button-assign-list .badge-notification")
|
||||||
"badge count is visible before dismissing"
|
.exists("badge count is visible before dismissing");
|
||||||
);
|
|
||||||
|
|
||||||
await click(".notifications-dismiss");
|
await click(".notifications-dismiss");
|
||||||
assert.notOk(markRead, "mark-read request isn't sent");
|
assert.false(markRead, "mark-read request isn't sent");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".dismiss-notification-confirmation.modal-body").textContent.trim(),
|
query(".dismiss-notification-confirmation.modal-body").textContent.trim(),
|
||||||
I18n.t("notifications.dismiss_confirmation.body.assigns", { count: 173 }),
|
I18n.t("notifications.dismiss_confirmation.body.assigns", { count: 173 }),
|
||||||
|
|
@ -437,12 +428,11 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(".modal-footer .btn-primary");
|
await click(".modal-footer .btn-primary");
|
||||||
assert.ok(markRead, "mark-read request is sent");
|
assert.true(markRead, "mark-read request is sent");
|
||||||
assert.notOk(exists(".notifications-dismiss"), "dismiss button is gone");
|
assert.dom(".notifications-dismiss").doesNotExist("dismiss button is gone");
|
||||||
assert.notOk(
|
assert
|
||||||
exists("#user-menu-button-assign-list .badge-notification"),
|
.dom("#user-menu-button-assign-list .badge-notification")
|
||||||
"badge count is gone after dismissing"
|
.doesNotExist("badge count is gone after dismissing");
|
||||||
);
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
requestBody,
|
requestBody,
|
||||||
"dismiss_types=assigned",
|
"dismiss_types=assigned",
|
||||||
|
|
@ -456,21 +446,20 @@ acceptance("Discourse Assign | user menu", function (needs) {
|
||||||
await click(".d-header-icons .current-user");
|
await click(".d-header-icons .current-user");
|
||||||
await click("#user-menu-button-assign-list");
|
await click("#user-menu-button-assign-list");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".empty-state-title").textContent.trim(),
|
.dom(".empty-state-title")
|
||||||
|
.hasText(
|
||||||
I18n.t("user.no_assignments_title"),
|
I18n.t("user.no_assignments_title"),
|
||||||
"empty state title is rendered"
|
"empty state title is rendered"
|
||||||
);
|
);
|
||||||
const emptyStateBody = query(".empty-state-body");
|
assert.dom(".empty-state-body").exists("empty state body exists");
|
||||||
assert.ok(emptyStateBody, "empty state body exists");
|
assert
|
||||||
assert.ok(
|
.dom(".empty-state-body .d-icon-user-plus")
|
||||||
emptyStateBody.querySelector(".d-icon-user-plus"),
|
.exists("empty state body has user-plus icon");
|
||||||
"empty state body has user-plus icon"
|
assert.true(
|
||||||
);
|
query(".empty-state-body a").href.endsWith(
|
||||||
assert.ok(
|
"/my/preferences/notifications"
|
||||||
emptyStateBody
|
),
|
||||||
.querySelector("a")
|
|
||||||
.href.endsWith("/my/preferences/notifications"),
|
|
||||||
"empty state body has user-plus icon"
|
"empty state body has user-plus icon"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
@ -40,7 +40,7 @@ acceptance(
|
||||||
await visit("/c/test");
|
await visit("/c/test");
|
||||||
|
|
||||||
const title = I18n.t("filters.unassigned.help");
|
const title = I18n.t("filters.unassigned.help");
|
||||||
assert.ok(exists(`#navigation-bar li[title='${title}']`));
|
assert.dom(`#navigation-bar li[title='${title}']`).exists();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -60,7 +60,7 @@ acceptance(
|
||||||
await visit("/c/test");
|
await visit("/c/test");
|
||||||
|
|
||||||
const title = I18n.t("filters.unassigned.help");
|
const title = I18n.t("filters.unassigned.help");
|
||||||
assert.ok(!exists(`#navigation-bar li[title='${title}']`));
|
assert.dom(`#navigation-bar li[title='${title}']`).doesNotExist();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -80,7 +80,7 @@ acceptance(
|
||||||
await visit("/c/test");
|
await visit("/c/test");
|
||||||
|
|
||||||
const title = I18n.t("filters.unassigned.help");
|
const title = I18n.t("filters.unassigned.help");
|
||||||
assert.ok(exists(`#navigation-bar li[title='${title}']`));
|
assert.dom(`#navigation-bar li[title='${title}']`).exists();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -100,7 +100,7 @@ acceptance(
|
||||||
await visit("/c/test");
|
await visit("/c/test");
|
||||||
|
|
||||||
const title = I18n.t("filters.unassigned.help");
|
const title = I18n.t("filters.unassigned.help");
|
||||||
assert.ok(!exists(`#navigation-bar li[title='${title}']`));
|
assert.dom(`#navigation-bar li[title='${title}']`).doesNotExist();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { acceptance, count } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
import AssignedTopics from "../fixtures/assigned-group-assignments-fixtures";
|
import AssignedTopics from "../fixtures/assigned-group-assignments-fixtures";
|
||||||
import GroupMembers from "../fixtures/group-members-fixtures";
|
import GroupMembers from "../fixtures/group-members-fixtures";
|
||||||
|
|
@ -21,11 +21,11 @@ acceptance("Discourse Assign | GroupAssignments", function (needs) {
|
||||||
|
|
||||||
test("Group Assignments Everyone", async function (assert) {
|
test("Group Assignments Everyone", async function (assert) {
|
||||||
await visit("/g/discourse/assigned");
|
await visit("/g/discourse/assigned");
|
||||||
assert.strictEqual(count(".topic-list-item"), 1);
|
assert.dom(".topic-list-item").exists({ count: 1 });
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Group Assignments Ahmedgagan", async function (assert) {
|
test("Group Assignments Ahmedgagan", async function (assert) {
|
||||||
await visit("/g/discourse/assigned/ahmedgagan6");
|
await visit("/g/discourse/assigned/ahmedgagan6");
|
||||||
assert.strictEqual(count(".topic-list-item"), 1);
|
assert.dom(".topic-list-item").exists({ count: 1 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
query,
|
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
|
@ -48,8 +47,9 @@ acceptance(
|
||||||
|
|
||||||
await visit("/t/assignment-topic/44");
|
await visit("/t/assignment-topic/44");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".topic-notifications-button .reason span.text").innerText,
|
.dom(".topic-notifications-button .reason span.text")
|
||||||
|
.hasText(
|
||||||
"You will receive notifications because you are watching this topic."
|
"You will receive notifications because you are watching this topic."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -61,8 +61,9 @@ acceptance(
|
||||||
|
|
||||||
await visit("/t/assignment-topic/45");
|
await visit("/t/assignment-topic/45");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".topic-notifications-button .reason span.text").innerText,
|
.dom(".topic-notifications-button .reason span.text")
|
||||||
|
.hasText(
|
||||||
"You will see a count of new replies because this topic was assigned to you."
|
"You will see a count of new replies because this topic was assigned to you."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { fillIn, visit } from "@ember/test-helpers";
|
import { fillIn, visit } from "@ember/test-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
|
|
||||||
|
|
@ -28,8 +28,9 @@ acceptance("Discourse Assign | Search - Full Page", function (needs) {
|
||||||
await fillIn(".search-query", "none");
|
await fillIn(".search-query", "none");
|
||||||
await inSelector.expand();
|
await inSelector.expand();
|
||||||
await inSelector.selectRowByValue("assigned");
|
await inSelector.selectRowByValue("assigned");
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".search-query").value,
|
.dom(".search-query")
|
||||||
|
.hasValue(
|
||||||
"none in:assigned",
|
"none in:assigned",
|
||||||
'has updated search term to "none in:assigned"'
|
'has updated search term to "none in:assigned"'
|
||||||
);
|
);
|
||||||
|
|
@ -43,8 +44,9 @@ acceptance("Discourse Assign | Search - Full Page", function (needs) {
|
||||||
await fillIn(".search-query", "none");
|
await fillIn(".search-query", "none");
|
||||||
await inSelector.expand();
|
await inSelector.expand();
|
||||||
await inSelector.selectRowByValue("unassigned");
|
await inSelector.selectRowByValue("unassigned");
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".search-query").value,
|
.dom(".search-query")
|
||||||
|
.hasValue(
|
||||||
"none in:unassigned",
|
"none in:unassigned",
|
||||||
'has updated search term to "none in:unassigned"'
|
'has updated search term to "none in:unassigned"'
|
||||||
);
|
);
|
||||||
|
|
@ -67,8 +69,9 @@ acceptance("Discourse Assign | Search - Full Page", function (needs) {
|
||||||
'has "admin" filled in'
|
'has "admin" filled in'
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert
|
||||||
query(".search-query").value,
|
.dom(".search-query")
|
||||||
|
.hasValue(
|
||||||
"none assigned:admin",
|
"none assigned:admin",
|
||||||
'has updated search term to "none assigned:admin"'
|
'has updated search term to "none assigned:admin"'
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import {
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||||
acceptance,
|
|
||||||
count,
|
|
||||||
exists,
|
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
import AssignedTopics from "../fixtures/assigned-topics-fixtures";
|
import AssignedTopics from "../fixtures/assigned-topics-fixtures";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
|
|
@ -26,8 +22,8 @@ acceptance(
|
||||||
await visit("/u/eviltrout/activity/assigned");
|
await visit("/u/eviltrout/activity/assigned");
|
||||||
await options.expand();
|
await options.expand();
|
||||||
|
|
||||||
assert.strictEqual(count("li[data-value='unassign']"), 1);
|
assert.dom("li[data-value='unassign']").exists({ count: 1 });
|
||||||
assert.strictEqual(count("li[data-value='reassign']"), 1);
|
assert.dom("li[data-value='reassign']").exists({ count: 1 });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -49,12 +45,12 @@ acceptance(
|
||||||
|
|
||||||
test("It renders the empty state panel", async function (assert) {
|
test("It renders the empty state panel", async function (assert) {
|
||||||
await visit("/u/eviltrout/activity/assigned");
|
await visit("/u/eviltrout/activity/assigned");
|
||||||
assert.ok(exists("div.empty-state"));
|
assert.dom("div.empty-state").exists();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("It does not render the search form", async function (assert) {
|
test("It does not render the search form", async function (assert) {
|
||||||
await visit("/u/eviltrout/activity/assigned");
|
await visit("/u/eviltrout/activity/assigned");
|
||||||
assert.notOk(exists("div.topic-search-div"));
|
assert.dom("div.topic-search-div").doesNotExist();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
|
import { module, test } from "qunit";
|
||||||
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||||
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
import { test } from "qunit";
|
|
||||||
|
module("Unit | Controller | assign-user", function (hooks) {
|
||||||
|
setupRenderingTest(hooks);
|
||||||
|
|
||||||
discourseModule("Unit | Controller | assign-user", function () {
|
|
||||||
test("assigning a user via suggestions makes API call and closes the modal", async function (assert) {
|
test("assigning a user via suggestions makes API call and closes the modal", async function (assert) {
|
||||||
pretender.get("/assign/suggestions", () =>
|
pretender.get("/assign/suggestions", () =>
|
||||||
response({
|
response({
|
||||||
|
|
@ -16,7 +19,8 @@ discourseModule("Unit | Controller | assign-user", function () {
|
||||||
pretender.put("/assign/assign", () => response({}));
|
pretender.put("/assign/assign", () => response({}));
|
||||||
|
|
||||||
let modalClosed = false;
|
let modalClosed = false;
|
||||||
const controller = this.getController("assign-user", {
|
const controller = getOwner(this).lookup("controller:assign-user");
|
||||||
|
controller.setProperties({
|
||||||
model: {
|
model: {
|
||||||
target: EmberObject.create({}),
|
target: EmberObject.create({}),
|
||||||
},
|
},
|
||||||
|
|
@ -29,7 +33,7 @@ discourseModule("Unit | Controller | assign-user", function () {
|
||||||
|
|
||||||
await controller.assignUser("nat");
|
await controller.assignUser("nat");
|
||||||
|
|
||||||
assert.strictEqual(modalClosed, true);
|
assert.true(modalClosed);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("assigning a user by selector does not close the modal", async function (assert) {
|
test("assigning a user by selector does not close the modal", async function (assert) {
|
||||||
|
|
@ -42,7 +46,8 @@ discourseModule("Unit | Controller | assign-user", function () {
|
||||||
);
|
);
|
||||||
|
|
||||||
let modalClosed = false;
|
let modalClosed = false;
|
||||||
const controller = this.getController("assign-user", {
|
const controller = getOwner(this).lookup("controller:assign-user");
|
||||||
|
controller.setProperties({
|
||||||
model: {
|
model: {
|
||||||
target: EmberObject.create({}),
|
target: EmberObject.create({}),
|
||||||
},
|
},
|
||||||
|
|
@ -55,6 +60,6 @@ discourseModule("Unit | Controller | assign-user", function () {
|
||||||
|
|
||||||
await controller.assignUsername("nat");
|
await controller.assignUsername("nat");
|
||||||
|
|
||||||
assert.strictEqual(modalClosed, false);
|
assert.false(modalClosed);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
import { module, test } from "qunit";
|
||||||
import { test } from "qunit";
|
import { setupTest } from "ember-qunit";
|
||||||
import sinon from "sinon";
|
import sinon from "sinon";
|
||||||
import * as showModal from "discourse/lib/show-modal";
|
import * as showModal from "discourse/lib/show-modal";
|
||||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||||
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
|
||||||
|
module("Unit | Service | task-actions", function (hooks) {
|
||||||
|
setupTest(hooks);
|
||||||
|
|
||||||
discourseModule("Unit | Service | task-actions", function () {
|
|
||||||
test("assign", function (assert) {
|
test("assign", function (assert) {
|
||||||
const stub = sinon.stub(showModal, "default").returns("the modal");
|
const stub = sinon.stub(showModal, "default").returns("the modal");
|
||||||
const service = this.container.lookup("service:task-actions");
|
const service = getOwner(this).lookup("service:task-actions");
|
||||||
const target = {
|
const target = {
|
||||||
assigned_to_user: { username: "tomtom" },
|
assigned_to_user: { username: "tomtom" },
|
||||||
assigned_to_group: { name: "cats" },
|
assigned_to_group: { name: "cats" },
|
||||||
|
|
@ -17,7 +20,7 @@ discourseModule("Unit | Service | task-actions", function () {
|
||||||
const modalCall = stub.getCall(0).args;
|
const modalCall = stub.getCall(0).args;
|
||||||
|
|
||||||
assert.strictEqual(modal, "the modal");
|
assert.strictEqual(modal, "the modal");
|
||||||
assert.deepEqual(modalCall[0], "assign-user");
|
assert.strictEqual(modalCall[0], "assign-user");
|
||||||
assert.deepEqual(modalCall[1], {
|
assert.deepEqual(modalCall[1], {
|
||||||
title: "discourse_assign.assign_modal.title",
|
title: "discourse_assign.assign_modal.title",
|
||||||
model: {
|
model: {
|
||||||
|
|
@ -32,7 +35,7 @@ discourseModule("Unit | Service | task-actions", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("reassignUserToTopic", async function (assert) {
|
test("reassignUserToTopic", async function (assert) {
|
||||||
const service = this.container.lookup("service:task-actions");
|
const service = getOwner(this).lookup("service:task-actions");
|
||||||
const target = { id: 1 };
|
const target = { id: 1 };
|
||||||
const user = { username: "tomtom" };
|
const user = { username: "tomtom" };
|
||||||
let assignRequest;
|
let assignRequest;
|
||||||
Loading…
Reference in New Issue