mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
lint files
This commit is contained in:
parent
dd9d815178
commit
95720e3873
@ -77,7 +77,9 @@ export default Ember.Controller.extend(ModalFunctionality, Ember.Evented, {
|
||||
|
||||
if (!category.get("parent_category_id")) {
|
||||
category.set("position", position++);
|
||||
(subcategories[category.get("id")] || []).forEach(subcategory => subcategory.set("position", position++));
|
||||
(subcategories[category.get("id")] || []).forEach(subcategory =>
|
||||
subcategory.set("position", position++)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,11 @@ QUnit.test("fixIndices set unique position number", function(assert) {
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
|
||||
reorderCategoriesController.get("categoriesOrdered").forEach((category, index) => {
|
||||
assert.equal(category.get("position"), index);
|
||||
});
|
||||
reorderCategoriesController
|
||||
.get("categoriesOrdered")
|
||||
.forEach((category, index) => {
|
||||
assert.equal(category.get("position"), index);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
@ -31,10 +33,28 @@ QUnit.test(
|
||||
function(assert) {
|
||||
const store = createStore();
|
||||
|
||||
const parent = store.createRecord("category", { id: 1, position: 1, slug: "parent" });
|
||||
const child1 = store.createRecord("category", { id: 2, position: 3, slug: "child1", parent_category_id: 1 });
|
||||
const child2 = store.createRecord("category", { id: 3, position: 0, slug: "child2", parent_category_id: 1 });
|
||||
const other = store.createRecord("category", { id: 4, position: 2, slug: "other" });
|
||||
const parent = store.createRecord("category", {
|
||||
id: 1,
|
||||
position: 1,
|
||||
slug: "parent"
|
||||
});
|
||||
const child1 = store.createRecord("category", {
|
||||
id: 2,
|
||||
position: 3,
|
||||
slug: "child1",
|
||||
parent_category_id: 1
|
||||
});
|
||||
const child2 = store.createRecord("category", {
|
||||
id: 3,
|
||||
position: 0,
|
||||
slug: "child2",
|
||||
parent_category_id: 1
|
||||
});
|
||||
const other = store.createRecord("category", {
|
||||
id: 4,
|
||||
position: 2,
|
||||
slug: "other"
|
||||
});
|
||||
|
||||
const categories = [child2, parent, other, child1];
|
||||
const expectedOrderSlugs = ["parent", "child2", "child1", "other"];
|
||||
@ -44,7 +64,9 @@ QUnit.test(
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
|
||||
assert.deepEqual(reorderCategoriesController.get("categoriesOrdered").mapBy("slug"), expectedOrderSlugs);
|
||||
assert.deepEqual(
|
||||
reorderCategoriesController.get("categoriesOrdered").mapBy("slug"),
|
||||
expectedOrderSlugs
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user