This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/acceptance/pending-posts-test.js
Loïc Guitaut a5fbb90df4 FEATURE: Display pending posts on user’s page
Currently when a user creates posts that are moderated (for whatever
reason), a popup is displayed saying the post needs approval and the
total number of the user’s pending posts. But then this piece of
information is kind of lost and there is nowhere for the user to know
what are their pending posts or how many there are.

This patch solves this issue by adding a new “Pending” section to the
user’s activity page when there are some pending posts to display. When
there are none, then the “Pending” section isn’t displayed at all.
2021-11-29 10:26:33 +01:00

32 lines
984 B
JavaScript

import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { click, visit } from "@ember/test-helpers";
import { setupApplicationTest as EMBER_CLI_ENV } from "ember-qunit";
acceptance("Pending posts - no existing pending posts", function (needs) {
if (!EMBER_CLI_ENV) {
return; // dom helpers not available in legacy env
}
needs.user();
test("No link to pending posts", async function (assert) {
await visit("/u/eviltrout");
assert.dom(".action-list").doesNotIncludeText("Pending");
});
});
acceptance("Pending posts - existing pending posts", function (needs) {
if (!EMBER_CLI_ENV) {
return; // dom helpers not available in legacy env
}
needs.user({ pending_posts_count: 2 });
test("Navigate to pending posts", async function (assert) {
await visit("/u/eviltrout");
await click("[href='/u/eviltrout/activity/pending']");
assert.dom(".user-stream-item").exists({ count: 2 });
});
});