Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patocallaghan committed Feb 27, 2021
1 parent 8eb00a1 commit d946d29
Show file tree
Hide file tree
Showing 70 changed files with 856 additions and 329 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ moduleFor(
class extends ApplicationTestCase {
constructor() {
setDebugFunction('debug', () => {});
expectDeprecation('Usage of `renderTemplate` is deprecated.');
super();
this.adapter = this.application.__deprecatedInstance__.lookup('container-debug-adapter:main');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ const DataAdapter = EmberDataAdapter.extend({
moduleFor(
'Data Adapter',
class extends ApplicationTestCase {
constructor() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');
super();
}

teardown() {
super.teardown();
adapter = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ moduleFor(
'Application test: actions',
class extends ApplicationTestCase {
constructor() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');
setDebugFunction('debug', noop);
super(...arguments);
}
Expand All @@ -23,7 +24,7 @@ moduleFor(
['@test actions in top level template application template target application controller'](
assert
) {
assert.expect(1);
assert.expect(2);

this.add(
'controller:application',
Expand All @@ -47,7 +48,7 @@ moduleFor(
}

['@test actions in nested outlet template target their controller'](assert) {
assert.expect(1);
assert.expect(2);

this.add(
'controller:application',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ if (ENV._DEBUG_RENDER_TREE) {

constructor() {
super(...arguments);
expectDeprecation('Usage of `renderTemplate` is deprecated.');
this._TEMPLATE_ONLY_GLIMMER_COMPONENTS = ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ moduleFor(
expectDeprecation(
'Using {{attrs}} to reference named arguments has been deprecated. {{attrs.wat}} should be updated to {{@wat}}. (L1:C2) '
);
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupEngineWithAttrs([]);

Expand All @@ -284,7 +285,7 @@ moduleFor(
}

['@test sharing a template between engine and application has separate refinements']() {
this.assert.expect(2);
this.assert.expect(3);

let sharedTemplate = compile(strip`
<h1>{{this.contextType}}</h1>
Expand All @@ -296,6 +297,7 @@ moduleFor(
expectDeprecation(
/The `[^`]+` property(?: path)? was used in a template for the `[^`]+` component without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.add('template:application', sharedTemplate);
this.add(
Expand Down Expand Up @@ -342,11 +344,12 @@ moduleFor(
}

['@test sharing a layout between engine and application has separate refinements']() {
this.assert.expect(2);
this.assert.expect(3);

expectDeprecation(
/The `[^`]+` property(?: path)? was used in a template for the `[^`]+` component without using `this`. This fallback behavior has been deprecated, all properties must be looked up on `this` when used in the template: {{[^}]+}}/
);
expectDeprecation('Usage of `renderTemplate` is deprecated.');

let sharedLayout = compile(strip`
{{ambiguous-curlies}}
Expand Down Expand Up @@ -406,10 +409,12 @@ moduleFor(
['@test visit() with `shouldRender: true` returns a promise that resolves when application and engine templates have rendered'](
assert
) {
assert.expect(2);
assert.expect(3);

let hooks = [];

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine(hooks);

return this.visit('/blog', { shouldRender: true }).then(() => {
Expand Down Expand Up @@ -450,10 +455,12 @@ moduleFor(
['@test visit() with `shouldRender: true` returns a promise that resolves when application and routeless engine templates have rendered'](
assert
) {
assert.expect(2);
assert.expect(3);

let hooks = [];

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutelessEngine(hooks);

return this.visit('/', { shouldRender: true }).then(() => {
Expand All @@ -468,11 +475,12 @@ moduleFor(
}

['@test visit() with partials in routable engine'](assert) {
assert.expect(3);
assert.expect(4);

expectDeprecation(
`The use of \`{{partial}}\` is deprecated, please refactor the "foo" partial to a component`
);
expectDeprecation('Usage of `renderTemplate` is deprecated.');

let hooks = [];

Expand All @@ -490,11 +498,12 @@ moduleFor(
}

['@test visit() with partials in non-routable engine'](assert) {
assert.expect(3);
assert.expect(4);

expectDeprecation(
`The use of \`{{partial}}\` is deprecated, please refactor the "foo" partial to a component`
);
expectDeprecation('Usage of `renderTemplate` is deprecated.');

let hooks = [];

Expand All @@ -512,7 +521,9 @@ moduleFor(
}

['@test deactivate should be called on Engine Routes before destruction'](assert) {
assert.expect(3);
assert.expect(4);

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();

Expand Down Expand Up @@ -543,6 +554,8 @@ moduleFor(
}

['@test engine should lookup and use correct controller']() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();

return this.visit('/blog?lang=English').then(() => {
Expand All @@ -551,10 +564,12 @@ moduleFor(
}

['@test error substate route works for the application route of an Engine'](assert) {
assert.expect(2);
assert.expect(3);

let errorEntered = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register(
Expand Down Expand Up @@ -590,10 +605,12 @@ moduleFor(
}

['@test error route works for the application route of an Engine'](assert) {
assert.expect(2);
assert.expect(3);

let errorEntered = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register(
Expand Down Expand Up @@ -629,10 +646,12 @@ moduleFor(
}

['@test error substate route works for a child route of an Engine'](assert) {
assert.expect(2);
assert.expect(3);

let errorEntered = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register(
Expand Down Expand Up @@ -668,10 +687,12 @@ moduleFor(
}

['@test error route works for a child route of an Engine'](assert) {
assert.expect(2);
assert.expect(3);

let errorEntered = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register(
Expand Down Expand Up @@ -707,12 +728,14 @@ moduleFor(
}

['@test loading substate route works for the application route of an Engine'](assert) {
assert.expect(3);
assert.expect(4);
let done = assert.async();

let loadingEntered = RSVP.defer();
let resolveLoading = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register(
Expand Down Expand Up @@ -754,12 +777,14 @@ moduleFor(
}

['@test loading route works for the application route of an Engine'](assert) {
assert.expect(3);
assert.expect(4);
let done = assert.async();

let loadingEntered = RSVP.defer();
let resolveLoading = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register(
Expand Down Expand Up @@ -801,10 +826,12 @@ moduleFor(
}

['@test loading substate route works for a child route of an Engine'](assert) {
assert.expect(3);
assert.expect(4);

let resolveLoading;

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register('template:post', compile('{{outlet}}'));
Expand Down Expand Up @@ -839,12 +866,14 @@ moduleFor(
}

['@test loading route works for a child route of an Engine'](assert) {
assert.expect(3);
assert.expect(4);
let done = assert.async();

let loadingEntered = RSVP.defer();
let resolveLoading = RSVP.defer();

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register('template:post', compile('{{outlet}}'));
Expand Down Expand Up @@ -888,10 +917,12 @@ moduleFor(
}

["@test query params don't have stickiness by default between model"](assert) {
assert.expect(1);
assert.expect(2);

let tmpl = '<LinkTo @route="category" @model={{1337}}>Category 1337</LinkTo>';

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register('template:category', compile(tmpl));
Expand All @@ -907,10 +938,12 @@ moduleFor(
}

'@test query params only transitions work properly'(assert) {
assert.expect(1);
assert.expect(2);

let tmpl = '<LinkTo @query={{hash type="news"}}>News</LinkTo>';

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register('template:category', compile(tmpl));
Expand All @@ -928,9 +961,10 @@ moduleFor(
async ['@test query params in customized controllerName have stickiness by default between model'](
assert
) {
assert.expect(2);
assert.expect(3);
let tmpl =
'<LinkTo @route="author" @model={{1337}} class="author-1337">Author 1337</LinkTo><LinkTo @route="author" @model=1 class="author-1">Author 1</LinkTo>';
expectDeprecation('Usage of `renderTemplate` is deprecated.');
this.setupAppAndRoutableEngine();
this.additionalEngineRegistrations(function () {
this.register('template:author', compile(tmpl));
Expand All @@ -949,7 +983,7 @@ moduleFor(
}

['@test visit() routable engine which errors on init'](assert) {
assert.expect(1);
assert.expect(2);

let hooks = [];

Expand All @@ -964,6 +998,8 @@ moduleFor(
);
});

expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.setupAppAndRoutableEngine(hooks);

return this.visit('/', { shouldRender: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ moduleFor(
'Application Lifecycle - Helper Registration',
class extends ApplicationTestCase {
['@test Unbound dashed helpers registered on the container can be late-invoked'](assert) {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.addTemplate('application', `<div id='wrapper'>{{x-borf}} {{x-borf 'YES'}}</div>`);

let myHelper = helper((params) => params[0] || 'BORF');
Expand All @@ -22,6 +24,8 @@ moduleFor(
}

['@test Bound helpers registered on the container can be late-invoked'](assert) {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.addTemplate(
'application',
`<div id='wrapper'>{{x-reverse}} {{x-reverse this.foo}}</div>`
Expand Down Expand Up @@ -51,6 +55,8 @@ moduleFor(
}

['@test Undashed helpers registered on the container can be invoked'](assert) {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.addTemplate(
'application',
`<div id='wrapper'>{{omg}}|{{yorp 'boo'}}|{{yorp 'ya'}}</div>`
Expand All @@ -76,6 +82,8 @@ moduleFor(
}

['@test Helpers can receive injections'](assert) {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.addTemplate('application', `<div id='wrapper'>{{full-name}}</div>`);

let serviceCalled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ moduleFor(
}

['@test hot reloading template-only components']() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.addTemplate(
'application',
strip`
Expand Down Expand Up @@ -170,6 +172,8 @@ moduleFor(
}

['@test hot reloading class-based components']() {
expectDeprecation('Usage of `renderTemplate` is deprecated.');

this.addTemplate(
'application',
strip`
Expand Down
Loading

0 comments on commit d946d29

Please sign in to comment.