REFACTOR: Remove Discourse.NavItem constants

This commit is contained in:
Robin Ward 2019-11-08 12:56:13 -05:00
parent 779ee3558d
commit 932c169d46
4 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,5 @@
import discourseComputed from "discourse-common/utils/decorators";
import NavItem from "discourse/models/nav-item";
import { inject as service } from "@ember/service";
import Component from "@ember/component";
@ -47,7 +48,7 @@ export default Component.extend({
}, {});
}
return Discourse.NavItem.buildList(category, {
return NavItem.buildList(category, {
filterMode,
noSubcategories,
persistedQueryParams: params

View File

@ -185,7 +185,7 @@ NavItem.reopenClass({
}
items = items
.map(i => Discourse.NavItem.fromText(i, args))
.map(i => NavItem.fromText(i, args))
.filter(
i => i !== null && !(category && i.get("name").indexOf("categor") === 0)
);

View File

@ -85,7 +85,7 @@ JS
def whitelisted?(path)
@@whitelisted ||= Set.new(
["discourse/models/nav-item",
[
"discourse/routes/discourse",
"discourse/models/category",
"discourse/models/site",

View File

@ -1,7 +1,8 @@
import { run } from "@ember/runloop";
import createStore from "helpers/create-store";
import NavItem from "discourse/models/nav-item";
QUnit.module("Discourse.NavItem", {
QUnit.module("NavItem", {
beforeEach() {
run(function() {
const asianCategory = Discourse.Category.create({
@ -17,11 +18,7 @@ QUnit.test("href", assert => {
assert.expect(4);
function href(text, expected, label) {
assert.equal(
Discourse.NavItem.fromText(text, {}).get("href"),
expected,
label
);
assert.equal(NavItem.fromText(text, {}).get("href"), expected, label);
}
href("latest", "/latest", "latest");