fix test failure
This commit is contained in:
parent
aaf05abf16
commit
4b755332b9
|
|
@ -12,36 +12,6 @@ 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.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 {
|
try {
|
||||||
this.siteSettings.assigns_public = true;
|
this.siteSettings.assigns_public = true;
|
||||||
|
|
||||||
|
|
@ -65,7 +35,21 @@ discourseModule(
|
||||||
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
|
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 {
|
} finally {
|
||||||
resetPostSmallActionClassesCallbacks();
|
resetPostSmallActionClassesCallbacks();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue