Skip to content

Commit

Permalink
Merge pull request #19361 from emberjs/cleanup/update-tests-remove-pr…
Browse files Browse the repository at this point in the history
…operty-fallback-usages
  • Loading branch information
rwjblue authored Jan 29, 2021
2 parents 0f49c4e + 7252371 commit a7e016c
Show file tree
Hide file tree
Showing 78 changed files with 1,021 additions and 947 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ moduleFor(
queryParams: ['official'],
})
);
this.register('template:application', compile('Engine{{lang}}{{outlet}}'));
this.register('template:application', compile('Engine{{this.lang}}{{outlet}}'));
this.register(
'route:application',
Route.extend({
Expand Down Expand Up @@ -255,7 +255,10 @@ moduleFor(
contextType: 'Engine',
})
);
this.register('template:application', compile('Engine {{foo-bar wat=contextType}}'));
this.register(
'template:application',
compile('Engine {{foo-bar wat=this.contextType}}')
);
},
})
);
Expand All @@ -281,7 +284,7 @@ moduleFor(
this.assert.expect(1);

let sharedTemplate = compile(strip`
<h1>{{contextType}}</h1>
<h1>{{this.contextType}}</h1>
{{ambiguous-curlies}}
{{outlet}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ moduleFor(
}

['@test Bound helpers registered on the container can be late-invoked'](assert) {
this.addTemplate('application', `<div id='wrapper'>{{x-reverse}} {{x-reverse foo}}</div>`);
this.addTemplate(
'application',
`<div id='wrapper'>{{x-reverse}} {{x-reverse this.foo}}</div>`
);

this.add(
'controller:application',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ moduleFor(
})
);

this.addTemplate('a', '{{value}}');
this.addTemplate('b', '{{value}}');
this.addTemplate('a', '{{this.value}}');
this.addTemplate('b', '{{this.value}}');

return this.visit('/a')
.then(() => {
Expand Down Expand Up @@ -610,7 +610,7 @@ moduleFor(
})
);

this.addTemplate('color', 'model color: {{@model.color}}, controller color: {{color}}');
this.addTemplate('color', 'model color: {{@model.color}}, controller color: {{this.color}}');

return this.visit('/colors/red')
.then(() => {
Expand Down Expand Up @@ -661,7 +661,7 @@ moduleFor(
})
);

this.addTemplate('common', '{{prefix}} {{@model}}');
this.addTemplate('common', '{{this.prefix}} {{@model}}');

return this.visit('/a')
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ moduleFor(

'@test it can render a basic component with template and javascript'() {
this.registerComponent('foo-bar', {
template: 'FIZZ BAR {{local}}',
template: 'FIZZ BAR {{this.local}}',
ComponentClass: Component.extend({ local: 'hey' }),
});

Expand Down Expand Up @@ -120,9 +120,9 @@ moduleFor(
}

'@test it can have a custom id and it is not bound'() {
this.registerComponent('foo-bar', { template: '{{id}} {{elementId}}' });
this.registerComponent('foo-bar', { template: '{{this.id}} {{this.elementId}}' });

this.render('<FooBar @id={{customId}} />', {
this.render('<FooBar @id={{this.customId}} />', {
customId: 'bizz',
});

Expand Down Expand Up @@ -154,7 +154,7 @@ moduleFor(
'@test it can have a custom id attribute and it is bound'() {
this.registerComponent('foo-bar', { template: 'hello' });

this.render('<FooBar id={{customId}} />', {
this.render('<FooBar id={{this.customId}} />', {
customId: 'bizz',
});

Expand Down Expand Up @@ -256,7 +256,7 @@ moduleFor(
'@test class property on components can be dynamic'() {
this.registerComponent('foo-bar', { template: 'hello' });

this.render('<FooBar @class={{if fooBar "foo-bar"}} />', {
this.render('<FooBar @class={{if this.fooBar "foo-bar"}} />', {
fooBar: true,
});

Expand Down Expand Up @@ -441,7 +441,7 @@ moduleFor(

'@test it reflects named arguments as properties'() {
this.registerComponent('foo-bar', {
template: '{{foo}}',
template: '{{this.foo}}',
});

this.render('<FooBar @foo={{this.model.bar}} />', {
Expand Down Expand Up @@ -496,11 +496,11 @@ moduleFor(

this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: '{{yield greeting greetee.firstName}}',
template: '{{yield this.greeting this.greetee.firstName}}',
});

this.render(
'<FooBar @greetee={{person}} as |greeting name|>{{name}} {{person.lastName}}, {{greeting}}</FooBar>',
'<FooBar @greetee={{this.person}} as |greeting name|>{{name}} {{this.person.lastName}}, {{greeting}}</FooBar>',
{
person: {
firstName: 'Joel',
Expand Down Expand Up @@ -554,7 +554,7 @@ moduleFor(
ComponentClass: Component.extend().reopenClass({
positionalParams: ['first', 'second'],
}),
template: '{{first}}{{second}}',
template: '{{this.first}}{{this.second}}',
});

// this is somewhat silly as the browser "corrects" for these as
Expand Down Expand Up @@ -646,7 +646,10 @@ moduleFor(
template: 'hello',
});

this.render('<FooBar data-foo={{foo}} data-bar={{bar}} />', { foo: 'foo', bar: 'bar' });
this.render('<FooBar data-foo={{this.foo}} data-bar={{this.bar}} />', {
foo: 'foo',
bar: 'bar',
});

this.assertComponentElement(this.firstChild, {
tagName: 'div',
Expand Down Expand Up @@ -725,7 +728,10 @@ moduleFor(
template: '<div ...attributes>hello</div>',
});

this.render('<FooBar data-foo={{foo}} data-bar={{bar}} />', { foo: 'foo', bar: 'bar' });
this.render('<FooBar data-foo={{this.foo}} data-bar={{this.bar}} />', {
foo: 'foo',
bar: 'bar',
});

this.assertElement(this.firstChild, {
tagName: 'div',
Expand Down Expand Up @@ -775,10 +781,13 @@ moduleFor(
this.localProp = 'qux';
},
}),
template: '<div data-derp={{localProp}} ...attributes>hello</div>',
template: '<div data-derp={{this.localProp}} ...attributes>hello</div>',
});

this.render('<FooBar data-foo={{foo}} data-bar={{bar}} />', { foo: 'foo', bar: 'bar' });
this.render('<FooBar data-foo={{this.foo}} data-bar={{this.bar}} />', {
foo: 'foo',
bar: 'bar',
});

this.assertElement(this.firstChild, {
tagName: 'div',
Expand Down Expand Up @@ -830,10 +839,10 @@ moduleFor(
this.localProp = 'qux';
},
}),
template: '<div class={{localProp}} ...attributes>hello</div>',
template: '<div class={{this.localProp}} ...attributes>hello</div>',
});

this.render('<FooBar class={{bar}} />', { bar: 'bar' });
this.render('<FooBar class={{this.bar}} />', { bar: 'bar' });

this.assertElement(this.firstChild, {
tagName: 'div',
Expand Down Expand Up @@ -883,10 +892,10 @@ moduleFor(
this.localProp = 'qux';
},
}),
template: '<div ...attributes class={{localProp}}>hello</div>',
template: '<div ...attributes class={{this.localProp}}>hello</div>',
});

this.render('<FooBar class={{bar}} />', { bar: 'bar' });
this.render('<FooBar class={{this.bar}} />', { bar: 'bar' });

this.assertElement(this.firstChild, {
tagName: 'div',
Expand Down Expand Up @@ -1052,7 +1061,10 @@ moduleFor(
template: '<div ...attributes>hello</div><p ...attributes>world</p>',
});

this.render('<FooBar data-foo={{foo}} data-bar={{bar}} />', { foo: 'foo', bar: 'bar' });
this.render('<FooBar data-foo={{this.foo}} data-bar={{this.bar}} />', {
foo: 'foo',
bar: 'bar',
});

this.assertElement(this.firstChild, {
tagName: 'div',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,16 @@ class AbstractAppendTest extends RenderingTestCase {
layoutName: 'components/x-parent',
}),

template: '[parent: {{foo}}]{{#x-child bar=foo}}[yielded: {{foo}}]{{/x-child}}',
template:
'[parent: {{this.foo}}]{{#x-child bar=this.foo}}[yielded: {{this.foo}}]{{/x-child}}',
});

this.registerComponent('x-child', {
ComponentClass: Component.extend({
tagName: '',
}),

template: '[child: {{bar}}]{{yield}}',
template: '[child: {{this.bar}}]{{yield}}',
});

let XParent;
Expand Down Expand Up @@ -293,15 +294,16 @@ class AbstractAppendTest extends RenderingTestCase {
},
}),

template: '[parent: {{foo}}]{{#x-child bar=foo}}[yielded: {{foo}}]{{/x-child}}',
template:
'[parent: {{this.foo}}]{{#x-child bar=this.foo}}[yielded: {{this.foo}}]{{/x-child}}',
});

this.registerComponent('x-child', {
ComponentClass: Component.extend({
tagName: '',
}),

template: '[child: {{bar}}]{{yield}}',
template: '[child: {{this.bar}}]{{yield}}',
});

let XParent;
Expand Down Expand Up @@ -399,7 +401,7 @@ class AbstractAppendTest extends RenderingTestCase {
},
}),

template: 'x-first {{foo}}!',
template: 'x-first {{this.foo}}!',
});

this.registerComponent('x-second', {
Expand All @@ -411,7 +413,7 @@ class AbstractAppendTest extends RenderingTestCase {
},
}),

template: 'x-second {{bar}}!',
template: 'x-second {{this.bar}}!',
});

let First, Second;
Expand Down Expand Up @@ -630,7 +632,7 @@ class AbstractAppendTest extends RenderingTestCase {
let destroyedRoots = 0;
this.registerComponent('other-root', {
ComponentClass: Component.extend({
layout: compile(`fake-thing: {{counter}}`),
layout: compile(`fake-thing: {{this.counter}}`),
init() {
this._super(...arguments);
this.counter = instantiatedRoots++;
Expand All @@ -644,7 +646,7 @@ class AbstractAppendTest extends RenderingTestCase {

this.render(
strip`
{{#if showFooBar}}
{{#if this.showFooBar}}
{{foo-bar}}
{{else}}
{{baz-qux}}
Expand Down
Loading

0 comments on commit a7e016c

Please sign in to comment.