DEV: Import EmberObject rather than global variable (#8256)
* DEV: Import ember/object rather than Ember.Object globally * fixed broken object proxy import * prettier on js * added @ember/object/proxy to loader * added unstaged file * Fixed objet proxy reference is loader * Linting!
This commit is contained in:
committed by
GitHub
parent
74dc37c07c
commit
c7475ee03b
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
import componentTest from "helpers/component-test";
|
||||
|
||||
@@ -20,7 +21,7 @@ componentTest("default", {
|
||||
|
||||
this.set(
|
||||
"setting",
|
||||
Ember.Object.create({
|
||||
EmberObject.create({
|
||||
allowsNone: undefined,
|
||||
category: "foo",
|
||||
default: "",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
moduleFor("controller:preferences/account");
|
||||
|
||||
QUnit.test("updating of associated accounts", function(assert) {
|
||||
@@ -5,11 +6,11 @@ QUnit.test("updating of associated accounts", function(assert) {
|
||||
siteSettings: {
|
||||
enable_google_oauth2_logins: true
|
||||
},
|
||||
model: Ember.Object.create({
|
||||
model: EmberObject.create({
|
||||
second_factor_enabled: true,
|
||||
is_anonymous: true
|
||||
}),
|
||||
site: Ember.Object.create({
|
||||
site: EmberObject.create({
|
||||
isMobileDevice: false
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import { mapRoutes } from "discourse/mapping-router";
|
||||
import createStore from "helpers/create-store";
|
||||
|
||||
@@ -16,7 +17,7 @@ QUnit.test("fixIndices set unique position number", function(assert) {
|
||||
categories.push(store.createRecord("category", { id: i, position: 0 }));
|
||||
}
|
||||
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
@@ -59,7 +60,7 @@ QUnit.test(
|
||||
const categories = [child2, parent, other, child1];
|
||||
const expectedOrderSlugs = ["parent", "child2", "child1", "other"];
|
||||
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
@@ -95,7 +96,7 @@ QUnit.test(
|
||||
});
|
||||
|
||||
const categories = [elem1, elem2, elem3];
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.actions.change.call(
|
||||
@@ -142,7 +143,7 @@ QUnit.test(
|
||||
});
|
||||
|
||||
const categories = [elem1, child1, elem2, elem3];
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.actions.change.call(
|
||||
@@ -189,7 +190,7 @@ QUnit.test(
|
||||
});
|
||||
|
||||
const categories = [elem1, child1, elem2, elem3];
|
||||
const site = Ember.Object.create({ categories: categories });
|
||||
const site = EmberObject.create({ categories: categories });
|
||||
const reorderCategoriesController = this.subject({ site });
|
||||
|
||||
reorderCategoriesController.fixIndices();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Topic from "discourse/models/topic";
|
||||
import PostStream from "discourse/models/post-stream";
|
||||
import { Placeholder } from "discourse/lib/posts-with-placeholders";
|
||||
@@ -191,7 +192,7 @@ QUnit.test("selectedPostsUsername", function(assert) {
|
||||
});
|
||||
|
||||
QUnit.test("showSelectedPostsAtBottom", function(assert) {
|
||||
const site = Ember.Object.create({ mobileView: false });
|
||||
const site = EmberObject.create({ mobileView: false });
|
||||
const model = Topic.create({ posts_count: 3 });
|
||||
const controller = this.subject({ model, site });
|
||||
|
||||
@@ -467,7 +468,7 @@ QUnit.test("togglePostSelection", function(assert) {
|
||||
// });
|
||||
|
||||
QUnit.test("selectBelow", function(assert) {
|
||||
const site = Ember.Object.create({
|
||||
const site = EmberObject.create({
|
||||
post_types: { small_action: 3, whisper: 4 }
|
||||
});
|
||||
|
||||
@@ -521,7 +522,7 @@ QUnit.test(
|
||||
});
|
||||
|
||||
let destroyed;
|
||||
const post = Ember.Object.create({
|
||||
const post = EmberObject.create({
|
||||
id: 2,
|
||||
post_number: 2,
|
||||
can_delete: true,
|
||||
@@ -532,12 +533,12 @@ QUnit.test(
|
||||
}
|
||||
});
|
||||
|
||||
const postStream = Ember.Object.create({
|
||||
const postStream = EmberObject.create({
|
||||
stream: [2, 3, 4],
|
||||
posts: [post, { id: 3 }, { id: 4 }]
|
||||
});
|
||||
|
||||
const currentUser = Ember.Object.create({ moderator: true });
|
||||
const currentUser = EmberObject.create({ moderator: true });
|
||||
const model = Topic.create({ postStream });
|
||||
const controller = this.subject({ model, currentUser });
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import createStore from "helpers/create-store";
|
||||
import { autoLoadModules } from "discourse/initializers/auto-load-modules";
|
||||
import TopicTrackingState from "discourse/models/topic-tracking-state";
|
||||
@@ -15,7 +16,7 @@ export default function(name, opts) {
|
||||
this.registry.register("site-settings:main", Discourse.SiteSettings, {
|
||||
instantiate: false
|
||||
});
|
||||
this.registry.register("capabilities:main", Ember.Object);
|
||||
this.registry.register("capabilities:main", EmberObject);
|
||||
this.registry.register("site:main", this.site, { instantiate: false });
|
||||
this.registry.injection("component", "siteSettings", "site-settings:main");
|
||||
this.registry.injection("component", "appEvents", "service:app-events");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import {
|
||||
setting,
|
||||
propertyEqual,
|
||||
@@ -20,7 +21,7 @@ QUnit.module("lib:computed", {
|
||||
});
|
||||
|
||||
QUnit.test("setting", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
vehicle: setting("vehicle"),
|
||||
missingProp: setting("madeUpThing")
|
||||
}).create();
|
||||
@@ -38,7 +39,7 @@ QUnit.test("setting", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("propertyEqual", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
same: propertyEqual("cookies", "biscuits")
|
||||
}).create({
|
||||
cookies: 10,
|
||||
@@ -51,7 +52,7 @@ QUnit.test("propertyEqual", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("propertyNotEqual", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
diff: propertyNotEqual("cookies", "biscuits")
|
||||
}).create({
|
||||
cookies: 10,
|
||||
@@ -64,7 +65,7 @@ QUnit.test("propertyNotEqual", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("fmt", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
exclaimyUsername: fmt("username", "!!! %@ !!!"),
|
||||
multiple: fmt("username", "mood", "%@ is %@")
|
||||
}).create({
|
||||
@@ -98,7 +99,7 @@ QUnit.test("fmt", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("i18n", assert => {
|
||||
var t = Ember.Object.extend({
|
||||
var t = EmberObject.extend({
|
||||
exclaimyUsername: i18n("username", "!!! %@ !!!"),
|
||||
multiple: i18n("username", "mood", "%@ is %@")
|
||||
}).create({
|
||||
@@ -134,7 +135,7 @@ QUnit.test("i18n", assert => {
|
||||
QUnit.test("url", assert => {
|
||||
var t, testClass;
|
||||
|
||||
testClass = Ember.Object.extend({
|
||||
testClass = EmberObject.extend({
|
||||
userUrl: url("username", "/u/%@")
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Singleton from "discourse/mixins/singleton";
|
||||
|
||||
QUnit.module("mixin:singleton");
|
||||
|
||||
QUnit.test("current", assert => {
|
||||
var DummyModel = Ember.Object.extend({});
|
||||
var DummyModel = EmberObject.extend({});
|
||||
DummyModel.reopenClass(Singleton);
|
||||
|
||||
var current = DummyModel.current();
|
||||
@@ -21,7 +22,7 @@ QUnit.test("current", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("currentProp reading", assert => {
|
||||
var DummyModel = Ember.Object.extend({});
|
||||
var DummyModel = EmberObject.extend({});
|
||||
DummyModel.reopenClass(Singleton);
|
||||
var current = DummyModel.current();
|
||||
|
||||
@@ -38,7 +39,7 @@ QUnit.test("currentProp reading", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("currentProp writing", assert => {
|
||||
var DummyModel = Ember.Object.extend({});
|
||||
var DummyModel = EmberObject.extend({});
|
||||
DummyModel.reopenClass(Singleton);
|
||||
|
||||
assert.blank(
|
||||
@@ -65,7 +66,7 @@ QUnit.test("currentProp writing", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("createCurrent", assert => {
|
||||
var Shoe = Ember.Object.extend({});
|
||||
var Shoe = EmberObject.extend({});
|
||||
Shoe.reopenClass(Singleton, {
|
||||
createCurrent: function() {
|
||||
return Shoe.create({ toes: 5 });
|
||||
@@ -80,7 +81,7 @@ QUnit.test("createCurrent", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("createCurrent that returns null", assert => {
|
||||
var Missing = Ember.Object.extend({});
|
||||
var Missing = EmberObject.extend({});
|
||||
Missing.reopenClass(Singleton, {
|
||||
createCurrent: function() {
|
||||
return null;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import { currentUser } from "helpers/qunit-helpers";
|
||||
import AppEvents from "discourse/services/app-events";
|
||||
import Composer from "discourse/models/composer";
|
||||
@@ -236,7 +237,7 @@ QUnit.test("Title length for private messages", assert => {
|
||||
|
||||
QUnit.test("Post length for private messages with non human users", assert => {
|
||||
const composer = createComposer({
|
||||
topic: Ember.Object.create({ pm_with_non_human_user: true })
|
||||
topic: EmberObject.create({ pm_with_non_human_user: true })
|
||||
});
|
||||
|
||||
assert.equal(composer.get("minimumPostLength"), 1);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Model from "discourse/models/model";
|
||||
|
||||
QUnit.module("model:discourse");
|
||||
@@ -8,10 +9,10 @@ QUnit.test(
|
||||
var firstObject = { id: "id_1", foo: "foo_1" };
|
||||
var secondObject = { id: "id_2", foo: "foo_2" };
|
||||
|
||||
var actual = Model.extractByKey([firstObject, secondObject], Ember.Object);
|
||||
var actual = Model.extractByKey([firstObject, secondObject], EmberObject);
|
||||
var expected = {
|
||||
id_1: Ember.Object.create(firstObject),
|
||||
id_2: Ember.Object.create(secondObject)
|
||||
id_1: EmberObject.create(firstObject),
|
||||
id_2: EmberObject.create(secondObject)
|
||||
};
|
||||
|
||||
assert.ok(_.isEqual(actual, expected));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import { IMAGE_VERSION as v } from "pretty-text/emoji/version";
|
||||
|
||||
QUnit.module("model:topic");
|
||||
@@ -33,7 +34,7 @@ QUnit.test("visited", assert => {
|
||||
});
|
||||
|
||||
QUnit.test("lastUnreadUrl", assert => {
|
||||
const category = Ember.Object.create({
|
||||
const category = EmberObject.create({
|
||||
navigate_to_first_post_after_read: true
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
||||
|
||||
moduleForWidget("post");
|
||||
@@ -861,7 +862,7 @@ widgetTest("pm map", {
|
||||
showTopicMap: true,
|
||||
showPMMap: true,
|
||||
allowedGroups: [],
|
||||
allowedUsers: [Ember.Object.create({ username: "eviltrout" })]
|
||||
allowedUsers: [EmberObject.create({ username: "eviltrout" })]
|
||||
});
|
||||
},
|
||||
test(assert) {
|
||||
|
||||
Reference in New Issue
Block a user