2022-08-18 08:51:28 -04:00
|
|
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
2022-08-18 09:49:26 -04:00
|
|
|
import { test } from "qunit";
|
2021-09-28 11:22:08 -04:00
|
|
|
import { visit } from "@ember/test-helpers";
|
2022-08-18 08:51:28 -04:00
|
|
|
import I18n from "I18n";
|
2021-09-28 11:22:08 -04:00
|
|
|
|
|
|
|
acceptance(
|
|
|
|
"Discourse Solved Plugin | activity/solved | empty state",
|
|
|
|
function (needs) {
|
2022-08-18 08:51:28 -04:00
|
|
|
const currentUser = "eviltrout";
|
|
|
|
const anotherUser = "charlie";
|
2021-09-28 11:22:08 -04:00
|
|
|
needs.user();
|
|
|
|
|
|
|
|
needs.pretender((server, helper) => {
|
|
|
|
const emptyResponse = { user_actions: [] };
|
|
|
|
|
|
|
|
server.get("/user_actions.json", () => {
|
|
|
|
return helper.response(emptyResponse);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-08-18 08:51:28 -04:00
|
|
|
test("When looking at own activity", async function (assert) {
|
|
|
|
await visit(`/u/${currentUser}/activity/solved`);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
query("div.empty-state span.empty-state-title").innerText,
|
|
|
|
I18n.t("solved.no_solved_topics_title")
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
query("div.empty-state div.empty-state-body").innerText,
|
|
|
|
I18n.t("solved.no_solved_topics_body")
|
|
|
|
);
|
2021-09-28 11:22:08 -04:00
|
|
|
});
|
|
|
|
|
2022-08-18 08:51:28 -04:00
|
|
|
test("When looking at another user's activity", async function (assert) {
|
|
|
|
await visit(`/u/${anotherUser}/activity/solved`);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
query("div.empty-state span.empty-state-title").innerText,
|
|
|
|
I18n.t("solved.no_solved_topics_title_others", {
|
|
|
|
username: anotherUser,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
assert.equal(query("div.empty-state div.empty-state-body").innerText, "");
|
2021-09-28 11:22:08 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|