Skip to content

Commit

Permalink
Revert "Remove tests for code that was supposed to be removed in v4"
Browse files Browse the repository at this point in the history
This reverts commit 6bce2f9.
  • Loading branch information
NullVoxPopuli committed Mar 27, 2024
1 parent 3ac6abc commit d328f73
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ moduleFor(

['@test non-block with properties on this.attrs']() {
this.registerComponent('non-block', {
template: 'In layout - someProp: {{@someProp}}',
template: 'In layout - someProp: {{this.attrs.someProp}}{{log this.attrs}}',
});

this.render('{{non-block someProp=this.prop}}', {
Expand Down Expand Up @@ -1476,10 +1476,13 @@ moduleFor(
);
}

['@test @foo === foo']() {
['@test this.attrs.foo === @foo === foo']() {
this.registerComponent('foo-bar', {
template: strip`
Args: {{@value}} | {{this.value}}
Args: {{this.attrs.value}} | {{@value}} | {{this.value}}
{{#each this.attrs.items as |item|}}
{{item}}
{{/each}}
{{#each @items as |item|}}
{{item}}
{{/each}}
Expand All @@ -1503,11 +1506,11 @@ moduleFor(
this.context.set('model.items', [1]);
});

this.assertText(strip`Args: lul | lul11`);
this.assertText(strip`Args: lul | lul | lul111`);

runTask(() => this.context.set('model', { value: 'wat', items: [1, 2, 3] }));

this.assertText('Args: wat | wat123123');
this.assertText('Args: wat | wat | wat123123123');
}

['@test non-block with properties on self']() {
Expand Down Expand Up @@ -1572,6 +1575,36 @@ moduleFor(
}, "Using {{attrs}} to reference named arguments is not supported. {{attrs.someProp}} should be updated to {{@someProp}}. ('my-app/templates/components/with-block.hbs' @ L1:C24) ");
}

['@test block with properties on this.attrs']() {
this.registerComponent('with-block', {
template: 'In layout - someProp: {{this.attrs.someProp}} - {{yield}}',
});

this.render(
strip`
{{#with-block someProp=this.prop}}
In template
{{/with-block}}`,
{
prop: 'something here',
}
);

this.assertText('In layout - someProp: something here - In template');

runTask(() => this.rerender());

this.assertText('In layout - someProp: something here - In template');

runTask(() => this.context.set('prop', 'something else'));

this.assertText('In layout - someProp: something else - In template');

runTask(() => this.context.set('prop', 'something here'));

this.assertText('In layout - someProp: something here - In template');
}

['@test block with named argument']() {
this.registerComponent('with-block', {
template: 'In layout - someProp: {{@someProp}} - {{yield}}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default function assertAgainstAttrs(env: EmberASTPluginEnvironment): ASTP
stack.push(parent.concat(blockParams));
}

// https://deprecations.emberjs.com/v3.x#toc_attrs-arg-access
return {
name: 'assert-against-attrs',

Expand Down

0 comments on commit d328f73

Please sign in to comment.