mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:14:12 +08:00
DEV: introduces prettier for es6 files
This commit is contained in:
@ -1,80 +1,97 @@
|
||||
import { moduleForWidget, widgetTest } from 'helpers/widget-test';
|
||||
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
||||
|
||||
moduleForWidget('actions-summary');
|
||||
moduleForWidget("actions-summary");
|
||||
|
||||
widgetTest('listing actions', {
|
||||
widgetTest("listing actions", {
|
||||
template: '{{mount-widget widget="actions-summary" args=args}}',
|
||||
beforeEach() {
|
||||
this.set('args', {
|
||||
this.set("args", {
|
||||
actionsSummary: [
|
||||
{id: 1, action: 'off_topic', description: 'very off topic'},
|
||||
{id: 2, action: 'spam', description: 'suspicious message'}
|
||||
{ id: 1, action: "off_topic", description: "very off topic" },
|
||||
{ id: 2, action: "spam", description: "suspicious message" }
|
||||
]
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$('.post-actions .post-action').length, 2);
|
||||
assert.equal(this.$(".post-actions .post-action").length, 2);
|
||||
|
||||
click('.post-action:eq(0) .action-link a');
|
||||
click(".post-action:eq(0) .action-link a");
|
||||
andThen(() => {
|
||||
assert.equal(this.$('.post-action:eq(0) img.avatar').length, 1, 'clicking it shows the user');
|
||||
assert.equal(
|
||||
this.$(".post-action:eq(0) img.avatar").length,
|
||||
1,
|
||||
"clicking it shows the user"
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
widgetTest('undo', {
|
||||
template: '{{mount-widget widget="actions-summary" args=args undoPostAction=undoPostAction}}',
|
||||
widgetTest("undo", {
|
||||
template:
|
||||
'{{mount-widget widget="actions-summary" args=args undoPostAction=undoPostAction}}',
|
||||
beforeEach() {
|
||||
this.set('args', {
|
||||
this.set("args", {
|
||||
actionsSummary: [
|
||||
{action: 'off_topic', description: 'very off topic', canUndo: true},
|
||||
{ action: "off_topic", description: "very off topic", canUndo: true }
|
||||
]
|
||||
});
|
||||
|
||||
this.set('undoPostAction', () => this.undid = true);
|
||||
this.set("undoPostAction", () => (this.undid = true));
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$('.post-actions .post-action').length, 1);
|
||||
assert.equal(this.$(".post-actions .post-action").length, 1);
|
||||
|
||||
click('.action-link.undo');
|
||||
click(".action-link.undo");
|
||||
andThen(() => {
|
||||
assert.ok(this.undid, 'it triggered the action');
|
||||
assert.ok(this.undid, "it triggered the action");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
widgetTest('deferFlags', {
|
||||
template: '{{mount-widget widget="actions-summary" args=args deferPostActionFlags="deferPostActionFlags"}}',
|
||||
widgetTest("deferFlags", {
|
||||
template:
|
||||
'{{mount-widget widget="actions-summary" args=args deferPostActionFlags="deferPostActionFlags"}}',
|
||||
beforeEach() {
|
||||
this.set('args', {
|
||||
this.set("args", {
|
||||
actionsSummary: [
|
||||
{action: 'off_topic', description: 'very off topic', canDeferFlags: true, count: 1},
|
||||
{
|
||||
action: "off_topic",
|
||||
description: "very off topic",
|
||||
canDeferFlags: true,
|
||||
count: 1
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.on('deferPostActionFlags', () => this.deferred = true);
|
||||
this.on("deferPostActionFlags", () => (this.deferred = true));
|
||||
},
|
||||
test(assert) {
|
||||
assert.equal(this.$('.post-actions .post-action').length, 1);
|
||||
assert.equal(this.$(".post-actions .post-action").length, 1);
|
||||
|
||||
click('.action-link.defer-flags');
|
||||
click(".action-link.defer-flags");
|
||||
andThen(() => {
|
||||
assert.ok(this.deferred, 'it triggered the action');
|
||||
assert.ok(this.deferred, "it triggered the action");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
widgetTest('post deleted', {
|
||||
widgetTest("post deleted", {
|
||||
template: '{{mount-widget widget="actions-summary" args=args}}',
|
||||
beforeEach() {
|
||||
this.set('args', {
|
||||
this.set("args", {
|
||||
deleted_at: "2016-01-01",
|
||||
deletedByUsername: 'eviltrout',
|
||||
deletedByAvatarTemplate: '/images/avatar.png'
|
||||
deletedByUsername: "eviltrout",
|
||||
deletedByAvatarTemplate: "/images/avatar.png"
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
assert.ok(this.$('.post-action .d-icon-trash-o').length === 1, 'it has the deleted icon');
|
||||
assert.ok(this.$('.avatar[title=eviltrout]').length === 1, 'it has the deleted by avatar');
|
||||
assert.ok(
|
||||
this.$(".post-action .d-icon-trash-o").length === 1,
|
||||
"it has the deleted icon"
|
||||
);
|
||||
assert.ok(
|
||||
this.$(".avatar[title=eviltrout]").length === 1,
|
||||
"it has the deleted by avatar"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user