mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 04:18:23 +00:00
This reverts commit 022dba4727ebd030c7f3d0d24206d4828dfc672a.
This commit is contained in:
parent
afdc01a8d8
commit
8e9799da72
@ -79,23 +79,8 @@ export default createWidget("post-small-action", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
buildClasses(attrs) {
|
buildClasses(attrs) {
|
||||||
const classes = [];
|
|
||||||
|
|
||||||
if (attrs.actionClick) {
|
|
||||||
classes.push("clickable");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attrs.deleted) {
|
if (attrs.deleted) {
|
||||||
classes.push("deleted");
|
return "deleted";
|
||||||
}
|
|
||||||
|
|
||||||
return classes;
|
|
||||||
},
|
|
||||||
|
|
||||||
click(event) {
|
|
||||||
if (this.attrs.actionClick) {
|
|
||||||
event.preventDefault();
|
|
||||||
this.attrs.actionClick();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ import componentTest, {
|
|||||||
} from "discourse/tests/helpers/component-test";
|
} from "discourse/tests/helpers/component-test";
|
||||||
import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { discourseModule, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import hbs from "htmlbars-inline-precompile";
|
import hbs from "htmlbars-inline-precompile";
|
||||||
import { click } from "@ember/test-helpers";
|
|
||||||
|
|
||||||
discourseModule(
|
discourseModule(
|
||||||
"Integration | Component | Widget | post-small-action",
|
"Integration | Component | Widget | post-small-action",
|
||||||
@ -35,24 +34,6 @@ discourseModule(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTest("is clickable if actionClick", {
|
|
||||||
template: hbs`{{mount-widget widget="post-small-action" args=args}}`,
|
|
||||||
beforeEach() {
|
|
||||||
this.set("args", {
|
|
||||||
id: 123,
|
|
||||||
actionClick: () => {
|
|
||||||
document.querySelector(".small-action").style.background = "red";
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async test(assert) {
|
|
||||||
const clickable = document.querySelector(".small-action.clickable");
|
|
||||||
await click(clickable);
|
|
||||||
|
|
||||||
assert.equal(clickable.style.background, "red", "it calls the action");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
componentTest("does not show edit button if canRecover even if canEdit", {
|
componentTest("does not show edit button if canRecover even if canEdit", {
|
||||||
template: hbs`{{mount-widget widget="post-small-action" args=args}}`,
|
template: hbs`{{mount-widget widget="post-small-action" args=args}}`,
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user