DEV: Update tests to remove/ignore classic-class uses (#29440)
In preparation for https://github.com/discourse/discourse/pull/28610
This commit is contained in:
parent
92a4b17ad8
commit
8ee00dcbd0
|
@ -250,6 +250,7 @@ module("Integration | Component | d-button", function (hooks) {
|
|||
this.set("foo", null);
|
||||
this.set("legacyActionTriggered", () => this.set("foo", "bar"));
|
||||
|
||||
// eslint-disable-next-line ember/no-classic-classes
|
||||
this.classicComponent = ClassicComponent.extend({
|
||||
actions: {
|
||||
myLegacyAction() {
|
||||
|
@ -277,8 +278,9 @@ module("Integration | Component | d-button", function (hooks) {
|
|||
this.set("foo", null);
|
||||
this.set("legacyActionTriggered", () => this.set("foo", "bar"));
|
||||
|
||||
this.simpleWrapperComponent = ClassicComponent.extend();
|
||||
this.simpleWrapperComponent = class extends ClassicComponent {};
|
||||
|
||||
// eslint-disable-next-line ember/no-classic-classes
|
||||
this.classicComponent = ClassicComponent.extend({
|
||||
actions: {
|
||||
myLegacyAction() {
|
||||
|
|
|
@ -76,15 +76,16 @@ module("Unit | Lib | ember-action-modifier", function (hooks) {
|
|||
});
|
||||
|
||||
module("used on a classic component", function (innerHooks) {
|
||||
const ExampleClassicButton = ClassicComponent.extend({
|
||||
tagName: "",
|
||||
onDoSomething: null,
|
||||
class ExampleClassicButton extends ClassicComponent {
|
||||
tagName = "";
|
||||
onDoSomething = null;
|
||||
|
||||
doSomething() {
|
||||
this.onDoSomething?.("doSomething");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line ember/no-classic-classes
|
||||
const ExampleClassicButtonWithActions = ClassicComponent.extend({
|
||||
tagName: "",
|
||||
onDoSomething: null,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import EmberObject from "@ember/object";
|
||||
import EmberObject, { computed } from "@ember/object";
|
||||
import { getOwner } from "@ember/owner";
|
||||
import { setupTest } from "ember-qunit";
|
||||
import { module, test } from "qunit";
|
||||
|
@ -10,11 +10,11 @@ module("Unit | Utility | plugin-api", function (hooks) {
|
|||
setupTest(hooks);
|
||||
|
||||
test("modifyClass works with classic Ember objects", function (assert) {
|
||||
// eslint-disable-next-line ember/no-classic-classes
|
||||
const TestThingy = EmberObject.extend({
|
||||
@discourseComputed
|
||||
prop() {
|
||||
prop: computed(function () {
|
||||
return "hello";
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
getOwner(this).register("test-thingy:main", TestThingy);
|
||||
|
@ -23,10 +23,9 @@ module("Unit | Utility | plugin-api", function (hooks) {
|
|||
api.modifyClass("test-thingy:main", {
|
||||
pluginId: "plugin-api-test",
|
||||
|
||||
@discourseComputed
|
||||
prop() {
|
||||
prop: computed(function () {
|
||||
return `${this._super(...arguments)} there`;
|
||||
},
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -90,11 +89,11 @@ module("Unit | Utility | plugin-api", function (hooks) {
|
|||
});
|
||||
|
||||
test("modifyClass works with getters", function (assert) {
|
||||
let Base = EmberObject.extend({
|
||||
let Base = class extends EmberObject {
|
||||
get foo() {
|
||||
throw new Error("base getter called");
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
getOwner(this).register("test-class:main", Base, {
|
||||
instantiate: false,
|
||||
|
|
|
@ -7,7 +7,7 @@ module("Unit | Mixin | singleton", function (hooks) {
|
|||
setupTest(hooks);
|
||||
|
||||
test("current", function (assert) {
|
||||
let DummyModel = EmberObject.extend({});
|
||||
let DummyModel = class extends EmberObject {};
|
||||
DummyModel.reopenClass(Singleton);
|
||||
|
||||
let current = DummyModel.current();
|
||||
|
@ -25,7 +25,7 @@ module("Unit | Mixin | singleton", function (hooks) {
|
|||
});
|
||||
|
||||
test("currentProp reading", function (assert) {
|
||||
let DummyModel = EmberObject.extend({});
|
||||
let DummyModel = class extends EmberObject {};
|
||||
DummyModel.reopenClass(Singleton);
|
||||
let current = DummyModel.current();
|
||||
|
||||
|
@ -42,7 +42,7 @@ module("Unit | Mixin | singleton", function (hooks) {
|
|||
});
|
||||
|
||||
test("currentProp writing", function (assert) {
|
||||
let DummyModel = EmberObject.extend({});
|
||||
let DummyModel = class extends EmberObject {};
|
||||
DummyModel.reopenClass(Singleton);
|
||||
|
||||
assert.blank(
|
||||
|
@ -73,7 +73,7 @@ module("Unit | Mixin | singleton", function (hooks) {
|
|||
});
|
||||
|
||||
test("createCurrent", function (assert) {
|
||||
let Shoe = EmberObject.extend({});
|
||||
let Shoe = class extends EmberObject {};
|
||||
Shoe.reopenClass(Singleton, {
|
||||
createCurrent: function () {
|
||||
return Shoe.create({ toes: 5 });
|
||||
|
@ -88,7 +88,7 @@ module("Unit | Mixin | singleton", function (hooks) {
|
|||
});
|
||||
|
||||
test("createCurrent that returns null", function (assert) {
|
||||
let Missing = EmberObject.extend({});
|
||||
let Missing = class extends EmberObject {};
|
||||
Missing.reopenClass(Singleton, {
|
||||
createCurrent: function () {
|
||||
return null;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// eslint-disable ember/no-classic-classes
|
||||
|
||||
import Component from "@ember/component";
|
||||
import EmberObject from "@ember/object";
|
||||
import { clearRender, render, settled } from "@ember/test-helpers";
|
||||
|
|
|
@ -14,6 +14,7 @@ class BarService extends Service {
|
|||
name = "bar";
|
||||
}
|
||||
|
||||
// eslint-disable-next-line ember/no-classic-classes
|
||||
const EmberObjectComponent = Component.extend({
|
||||
name: "",
|
||||
layout: hbs`<span class="ember-object-component">{{this.foo.name}} {{this.baz.name}}</span>`,
|
||||
|
|
Loading…
Reference in New Issue