Skip to content

Commit

Permalink
Down to 13
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Apr 25, 2024
1 parent 4ac5332 commit 8314402
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ moduleFor(
this.registerComponent('non-block', {
template: 'In layout - someProp: {{attrs.someProp}}',
});
}, "Using {{attrs}} to reference named arguments is not supported. {{attrs.someProp}} should be updated to {{@someProp}}. ('my-app/templates/components/non-block.hbs' @ L1:C24) ");
}, 'Using {{attrs}} to reference named arguments is not supported. {{attrs.someProp}} should be updated to {{@someProp}}. (L1:C24) ');
}

// Perhaps change this test to `{{this.attrs.someProp.value}}` when removing the deprecation?
Expand Down Expand Up @@ -1579,7 +1579,7 @@ moduleFor(
this.registerComponent('with-block', {
template: 'In layout - someProp: {{attrs.someProp}} - {{yield}}',
});
}, "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) ");
}, 'Using {{attrs}} to reference named arguments is not supported. {{attrs.someProp}} should be updated to {{@someProp}}. (L1:C24) ');
}

// Perhaps change this test to `{{this.attrs.someProp.value}}` when removing the deprecation?
Expand Down Expand Up @@ -3325,7 +3325,7 @@ moduleFor(
template:
'MyVar1: {{attrs.myVar}} {{this.myVar}} MyVar2: {{this.myVar2}} {{attrs.myVar2}}',
});
}, "Using {{attrs}} to reference named arguments is not supported. {{attrs.myVar}} should be updated to {{@myVar}}. ('my-app/templates/components/foo-bar.hbs' @ L1:C10) ");
}, 'Using {{attrs}} to reference named arguments is not supported. {{attrs.myVar}} should be updated to {{@myVar}}. (L1:C10) ');
}

// Perhaps change this test to `{{this.attrs.myVar.value}}` when removing the deprecation?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ moduleFor(
}

['@test it can have no template context']() {
let ComponentClass = setComponentManager(() => {
class ComponentWithNoTemplate {}
setComponentManager(() => {
return EmberObject.create({
capabilities: componentCapabilities('3.13'),

Expand All @@ -131,11 +132,11 @@ moduleFor(
return null;
},
});
}, {});
}, ComponentWithNoTemplate);

this.registerComponent('foo-bar', {
template: `<p>{{@greeting}} world</p>`,
ComponentClass,
ComponentClass: ComponentWithNoTemplate,
});

this.render('{{foo-bar greeting="hello"}}');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import {
runDestroy,
runAppend,
runTask,
testUnless,
expectDeprecation,
} from 'internal-test-helpers';

import { set } from '@ember/object';
import { templateCacheCounters } from '@ember/-internals/glimmer';
import { Component } from '../utils/helpers';
import { DEPRECATIONS } from '../../../deprecations';

moduleFor(
'ember-glimmer runtime resolver cache',
Expand Down Expand Up @@ -122,9 +125,12 @@ moduleFor(
this.expectCacheChanges({}, 'toggle back to component-two no change');
}

['@test each template is only compiled once']() {
[`${testUnless(
DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isRemoved
)} each template is only compiled once`]() {
expectDeprecation(/msg here/, DEPRECATIONS.DEPRECATE_COMPONENT_TEMPLATE_RESOLVING.isEnabled);
// static layout
this.registerComponent('component-one', { template: 'One' });
this.registerComponent('component-one', { resolveableTemplate: 'One' });

// test directly import template factory onto late bound layout
let Two = Component.extend({
Expand Down
10 changes: 7 additions & 3 deletions packages/internal-test-helpers/lib/test-cases/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,16 @@ export default abstract class RenderingTestCase extends AbstractTestCase {
let { owner } = this;

if (ComponentClass) {
let stateContainer = class extends ComponentClass {};
// We cannot set templates multiple times on a class
if (ComponentClass === Component) {
// @ts-expect-error - class/instance types in TS are hard
ComponentClass = class extends Component {};
}

owner.register(`component:${name}`, stateContainer);
owner.register(`component:${name}`, ComponentClass);

if (typeof template === 'string') {
setComponentTemplate(this.compile(template), stateContainer);
setComponentTemplate(this.compile(template), ComponentClass);
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@

QUnit.config.urlConfig.push({
id: 'overridedeprecationversion',
value: '20.0.0',
label: 'Enable all deprecations',
value: ['20.0.0', '6.0.0', '5.12.0'],
label: 'Deprecation Version',
});


Expand Down

0 comments on commit 8314402

Please sign in to comment.