mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Deprecate controllerFor
test helper (#19606)
After all the test changes it was only used in a single place in core 🤷
(also updated the recommendation in `assert.not` deprecation message)
This commit is contained in:
parent
64dcd44c94
commit
953b823c5a
@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
controllerFor,
|
|
||||||
count,
|
count,
|
||||||
exists,
|
exists,
|
||||||
query,
|
query,
|
||||||
@ -11,6 +10,7 @@ import I18n from "I18n";
|
|||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import { registerTemporaryModule } from "../helpers/temporary-module-helper";
|
import { registerTemporaryModule } from "../helpers/temporary-module-helper";
|
||||||
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
|
||||||
acceptance("Modal", function (needs) {
|
acceptance("Modal", function (needs) {
|
||||||
let _translations;
|
let _translations;
|
||||||
@ -38,7 +38,7 @@ acceptance("Modal", function (needs) {
|
|||||||
await click(".login-button");
|
await click(".login-button");
|
||||||
assert.strictEqual(count(".d-modal:visible"), 1, "modal should appear");
|
assert.strictEqual(count(".d-modal:visible"), 1, "modal should appear");
|
||||||
|
|
||||||
let controller = controllerFor("modal");
|
const controller = getOwner(this).lookup("controller:modal");
|
||||||
assert.strictEqual(controller.name, "login");
|
assert.strictEqual(controller.name, "login");
|
||||||
|
|
||||||
await click(".modal-outer-container");
|
await click(".modal-outer-container");
|
||||||
|
@ -397,6 +397,14 @@ export function acceptance(name, optionsOrCallback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function controllerFor(controller, model) {
|
export function controllerFor(controller, model) {
|
||||||
|
deprecated(
|
||||||
|
'controllerFor is deprecated. Use the standard `getOwner(this).lookup("controller:NAME")` instead',
|
||||||
|
{
|
||||||
|
id: "controller-for",
|
||||||
|
since: "3.0.0.beta14",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
controller = getOwner(this).lookup("controller:" + controller);
|
controller = getOwner(this).lookup("controller:" + controller);
|
||||||
if (model) {
|
if (model) {
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
@ -412,7 +420,7 @@ export function fixture(selector) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QUnit.assert.not = function (actual, message) {
|
QUnit.assert.not = function (actual, message) {
|
||||||
deprecated("assert.not() is deprecated. Use assert.notOk() instead.", {
|
deprecated("assert.not() is deprecated. Use assert.false() instead.", {
|
||||||
since: "2.9.0.beta1",
|
since: "2.9.0.beta1",
|
||||||
dropFrom: "2.10.0.beta1",
|
dropFrom: "2.10.0.beta1",
|
||||||
id: "discourse.qunit.assert-not",
|
id: "discourse.qunit.assert-not",
|
||||||
|
Loading…
Reference in New Issue
Block a user