fix test failure

This commit is contained in:
awesomerobot 2022-12-19 18:03:39 -05:00 committed by Alan Guo Xiang Tan
parent aaf05abf16
commit 4b755332b9
No known key found for this signature in database
GPG Key ID: 3F656E28E3AADEF1
1 changed files with 15 additions and 31 deletions

View File

@ -12,36 +12,6 @@ discourseModule(
setupRenderingTest(hooks);
test("Adds private-assign class when assigns are not public", async function (assert) {
try {
this.siteSettings.assigns_public = false;
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(
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
);
assert.ok(exists(".small-action.private-assign"));
} finally {
resetPostSmallActionClassesCallbacks();
}
});
test("Does not add private-assign class when assigns are public", async function (assert) {
try {
this.siteSettings.assigns_public = true;
@ -65,7 +35,21 @@ discourseModule(
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
);
assert.ok(!exists(".small-action.private-assign"));
assert.notOk(
exists(".small-action.private-assign"),
"adds the private-assign class when assigns are public"
);
this.siteSettings.assigns_public = false;
await render(
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
);
assert.ok(
exists(".small-action.private-assign"),
"adds the private-assign class when assigns are NOT public"
);
} finally {
resetPostSmallActionClassesCallbacks();
}