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
@@ -2,7 +2,7 @@ import componentTest from "helpers/component-test";
import selectKit, {
testSelectKitModule,
setDefaultState,
DEFAULT_CONTENT
DEFAULT_CONTENT,
} from "helpers/select-kit-helper";
import { withPluginApi } from "discourse/lib/plugin-api";
import { clearCallbacks } from "select-kit/mixins/plugin-api";
@@ -11,13 +11,13 @@ testSelectKitModule("select-kit:api", {
beforeEach() {
this.setProperties({
comboBox: selectKit(".combo-box"),
singleSelect: selectKit(".single-select:not(.combo-box)")
singleSelect: selectKit(".single-select:not(.combo-box)"),
});
},
afterEach() {
clearCallbacks();
}
},
});
componentTest("modifySelectKit(identifier).appendContent", {
@@ -29,11 +29,11 @@ componentTest("modifySelectKit(identifier).appendContent", {
beforeEach() {
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", api => {
withPluginApi("0.8.43", (api) => {
api.modifySelectKit("combo-box").appendContent(() => {
return {
id: "alpaca",
name: "Alpaca"
name: "Alpaca",
};
});
api.modifySelectKit("combo-box").appendContent(() => {});
@@ -52,7 +52,7 @@ componentTest("modifySelectKit(identifier).appendContent", {
await this.comboBox.collapse();
assert.notOk(this.singleSelect.rowByValue("alpaca").exists());
}
},
});
componentTest("modifySelectKit(identifier).prependContent", {
@@ -64,11 +64,11 @@ componentTest("modifySelectKit(identifier).prependContent", {
beforeEach() {
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", api => {
withPluginApi("0.8.43", (api) => {
api.modifySelectKit("combo-box").prependContent(() => {
return {
id: "alpaca",
name: "Alpaca"
name: "Alpaca",
};
});
api.modifySelectKit("combo-box").prependContent(() => {});
@@ -87,7 +87,7 @@ componentTest("modifySelectKit(identifier).prependContent", {
await this.comboBox.collapse();
assert.notOk(this.singleSelect.rowByValue("alpaca").exists());
}
},
});
componentTest("modifySelectKit(identifier).onChange", {
@@ -99,7 +99,7 @@ componentTest("modifySelectKit(identifier).onChange", {
beforeEach() {
setDefaultState(this, null, { content: DEFAULT_CONTENT });
withPluginApi("0.8.43", api => {
withPluginApi("0.8.43", (api) => {
api.modifySelectKit("combo-box").onChange((component, value, item) => {
find("#test").text(item.name);
});
@@ -111,5 +111,5 @@ componentTest("modifySelectKit(identifier).onChange", {
await this.comboBox.selectRowByIndex(0);
assert.equal(find("#test").text(), "foo");
}
},
});
@@ -25,7 +25,7 @@ componentTest("with value", {
async test(assert) {
assert.equal(this.subject.header().value(), 2);
assert.equal(this.subject.header().label(), "feature");
}
},
});
componentTest("with excludeCategoryId", {
@@ -34,7 +34,7 @@ componentTest("with excludeCategoryId", {
await this.subject.expand();
assert.notOk(this.subject.rowByValue(2).exists());
}
},
});
componentTest("with scopedCategoryId", {
@@ -62,7 +62,7 @@ componentTest("with scopedCategoryId", {
"bug",
"search finds outside of scope"
);
}
},
});
componentTest("with allowUncategorized=null", {
@@ -75,7 +75,7 @@ componentTest("with allowUncategorized=null", {
test(assert) {
assert.equal(this.subject.header().value(), null);
assert.equal(this.subject.header().label(), "category…");
}
},
});
componentTest("with allowUncategorized=null rootNone=true", {
@@ -88,7 +88,7 @@ componentTest("with allowUncategorized=null rootNone=true", {
test(assert) {
assert.equal(this.subject.header().value(), null);
assert.equal(this.subject.header().label(), "(no category)");
}
},
});
componentTest("with disallowed uncategorized, none", {
@@ -102,7 +102,7 @@ componentTest("with disallowed uncategorized, none", {
test(assert) {
assert.equal(this.subject.header().value(), null);
assert.equal(this.subject.header().label(), "root none label");
}
},
});
componentTest("with allowed uncategorized", {
@@ -115,7 +115,7 @@ componentTest("with allowed uncategorized", {
test(assert) {
assert.equal(this.subject.header().value(), null);
assert.equal(this.subject.header().label(), "uncategorized");
}
},
});
componentTest("with allowed uncategorized and none=true", {
@@ -128,7 +128,7 @@ componentTest("with allowed uncategorized and none=true", {
test(assert) {
assert.equal(this.subject.header().value(), null);
assert.equal(this.subject.header().label(), "(no category)");
}
},
});
componentTest("with allowed uncategorized and none", {
@@ -142,5 +142,5 @@ componentTest("with allowed uncategorized and none", {
test(assert) {
assert.equal(this.subject.header().value(), null);
assert.equal(this.subject.header().label(), "root none label");
}
},
});
@@ -5,7 +5,7 @@ import componentTest from "helpers/component-test";
import { testSelectKitModule } from "helpers/select-kit-helper";
import {
NO_CATEGORIES_ID,
ALL_CATEGORIES_ID
ALL_CATEGORIES_ID,
} from "select-kit/components/category-drop";
import { set } from "@ember/object";
@@ -15,20 +15,20 @@ function initCategories(context) {
const categories = context.site.categoriesList;
context.setProperties({
category: categories.firstObject,
categories
categories,
});
}
function initCategoriesWithParentCategory(context) {
const parentCategory = Category.findById(2);
const childCategories = context.site.categoriesList.filter(c => {
const childCategories = context.site.categoriesList.filter((c) => {
return c.parentCategory === parentCategory;
});
context.setProperties({
parentCategory,
category: null,
categories: childCategories
categories: childCategories,
});
}
@@ -60,7 +60,7 @@ componentTest("caretUpIcon", {
exists($header.find(`.d-icon-caret-right`)),
"it uses the correct default icon"
);
}
},
});
componentTest("none", {
@@ -78,7 +78,7 @@ componentTest("none", {
I18n.t("category.all").toLowerCase(),
"it uses the noneLabel"
);
}
},
});
componentTest("[not staff - TL0] displayCategoryDescription", {
@@ -99,7 +99,7 @@ componentTest("[not staff - TL0] displayCategoryDescription", {
exists(row.el().find(".category-desc")),
"it shows category description for newcomers"
);
}
},
});
componentTest("[not staff - TL1] displayCategoryDescription", {
@@ -120,7 +120,7 @@ componentTest("[not staff - TL1] displayCategoryDescription", {
!exists(row.el().find(".category-desc")),
"it doesn't shows category description for TL0+"
);
}
},
});
componentTest("[staff - TL0] displayCategoryDescription", {
@@ -141,7 +141,7 @@ componentTest("[staff - TL0] displayCategoryDescription", {
!exists(row.el().find(".category-desc")),
"it doesn't show category description for staff"
);
}
},
});
componentTest("hideParentCategory (default: false)", {
@@ -157,7 +157,7 @@ componentTest("hideParentCategory (default: false)", {
const row = this.subject.rowByValue(this.category.id);
assert.equal(row.value(), this.category.id);
assert.equal(this.category.parent_category_id, null);
}
},
});
componentTest("hideParentCategory (true)", {
@@ -179,13 +179,8 @@ componentTest("hideParentCategory (true)", {
assert.ok(childRow.exists(), "the child row is showing");
const $categoryStatus = childRow.el().find(".category-status");
assert.ok(
$categoryStatus
.text()
.trim()
.match(/^spec/)
);
}
assert.ok($categoryStatus.text().trim().match(/^spec/));
},
});
componentTest("allow_uncategorized_topics (true)", {
@@ -202,7 +197,7 @@ componentTest("allow_uncategorized_topics (true)", {
const uncategorizedCategoryId = this.site.uncategorized_category_id;
const row = this.subject.rowByValue(uncategorizedCategoryId);
assert.ok(row.exists(), "the uncategorized row is showing");
}
},
});
componentTest("allow_uncategorized_topics (false)", {
@@ -219,7 +214,7 @@ componentTest("allow_uncategorized_topics (false)", {
const uncategorizedCategoryId = this.site.uncategorized_category_id;
const row = this.subject.rowByValue(uncategorizedCategoryId);
assert.notOk(row.exists(), "the uncategorized row is not showing");
}
},
});
componentTest("countSubcategories (default: false)", {
@@ -234,18 +229,14 @@ componentTest("countSubcategories (default: false)", {
const category = Category.findById(7);
const row = this.subject.rowByValue(category.id);
const topicCount = row
.el()
.find(".topic-count")
.text()
.trim();
const topicCount = row.el().find(".topic-count").text().trim();
assert.equal(
topicCount,
"× 481",
"it doesn't include the topic count of subcategories"
);
}
},
});
componentTest("countSubcategories (true)", {
@@ -260,18 +251,14 @@ componentTest("countSubcategories (true)", {
const category = Category.findById(7);
const row = this.subject.rowByValue(category.id);
const topicCount = row
.el()
.find(".topic-count")
.text()
.trim();
const topicCount = row.el().find(".topic-count").text().trim();
assert.equal(
topicCount,
"× 584",
"it includes the topic count of subcategories"
);
}
},
});
componentTest("shortcuts:default", {
@@ -290,7 +277,7 @@ componentTest("shortcuts:default", {
this.categories.firstObject.id,
"Shortcuts are not prepended when no category is selected"
);
}
},
});
componentTest("shortcuts:category is set", {
@@ -304,7 +291,7 @@ componentTest("shortcuts:category is set", {
await this.subject.expand();
assert.equal(this.subject.rowByIndex(0).value(), ALL_CATEGORIES_ID);
}
},
});
componentTest("shortcuts with parentCategory/subCategory=true:default", {
@@ -318,7 +305,7 @@ componentTest("shortcuts with parentCategory/subCategory=true:default", {
await this.subject.expand();
assert.equal(this.subject.rowByIndex(0).value(), NO_CATEGORIES_ID);
}
},
});
componentTest(
@@ -336,7 +323,7 @@ componentTest(
assert.equal(this.subject.rowByIndex(0).value(), ALL_CATEGORIES_ID);
assert.equal(this.subject.rowByIndex(1).value(), NO_CATEGORIES_ID);
}
},
}
);
@@ -356,5 +343,5 @@ componentTest("category url", {
DiscourseURL.routeTo.calledWith("/c/feature/spec/26"),
"it builds a correct URL"
);
}
},
});
@@ -5,13 +5,13 @@ moduleForComponent("select-kit/combo-box", {
integration: true,
beforeEach() {
this.set("subject", selectKit());
}
},
});
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
{ id: 3, name: "baz" }
{ id: 3, name: "baz" },
];
const DEFAULT_VALUE = 1;
@@ -20,7 +20,7 @@ const setDefaultState = (ctx, options) => {
const properties = Object.assign(
{
content: DEFAULT_CONTENT,
value: DEFAULT_VALUE
value: DEFAULT_VALUE,
},
options || {}
);
@@ -40,9 +40,9 @@ componentTest("options.clearable", {
beforeEach() {
setDefaultState(this, {
clearable: true,
onChange: value => {
onChange: (value) => {
this.set("value", value);
}
},
});
},
@@ -62,7 +62,7 @@ componentTest("options.clearable", {
"it hides the clear button"
);
assert.equal($header.value(), null);
}
},
});
componentTest("options.{caretUpIcon,caretDownIcon}", {
@@ -80,7 +80,7 @@ componentTest("options.{caretUpIcon,caretDownIcon}", {
beforeEach() {
setDefaultState(this, {
caretUpIcon: "pencil-alt",
caretDownIcon: "trash-alt"
caretDownIcon: "trash-alt",
});
},
@@ -98,5 +98,5 @@ componentTest("options.{caretUpIcon,caretDownIcon}", {
exists($header.find(`.d-icon-${this.caretUpIcon}`)),
"it uses the icon provided"
);
}
},
});
@@ -5,13 +5,13 @@ moduleForComponent("select-kit/dropdown-select-box", {
integration: true,
beforeEach() {
this.set("subject", selectKit());
}
},
});
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
{ id: 3, name: "baz" }
{ id: 3, name: "baz" },
];
const DEFAULT_VALUE = 1;
@@ -21,9 +21,9 @@ const setDefaultState = (ctx, options) => {
{
content: DEFAULT_CONTENT,
value: DEFAULT_VALUE,
onChange: value => {
onChange: (value) => {
this.set("value", value);
}
},
},
options || {}
);
@@ -51,7 +51,7 @@ componentTest("selection behavior", {
this.subject.isExpanded(),
"it collapses the dropdown on select"
);
}
},
});
componentTest("options.showFullTitle=false", {
@@ -71,30 +71,22 @@ componentTest("options.showFullTitle=false", {
setDefaultState(this, {
value: null,
showFullTitle: false,
none: "test_none"
none: "test_none",
});
},
async test(assert) {
assert.ok(
!exists(
this.subject
.header()
.el()
.find(".selected-name")
),
!exists(this.subject.header().el().find(".selected-name")),
"it hides the text of the selected item"
);
assert.equal(
this.subject
.header()
.el()
.attr("title"),
this.subject.header().el().attr("title"),
"[en_US.test_none]",
"it adds a title attribute to the button"
);
}
},
});
componentTest("options.showFullTitle=true", {
@@ -114,13 +106,8 @@ componentTest("options.showFullTitle=true", {
async test(assert) {
assert.ok(
exists(
this.subject
.header()
.el()
.find(".selected-name")
),
exists(this.subject.header().el().find(".selected-name")),
"it shows the text of the selected item"
);
}
},
});
@@ -31,5 +31,5 @@ componentTest("default", {
assert.equal(this.subject.rows().length, 1);
assert.equal(this.subject.rowByIndex(0).value(), "underline");
}
},
});
@@ -17,7 +17,7 @@ componentTest("displays tags", {
async test(assert) {
assert.equal(this.subject.header().value(), "foo,bar");
}
},
});
componentTest("create a tag", {
@@ -32,23 +32,13 @@ componentTest("create a tag", {
await this.subject.expand();
await this.subject.fillInFilter("mon");
assert.equal(
find(".select-kit-row")
.text()
.trim(),
"monkey x1"
);
assert.equal(find(".select-kit-row").text().trim(), "monkey x1");
await this.subject.fillInFilter("key");
assert.equal(
find(".select-kit-row")
.text()
.trim(),
"monkey x1"
);
assert.equal(find(".select-kit-row").text().trim(), "monkey x1");
await this.subject.keyboard("enter");
assert.equal(this.subject.header().value(), "foo,bar,monkey");
}
},
});
componentTest("max_tags_per_topic", {
@@ -70,8 +60,8 @@ componentTest("max_tags_per_topic", {
assert.equal(
error,
I18n.t("select_kit.max_content_reached", {
count: this.siteSettings.max_tags_per_topic
count: this.siteSettings.max_tags_per_topic,
})
);
}
},
});
@@ -18,14 +18,14 @@ function template(options = []) {
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
{ id: 3, name: "baz" }
{ id: 3, name: "baz" },
];
const setDefaultState = (ctx, options) => {
const properties = Object.assign(
{
content: DEFAULT_CONTENT,
value: null
value: null,
},
options || {}
);
@@ -59,5 +59,5 @@ componentTest("content", {
null,
"it doesn't set a value from the content"
);
}
},
});
@@ -1,7 +1,7 @@
import componentTest from "helpers/component-test";
import {
testSelectKitModule,
setDefaultState
setDefaultState,
} from "helpers/select-kit-helper";
testSelectKitModule("notifications-button");
@@ -39,5 +39,5 @@ componentTest("default", {
icon.classList.contains("d-icon-d-regular"),
"it shows the correct icon"
);
}
},
});
@@ -2,20 +2,20 @@ import selectKit from "helpers/select-kit-helper";
import componentTest from "helpers/component-test";
import Topic from "discourse/models/topic";
const buildTopic = function(pinned = true) {
const buildTopic = function (pinned = true) {
return Topic.create({
id: 1234,
title: "Qunit Test Topic",
deleted_at: new Date(),
pinned
pinned,
});
};
moduleForComponent("select-kit/pinned-options", {
integration: true,
beforeEach: function() {
beforeEach: function () {
this.set("subject", selectKit());
}
},
});
componentTest("unpinning", {
@@ -33,7 +33,7 @@ componentTest("unpinning", {
await this.subject.selectRowByValue("unpinned");
assert.equal(this.subject.header().name(), "unpinned");
}
},
});
componentTest("pinning", {
@@ -51,5 +51,5 @@ componentTest("pinning", {
await this.subject.selectRowByValue("pinned");
assert.equal(this.subject.header().name(), "pinned");
}
},
});
@@ -22,7 +22,7 @@ function template(options = []) {
const DEFAULT_CONTENT = [
{ id: 1, name: "foo" },
{ id: 2, name: "bar" },
{ id: 3, name: "baz" }
{ id: 3, name: "baz" },
];
const DEFAULT_VALUE = 1;
@@ -34,9 +34,9 @@ const setDefaultState = (ctx, options) => {
value: DEFAULT_VALUE,
nameProperty: "name",
valueProperty: "id",
onChange: value => {
onChange: (value) => {
ctx.set("value", value);
}
},
},
options || {}
);
@@ -70,7 +70,7 @@ componentTest("content", {
null,
"it doesn't set a value from the content"
);
}
},
});
componentTest("value", {
@@ -86,7 +86,7 @@ componentTest("value", {
1,
"it selects the correct content to display"
);
}
},
});
componentTest("options.filterable", {
@@ -107,7 +107,7 @@ componentTest("options.filterable", {
filter,
"it filters the list"
);
}
},
});
componentTest("options.limitMatches", {
@@ -126,7 +126,7 @@ componentTest("options.limitMatches", {
1,
"it returns only 1 result"
);
}
},
});
componentTest("valueAttribute (deprecated)", {
@@ -146,7 +146,7 @@ componentTest("valueAttribute (deprecated)", {
{ name: "Smaller", value: "smaller" },
{ name: "Normal", value: "normal" },
{ name: "Larger", value: "larger" },
{ name: "Largest", value: "largest" }
{ name: "Largest", value: "largest" },
];
this.set("content", content);
},
@@ -155,7 +155,7 @@ componentTest("valueAttribute (deprecated)", {
await this.subject.expand();
assert.equal(this.subject.selectedRow().value(), this.value);
}
},
});
componentTest("none:string", {
@@ -172,7 +172,7 @@ componentTest("none:string", {
const noneRow = this.subject.rowByIndex(0);
assert.equal(noneRow.value(), null);
assert.equal(noneRow.name(), I18n.t("test.none"));
}
},
});
componentTest("none:object", {
@@ -188,7 +188,7 @@ componentTest("none:object", {
const noneRow = this.subject.rowByIndex(0);
assert.equal(noneRow.value(), null);
assert.equal(noneRow.name(), "(default)");
}
},
});
componentTest("content is a basic array", {
@@ -200,7 +200,7 @@ componentTest("content is a basic array", {
nameProperty: null,
valueProperty: null,
value: "foo",
content: ["foo", "bar", "baz"]
content: ["foo", "bar", "baz"],
});
},
@@ -215,7 +215,7 @@ componentTest("content is a basic array", {
await this.subject.selectRowByIndex(0);
assert.equal(this.value, null);
}
},
});
componentTest("selected value can be 0", {
@@ -226,8 +226,8 @@ componentTest("selected value can be 0", {
value: 1,
content: [
{ id: 0, name: "foo" },
{ id: 1, name: "bar" }
]
{ id: 1, name: "bar" },
],
});
},
@@ -238,7 +238,7 @@ componentTest("selected value can be 0", {
await this.subject.selectRowByValue(0);
assert.equal(this.subject.header().value(), 0);
}
},
});
componentTest("prevents propagating click event on header", {
@@ -249,7 +249,7 @@ componentTest("prevents propagating click event on header", {
this.setProperties({
onClick: () => this.set("value", "foo"),
content: DEFAULT_CONTENT,
value: DEFAULT_VALUE
value: DEFAULT_VALUE,
});
},
@@ -257,7 +257,7 @@ componentTest("prevents propagating click event on header", {
assert.equal(this.value, DEFAULT_VALUE);
await this.subject.expand();
assert.equal(this.value, DEFAULT_VALUE);
}
},
});
componentTest("labelProperty", {
@@ -266,7 +266,7 @@ componentTest("labelProperty", {
beforeEach() {
this.setProperties({
content: [{ id: 1, name: "john", foo: "JACKSON" }],
value: 1
value: 1,
});
},
@@ -278,7 +278,7 @@ componentTest("labelProperty", {
const row = this.subject.rowByValue(1);
assert.equal(row.label(), "JACKSON");
}
},
});
componentTest("titleProperty", {
@@ -287,7 +287,7 @@ componentTest("titleProperty", {
beforeEach() {
this.setProperties({
content: [{ id: 1, name: "john", foo: "JACKSON" }],
value: 1
value: 1,
});
},
@@ -299,5 +299,5 @@ componentTest("titleProperty", {
const row = this.subject.rowByValue(1);
assert.equal(row.title(), "JACKSON");
}
},
});
@@ -10,36 +10,36 @@ testSelectKitModule("tag-drop", {
const site = Site.current();
set(site, "top_tags", ["jeff", "neil", "arpit", "régis"]);
const response = object => {
const response = (object) => {
return [200, { "Content-Type": "application/json" }, object];
};
pretender.get("/tags/filter/search", params => {
pretender.get("/tags/filter/search", (params) => {
if (params.queryParams.q === "rég") {
return response({
results: [{ id: "régis", text: "régis", count: 2, pm_count: 0 }]
results: [{ id: "régis", text: "régis", count: 2, pm_count: 0 }],
});
} else if (params.queryParams.q === "dav") {
return response({
results: [{ id: "David", text: "David", count: 2, pm_count: 0 }]
results: [{ id: "David", text: "David", count: 2, pm_count: 0 }],
});
}
});
}
},
});
function initTags(context) {
const categories = context.site.categoriesList;
const parentCategory = categories.findBy("id", 2);
const childCategories = categories.filter(
c => c.parentCategory === parentCategory
(c) => c.parentCategory === parentCategory
);
// top_tags
context.setProperties({
firstCategory: parentCategory,
secondCategory: childCategories.firstObject,
tagId: "jeff"
tagId: "jeff",
});
}
@@ -85,5 +85,5 @@ componentTest("default", {
I18n.t("tagging.selector_all_tags"),
"it has the correct label for all-tags"
);
}
},
});
@@ -3,15 +3,15 @@ import selectKit from "helpers/select-kit-helper";
import componentTest from "helpers/component-test";
import Topic from "discourse/models/topic";
const buildTopic = function(level, archetype = "regular") {
const buildTopic = function (level, archetype = "regular") {
return Topic.create({
id: 4563
id: 4563,
}).updateFromJson({
title: "Qunit Test Topic",
details: {
notification_level: level
notification_level: level,
},
archetype
archetype,
});
};
@@ -23,7 +23,7 @@ moduleForComponent("select-kit/topic-notifications-button", {
afterEach() {
I18n.translations.en.js.topic.notifications.tracking_pm.title = originalTranslation;
}
},
});
componentTest("the header has a localized title", {
@@ -36,9 +36,7 @@ componentTest("the header has a localized title", {
async test(assert) {
assert.equal(
selectKit()
.header()
.label(),
selectKit().header().label(),
"Normal",
"it has the correct label"
);
@@ -46,13 +44,11 @@ componentTest("the header has a localized title", {
await this.set("topic", buildTopic(2));
assert.equal(
selectKit()
.header()
.label(),
selectKit().header().label(),
"Tracking",
"it correctly changes the label"
);
}
},
});
componentTest("the header has a localized title", {
@@ -66,11 +62,9 @@ componentTest("the header has a localized title", {
test(assert) {
assert.equal(
selectKit()
.header()
.label(),
selectKit().header().label(),
`${originalTranslation} PM`,
"it has the correct label for PMs"
);
}
},
});
@@ -3,34 +3,34 @@ import selectKit from "helpers/select-kit-helper";
import componentTest from "helpers/component-test";
import Topic from "discourse/models/topic";
const buildTopic = function(archetype) {
const buildTopic = function (archetype) {
return Topic.create({
id: 4563
id: 4563,
}).updateFromJson({
title: "Qunit Test Topic",
details: {
notification_level: 1
notification_level: 1,
},
archetype
archetype,
});
};
function extractDescs(rows) {
return Array.from(
rows.find(".desc").map(function() {
rows.find(".desc").map(function () {
return this.textContent.trim();
})
);
}
function getTranslations(type = "") {
return ["watching", "tracking", "regular", "muted"].map(key => {
return ["watching", "tracking", "regular", "muted"].map((key) => {
return I18n.t(`topic.notifications.${key}${type}.description`);
});
}
moduleForComponent("select-kit/topic-notifications-options", {
integration: true
integration: true,
});
componentTest("regular topic notification level descriptions", {
@@ -59,7 +59,7 @@ componentTest("regular topic notification level descriptions", {
"it has the correct copy"
);
});
}
},
});
componentTest("PM topic notification level descriptions", {
@@ -89,5 +89,5 @@ componentTest("PM topic notification level descriptions", {
"it has the correct copy"
);
});
}
},
});
@@ -16,7 +16,7 @@ componentTest("displays usernames", {
async test(assert) {
assert.equal(this.subject.header().name(), "bob,martin");
}
},
});
componentTest("can remove a username", {
@@ -29,5 +29,5 @@ componentTest("can remove a username", {
async test(assert) {
await this.subject.deselectItem("bob");
assert.equal(this.subject.header().name(), "martin");
}
},
});