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

View File

@ -4,6 +4,7 @@ import hbs from "htmlbars-inline-precompile";
import { render } from "@ember/test-helpers"; import { render } from "@ember/test-helpers";
import { test } from "qunit"; import { test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api"; import { withPluginApi } from "discourse/lib/plugin-api";
import { resetPostSmallActionClassesCallbacks } from "discourse/widgets/post-small-action";
discourseModule( discourseModule(
"Discourse Assign | Integration | Widget | Small Action Post Class", "Discourse Assign | Integration | Widget | Small Action Post Class",
@ -11,6 +12,7 @@ discourseModule(
setupRenderingTest(hooks); setupRenderingTest(hooks);
test("Adds private-assign class when assigns are not public", async function (assert) { test("Adds private-assign class when assigns are not public", async function (assert) {
try {
this.siteSettings.assigns_public = false; this.siteSettings.assigns_public = false;
this.set("args", { this.set("args", {
@ -34,9 +36,13 @@ discourseModule(
); );
assert.ok(exists(".small-action.private-assign")); assert.ok(exists(".small-action.private-assign"));
} finally {
resetPostSmallActionClassesCallbacks();
}
}); });
test("Does not add private-assign class when assigns are public", async function (assert) { test("Does not add private-assign class when assigns are public", async function (assert) {
try {
this.siteSettings.assigns_public = true; this.siteSettings.assigns_public = true;
this.set("args", { this.set("args", {
@ -60,6 +66,9 @@ discourseModule(
); );
assert.ok(!exists(".small-action.private-assign")); assert.ok(!exists(".small-action.private-assign"));
} finally {
resetPostSmallActionClassesCallbacks();
}
}); });
} }
); );