separate tests

This commit is contained in:
awesomerobot 2022-12-19 17:35:08 -05:00 committed by Alan Guo Xiang Tan
parent 00fdeb422c
commit 90ed1eb96c
No known key found for this signature in database
GPG Key ID: 3F656E28E3AADEF1
1 changed files with 19 additions and 1 deletions

View File

@ -10,7 +10,7 @@ discourseModule(
function (hooks) { function (hooks) {
setupRenderingTest(hooks); setupRenderingTest(hooks);
test("When assigns are not public add a private-assign class to the small post", async function (assert) { test("Adds private-assign class when assigns are not public", async function (assert) {
this.siteSettings.assigns_public = false; this.siteSettings.assigns_public = false;
this.set("args", { this.set("args", {
@ -34,9 +34,27 @@ discourseModule(
); );
assert.ok(exists(".small-action.private-assign")); assert.ok(exists(".small-action.private-assign"));
});
test("Does not add private-assign class when assigns are public", async function (assert) {
this.siteSettings.assigns_public = true; this.siteSettings.assigns_public = true;
this.set("args", {
id: 10,
actionCode: "assigned",
});
withPluginApi("1.6.0", (api) => {
api.addPostSmallActionClassesCallback((post) => {
if (
post.actionCode.includes("assigned") &&
!this.siteSettings.assigns_public
) {
return ["private-assign"];
}
});
});
await render( await render(
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />` hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
); );