DEV: introduces prettier for es6 files

This commit is contained in:
Joffrey JAFFEUX
2018-06-15 17:03:24 +02:00
committed by GitHub
parent c7ee70941e
commit 03a7d532cf
1162 changed files with 60667 additions and 29659 deletions

View File

@ -1,88 +1,106 @@
import componentTest from 'helpers/component-test';
import componentTest from "helpers/component-test";
import Category from "discourse/models/category";
moduleForComponent('category-selector', {
moduleForComponent("category-selector", {
integration: true,
beforeEach: function() {
this.set('subject', selectKit());
this.set("subject", selectKit());
}
});
componentTest('default', {
template: '{{category-selector categories=categories}}',
componentTest("default", {
template: "{{category-selector categories=categories}}",
beforeEach() {
this.set('categories', [ Category.findById(2) ]);
this.set("categories", [Category.findById(2)]);
},
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), 2);
assert.equal(
this.get("subject")
.header()
.value(),
2
);
assert.notOk(
this.get('subject').rowByValue(2).exists(),
this.get("subject")
.rowByValue(2)
.exists(),
"selected categories are not in the list"
);
});
}
});
componentTest('with blacklist', {
template: '{{category-selector categories=categories blacklist=blacklist}}',
componentTest("with blacklist", {
template: "{{category-selector categories=categories blacklist=blacklist}}",
beforeEach() {
this.set('categories', [ Category.findById(2) ]);
this.set('blacklist', [ Category.findById(8) ]);
this.set("categories", [Category.findById(2)]);
this.set("blacklist", [Category.findById(8)]);
},
test(assert) {
this.get('subject').expand();
this.get("subject").expand();
andThen(() => {
assert.ok(
this.get('subject').rowByValue(6).exists(),
this.get("subject")
.rowByValue(6)
.exists(),
"not blacklisted categories are in the list"
);
assert.notOk(
this.get('subject').rowByValue(8).exists(),
this.get("subject")
.rowByValue(8)
.exists(),
"blacklisted categories are not in the list"
);
});
}
});
componentTest('interactions', {
template: '{{category-selector categories=categories}}',
componentTest("interactions", {
template: "{{category-selector categories=categories}}",
beforeEach() {
this.set('categories', [
Category.findById(2),
Category.findById(6)
]);
this.set("categories", [Category.findById(2), Category.findById(6)]);
},
test(assert) {
this.get('subject').expand().selectRowByValue(8);
this.get("subject")
.expand()
.selectRowByValue(8);
andThen(() => {
assert.equal(
this.get('subject').header().value(),
'2,6,8',
'it adds the selected category'
this.get("subject")
.header()
.value(),
"2,6,8",
"it adds the selected category"
);
assert.equal(this.get('categories').length, 3);
assert.equal(this.get("categories").length, 3);
});
this.get('subject').expand();
this.get('subject').keyboard().backspace();
this.get('subject').keyboard().backspace();
this.get("subject").expand();
this.get("subject")
.keyboard()
.backspace();
this.get("subject")
.keyboard()
.backspace();
andThen(() => {
assert.equal(
this.get('subject').header().value(),
'2,6',
'it removes the last selected category'
this.get("subject")
.header()
.value(),
"2,6",
"it removes the last selected category"
);
assert.equal(this.get('categories').length, 2);
assert.equal(this.get("categories").length, 2);
});
}
});