DEV: apply new coding standards (#10592)

This commit is contained in:
Joffrey JAFFEUX
2020-09-04 13:42:47 +02:00
committed by GitHub
parent 80dfaeb0d2
commit 52672b9eab
1473 changed files with 9386 additions and 9958 deletions
@@ -5,21 +5,21 @@ moduleFor("controller:admin-customize-themes-show", {
beforeEach() {
this.registry.register("router:main", mapRoutes());
},
needs: ["controller:adminUser"]
needs: ["controller:adminUser"],
});
QUnit.test("can display source url for remote themes", function(assert) {
QUnit.test("can display source url for remote themes", function (assert) {
const repoUrl = "https://github.com/discourse/discourse-brand-header.git";
const remoteTheme = Theme.create({
id: 2,
default: true,
name: "default",
remote_theme: {
remote_url: repoUrl
}
remote_url: repoUrl,
},
});
const controller = this.subject({
model: remoteTheme
model: remoteTheme,
});
assert.deepEqual(
@@ -29,7 +29,7 @@ QUnit.test("can display source url for remote themes", function(assert) {
);
});
QUnit.test("can display source url for remote theme branches", function(
QUnit.test("can display source url for remote theme branches", function (
assert
) {
const remoteTheme = Theme.create({
@@ -38,11 +38,11 @@ QUnit.test("can display source url for remote theme branches", function(
name: "default",
remote_theme: {
remote_url: "https://github.com/discourse/discourse-brand-header.git",
branch: "beta"
}
branch: "beta",
},
});
const controller = this.subject({
model: remoteTheme
model: remoteTheme,
});
assert.deepEqual(
@@ -5,37 +5,39 @@ moduleFor("controller:admin-customize-themes", {
beforeEach() {
this.registry.register("router:main", mapRoutes());
},
needs: ["controller:adminUser"]
needs: ["controller:adminUser"],
});
QUnit.test("can list themes correctly", function(assert) {
QUnit.test("can list themes correctly", function (assert) {
const defaultTheme = Theme.create({ id: 2, default: true, name: "default" });
const userTheme = Theme.create({
id: 3,
user_selectable: true,
name: "name"
name: "name",
});
const strayTheme1 = Theme.create({ id: 4, name: "stray1" });
const strayTheme2 = Theme.create({ id: 5, name: "stray2" });
const componentTheme = Theme.create({
id: 6,
name: "component",
component: true
component: true,
});
const controller = this.subject({
model: [strayTheme2, strayTheme1, userTheme, defaultTheme, componentTheme]
model: [strayTheme2, strayTheme1, userTheme, defaultTheme, componentTheme],
});
assert.deepEqual(
controller.get("fullThemes").map(t => t.get("name")),
[strayTheme2, strayTheme1, userTheme, defaultTheme].map(t => t.get("name")),
controller.get("fullThemes").map((t) => t.get("name")),
[strayTheme2, strayTheme1, userTheme, defaultTheme].map((t) =>
t.get("name")
),
"returns a list of themes without components"
);
assert.deepEqual(
controller.get("childThemes").map(t => t.get("name")),
[componentTheme].map(t => t.get("name")),
controller.get("childThemes").map((t) => t.get("name")),
[componentTheme].map((t) => t.get("name")),
"separate components from themes"
);
});
@@ -5,48 +5,48 @@ moduleFor("controller:admin-user-badges", {
beforeEach() {
this.registry.register("router:main", mapRoutes());
},
needs: ["controller:adminUser"]
needs: ["controller:adminUser"],
});
QUnit.test("grantableBadges", function(assert) {
QUnit.test("grantableBadges", function (assert) {
const badgeFirst = Badge.create({
id: 3,
name: "A Badge",
enabled: true,
manually_grantable: true
manually_grantable: true,
});
const badgeMiddle = Badge.create({
id: 1,
name: "My Badge",
enabled: true,
manually_grantable: true
manually_grantable: true,
});
const badgeLast = Badge.create({
id: 2,
name: "Zoo Badge",
enabled: true,
manually_grantable: true
manually_grantable: true,
});
const badgeDisabled = Badge.create({
id: 4,
name: "Disabled Badge",
enabled: false,
manually_grantable: true
manually_grantable: true,
});
const badgeAutomatic = Badge.create({
id: 5,
name: "Automatic Badge",
enabled: true,
manually_grantable: false
manually_grantable: false,
});
const controller = this.subject({
model: [],
badges: [badgeLast, badgeFirst, badgeMiddle, badgeDisabled, badgeAutomatic]
badges: [badgeLast, badgeFirst, badgeMiddle, badgeDisabled, badgeAutomatic],
});
const sortedNames = [badgeFirst.name, badgeMiddle.name, badgeLast.name];
const badgeNames = controller.get("grantableBadges").map(function(badge) {
const badgeNames = controller.get("grantableBadges").map(function (badge) {
return badge.name;
});