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,51 +1,87 @@
import componentTest from 'helpers/component-test';
import componentTest from "helpers/component-test";
moduleForComponent('category-chooser', {
moduleForComponent("category-chooser", {
integration: true,
beforeEach: function() {
this.set('subject', selectKit());
this.set("subject", selectKit());
}
});
componentTest('with value', {
template: '{{category-chooser value=2}}',
componentTest("with value", {
template: "{{category-chooser value=2}}",
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), 2);
assert.equal(this.get('subject').header().title(), 'feature');
assert.equal(
this.get("subject")
.header()
.value(),
2
);
assert.equal(
this.get("subject")
.header()
.title(),
"feature"
);
});
}
});
componentTest('with excludeCategoryId', {
template: '{{category-chooser excludeCategoryId=2}}',
componentTest("with excludeCategoryId", {
template: "{{category-chooser excludeCategoryId=2}}",
test(assert) {
this.get('subject').expand();
this.get("subject").expand();
andThen(() => assert.notOk(this.get('subject').rowByValue(2).exists()));
andThen(() =>
assert.notOk(
this.get("subject")
.rowByValue(2)
.exists()
)
);
}
});
componentTest('with scopedCategoryId', {
template: '{{category-chooser scopedCategoryId=2}}',
componentTest("with scopedCategoryId", {
template: "{{category-chooser scopedCategoryId=2}}",
test(assert) {
this.get('subject').expand();
this.get("subject").expand();
andThen(() => {
assert.equal(this.get('subject').rowByIndex(0).title(), 'Discussion about features or potential features of Discourse: how they work, why they work, etc.');
assert.equal(this.get('subject').rowByIndex(0).value(), 2);
assert.equal(this.get('subject').rowByIndex(1).title(), 'My idea here is to have mini specs for features we would like built but have no bandwidth to build');
assert.equal(this.get('subject').rowByIndex(1).value(), 26);
assert.equal(this.get('subject').rows().length, 2);
assert.equal(
this.get("subject")
.rowByIndex(0)
.title(),
"Discussion about features or potential features of Discourse: how they work, why they work, etc."
);
assert.equal(
this.get("subject")
.rowByIndex(0)
.value(),
2
);
assert.equal(
this.get("subject")
.rowByIndex(1)
.title(),
"My idea here is to have mini specs for features we would like built but have no bandwidth to build"
);
assert.equal(
this.get("subject")
.rowByIndex(1)
.value(),
26
);
assert.equal(this.get("subject").rows().length, 2);
});
}
});
componentTest('with allowUncategorized=null', {
template: '{{category-chooser allowUncategorized=null}}',
componentTest("with allowUncategorized=null", {
template: "{{category-chooser allowUncategorized=null}}",
beforeEach() {
this.siteSettings.allow_uncategorized_topics = false;
@ -53,14 +89,24 @@ componentTest('with allowUncategorized=null', {
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), null);
assert.equal(this.get('subject').header().title(), "Select a category");
assert.equal(
this.get("subject")
.header()
.value(),
null
);
assert.equal(
this.get("subject")
.header()
.title(),
"Select a category"
);
});
}
});
componentTest('with allowUncategorized=null rootNone=true', {
template: '{{category-chooser allowUncategorized=null rootNone=true}}',
componentTest("with allowUncategorized=null rootNone=true", {
template: "{{category-chooser allowUncategorized=null rootNone=true}}",
beforeEach() {
this.siteSettings.allow_uncategorized_topics = false;
@ -68,30 +114,51 @@ componentTest('with allowUncategorized=null rootNone=true', {
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), null);
assert.equal(this.get('subject').header().title(), 'Select a category');
assert.equal(
this.get("subject")
.header()
.value(),
null
);
assert.equal(
this.get("subject")
.header()
.title(),
"Select a category"
);
});
}
});
componentTest('with disallowed uncategorized, rootNone and rootNoneLabel', {
template: '{{category-chooser allowUncategorized=null rootNone=true rootNoneLabel="test.root"}}',
componentTest("with disallowed uncategorized, rootNone and rootNoneLabel", {
template:
'{{category-chooser allowUncategorized=null rootNone=true rootNoneLabel="test.root"}}',
beforeEach() {
I18n.translations[I18n.locale].js.test = { root: 'root none label' };
I18n.translations[I18n.locale].js.test = { root: "root none label" };
this.siteSettings.allow_uncategorized_topics = false;
},
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), null);
assert.equal(this.get('subject').header().title(), 'Select a category');
assert.equal(
this.get("subject")
.header()
.value(),
null
);
assert.equal(
this.get("subject")
.header()
.title(),
"Select a category"
);
});
}
});
componentTest('with allowed uncategorized', {
template: '{{category-chooser allowUncategorized=true}}',
componentTest("with allowed uncategorized", {
template: "{{category-chooser allowUncategorized=true}}",
beforeEach() {
this.siteSettings.allow_uncategorized_topics = true;
@ -99,14 +166,24 @@ componentTest('with allowed uncategorized', {
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), null);
assert.equal(this.get('subject').header().title(), 'uncategorized');
assert.equal(
this.get("subject")
.header()
.value(),
null
);
assert.equal(
this.get("subject")
.header()
.title(),
"uncategorized"
);
});
}
});
componentTest('with allowed uncategorized and rootNone', {
template: '{{category-chooser allowUncategorized=true rootNone=true}}',
componentTest("with allowed uncategorized and rootNone", {
template: "{{category-chooser allowUncategorized=true rootNone=true}}",
beforeEach() {
this.siteSettings.allow_uncategorized_topics = true;
@ -114,24 +191,45 @@ componentTest('with allowed uncategorized and rootNone', {
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), null);
assert.equal(this.get('subject').header().title(), '(no category)');
assert.equal(
this.get("subject")
.header()
.value(),
null
);
assert.equal(
this.get("subject")
.header()
.title(),
"(no category)"
);
});
}
});
componentTest('with allowed uncategorized rootNone and rootNoneLabel', {
template: '{{category-chooser allowUncategorized=true rootNone=true rootNoneLabel="test.root"}}',
componentTest("with allowed uncategorized rootNone and rootNoneLabel", {
template:
'{{category-chooser allowUncategorized=true rootNone=true rootNoneLabel="test.root"}}',
beforeEach() {
I18n.translations[I18n.locale].js.test = { root: 'root none label' };
I18n.translations[I18n.locale].js.test = { root: "root none label" };
this.siteSettings.allow_uncategorized_topics = true;
},
test(assert) {
andThen(() => {
assert.equal(this.get('subject').header().value(), null);
assert.equal(this.get('subject').header().title(), 'root none label');
assert.equal(
this.get("subject")
.header()
.value(),
null
);
assert.equal(
this.get("subject")
.header()
.title(),
"root none label"
);
});
}
});