2021-09-28 19:22:08 +04:00
|
|
|
import { visit } from "@ember/test-helpers";
|
2025-07-09 13:58:35 -04:00
|
|
|
import { test } from "qunit";
|
2024-12-02 23:13:34 +01:00
|
|
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
|
|
|
import { i18n } from "discourse-i18n";
|
2021-09-28 19:22:08 +04:00
|
|
|
|
|
|
|
acceptance(
|
|
|
|
"Discourse Solved Plugin | activity/solved | empty state",
|
|
|
|
function (needs) {
|
|
|
|
needs.user();
|
|
|
|
|
|
|
|
needs.pretender((server, helper) => {
|
2025-07-02 16:56:12 +08:00
|
|
|
server.get("/solution/by_user.json", () =>
|
|
|
|
helper.response({ user_solved_posts: [] })
|
2024-12-02 23:13:34 +01:00
|
|
|
);
|
2021-09-28 19:22:08 +04:00
|
|
|
});
|
|
|
|
|
2025-07-09 13:58:35 -04:00
|
|
|
test("When looking at own activity", async function (assert) {
|
2024-12-02 23:13:34 +01:00
|
|
|
await visit(`/u/eviltrout/activity/solved`);
|
2022-08-18 16:51:28 +04:00
|
|
|
|
2024-12-02 23:13:34 +01:00
|
|
|
assert
|
2025-07-09 13:58:35 -04:00
|
|
|
.dom(".empty-state .empty-state__title")
|
2024-12-02 23:13:34 +01:00
|
|
|
.hasText(i18n("solved.no_solved_topics_title"));
|
|
|
|
assert
|
2025-07-09 13:58:35 -04:00
|
|
|
.dom(".empty-state .empty-state__body")
|
2024-12-02 23:13:34 +01:00
|
|
|
.hasText(i18n("solved.no_solved_topics_body"));
|
2021-09-28 19:22:08 +04:00
|
|
|
});
|
|
|
|
|
2025-07-09 13:58:35 -04:00
|
|
|
test("When looking at another user's activity", async function (assert) {
|
2024-12-02 23:13:34 +01:00
|
|
|
await visit(`/u/charlie/activity/solved`);
|
2022-08-18 16:51:28 +04:00
|
|
|
|
2025-07-09 13:58:35 -04:00
|
|
|
assert.dom(".empty-state .empty-state__title").hasText(
|
2024-12-02 23:13:34 +01:00
|
|
|
i18n("solved.no_solved_topics_title_others", {
|
|
|
|
username: "charlie",
|
2022-08-18 16:51:28 +04:00
|
|
|
})
|
|
|
|
);
|
2025-07-09 13:58:35 -04:00
|
|
|
assert.dom(".empty-state .empty-state__body").doesNotExist();
|
2021-09-28 19:22:08 +04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|