Skip to content

Commit

Permalink
Merge pull request #1258 from glimmerjs/cleanup/remove-property-fallb…
Browse files Browse the repository at this point in the history
…ack-usage-in-tests
  • Loading branch information
rwjblue authored Jan 29, 2021
2 parents 36f6887 + dff9d99 commit 8224439
Show file tree
Hide file tree
Showing 30 changed files with 531 additions and 457 deletions.
4 changes: 2 additions & 2 deletions packages/@glimmer/integration-tests/lib/render-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ export class RenderTest implements IRenderTest {

let invocation: string | string[] = [];
if (template) {
invocation.push('{{#component componentName');
invocation.push('{{#component this.componentName');
} else {
invocation.push('{{component componentName');
invocation.push('{{component this.componentName');
}

let componentArgs = this.buildArgs(args);
Expand Down
47 changes: 26 additions & 21 deletions packages/@glimmer/integration-tests/lib/suites/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class TemplateOnlyComponents extends RenderTest {
name: 'MyComponent',
layout: '{{yield}} - {{@color}}',
template: 'hello!',
args: { color: 'color' },
args: { color: 'this.color' },
},
{ color: 'red' }
);
Expand All @@ -45,8 +45,8 @@ export class TemplateOnlyComponents extends RenderTest {
name: 'MyComponent',
layout: '<div><span ...attributes>{{yield}} - {{@color}}</span></div>',
template: 'hello!',
args: { color: 'color' },
attributes: { color: '{{color}}' },
args: { color: 'this.color' },
attributes: { color: '{{this.color}}' },
},
{ color: 'red' }
);
Expand Down Expand Up @@ -223,7 +223,7 @@ export class GlimmerishComponents extends RenderTest {
this.registerComponent(
'Glimmer',
'Foo',
'<div ...attributes>[{{localProperty}} {{@staticNamedArg}} {{@dynamicNamedArg}}]</div>',
'<div ...attributes>[{{this.localProperty}} {{@staticNamedArg}} {{@dynamicNamedArg}}]</div>',
Foo
);

Expand All @@ -232,7 +232,7 @@ export class GlimmerishComponents extends RenderTest {
layout: stripTight`<@foo @staticNamedArg="static" data-test1={{@outerArg}} data-test2="static" @dynamicNamedArg={{@outerArg}} />`,
args: {
foo: 'component "Foo"',
outerArg: 'outer',
outerArg: 'this.outer',
},
},
{ outer: 'outer' }
Expand Down Expand Up @@ -345,11 +345,11 @@ export class GlimmerishComponents extends RenderTest {
this.registerComponent(
'Glimmer',
'Foo',
'<div ...attributes>[{{localProperty}} {{@staticNamedArg}} {{@dynamicNamedArg}}] - {{yield}}</div>',
'<div ...attributes>[{{this.localProperty}} {{@staticNamedArg}} {{@dynamicNamedArg}}] - {{yield}}</div>',
Foo
);
this.render(
`{{#with (component 'Foo') as |Other|}}<Other @staticNamedArg="static" data-test1={{outer}} data-test2="static" @dynamicNamedArg={{outer}}>template</Other>{{/with}}`,
`{{#with (component 'Foo') as |Other|}}<Other @staticNamedArg="static" data-test1={{this.outer}} data-test2="static" @dynamicNamedArg={{this.outer}}>template</Other>{{/with}}`,
{ outer: 'outer' }
);

Expand Down Expand Up @@ -519,10 +519,12 @@ export class GlimmerishComponents extends RenderTest {
this.registerComponent(
'Glimmer',
'Foo',
'<div ...attributes>[{{localProperty}} {{@staticNamedArg}} {{@dynamicNamedArg}}] - {{yield}}</div>',
'<div ...attributes>[{{this.localProperty}} {{@staticNamedArg}} {{@dynamicNamedArg}}] - {{yield}}</div>',
Foo
);
this.render('<TestHarness @outer={{outer}} @Foo={{component "Foo"}} />', { outer: 'outer' });
this.render('<TestHarness @outer={{this.outer}} @Foo={{component "Foo"}} />', {
outer: 'outer',
});

this.assertHTML(
`<div data-test1="outer" data-test2="static">[local static outer] - template</div>`
Expand Down Expand Up @@ -625,7 +627,7 @@ export class GlimmerishComponents extends RenderTest {
this.registerComponent(
'Glimmer',
'Main',
'<div><HelloWorld @name={{salutation}} /></div>',
'<div><HelloWorld @name={{this.salutation}} /></div>',
MainComponent
);
this.registerComponent('Glimmer', 'HelloWorld', '<h1>Hello {{@name}}!</h1>');
Expand Down Expand Up @@ -666,7 +668,7 @@ export class GlimmerishComponents extends RenderTest {
);
this.registerComponent('Glimmer', 'HelloWorld', '{{yield (component "A" a=@a)}}');
this.registerComponent('Glimmer', 'A', 'A {{@a}}');
this.render('<Main @a={{a}} />', { a: 'a' });
this.render('<Main @a={{this.a}} />', { a: 'a' });
this.assertHTML('<div>A a</div>');
this.assertStableRerender();
this.rerender({ a: 'A' });
Expand All @@ -682,7 +684,7 @@ export class GlimmerishComponents extends RenderTest {
'A {{#component "B" arg1=@one arg2=@two arg3=@three}}{{/component}}'
);
this.registerComponent('Glimmer', 'B', 'B {{@arg1}} {{@arg2}} {{@arg3}}');
this.render('<A @one={{first}} @two={{second}} @three={{third}} />', {
this.render('<A @one={{this.first}} @two={{this.second}} @three={{this.third}} />', {
first: 1,
second: 2,
third: 3,
Expand All @@ -698,7 +700,7 @@ export class GlimmerishComponents extends RenderTest {
'Static inline component helper'() {
this.registerComponent('Glimmer', 'A', 'A {{component "B" arg1=@one arg2=@two arg3=@three}}');
this.registerComponent('Glimmer', 'B', 'B {{@arg1}} {{@arg2}} {{@arg3}}');
this.render('<A @one={{first}} @two={{second}} @three={{third}} />', {
this.render('<A @one={{this.first}} @two={{this.second}} @three={{this.third}} />', {
first: 1,
second: 2,
third: 3,
Expand All @@ -719,7 +721,7 @@ export class GlimmerishComponents extends RenderTest {

this.render(
strip`
{{#each components key="id" as |c|}}
{{#each this.components key="id" as |c|}}
{{#in-element c.mount}}
{{component c.name childName=c.child data=c.data}}
{{/in-element}}
Expand Down Expand Up @@ -755,7 +757,7 @@ export class GlimmerishComponents extends RenderTest {
this.registerComponent(
'Glimmer',
'RecursiveInvoker',
'{{id}}{{#if showChildren}}<RecursiveInvoker />{{/if}}',
'{{this.id}}{{#if this.showChildren}}<RecursiveInvoker />{{/if}}',
RecursiveInvoker
);

Expand All @@ -777,7 +779,7 @@ export class GlimmerishComponents extends RenderTest {
}
);

this.render('{{#if showing}}<Foo/>{{/if}}', {
this.render('{{#if this.showing}}<Foo/>{{/if}}', {
showing: false,
});

Expand Down Expand Up @@ -805,9 +807,12 @@ export class GlimmerishComponents extends RenderTest {
}
);

this.render('{{#if showing}}<div class="first"></div><div class="second"></div><Foo/>{{/if}}', {
showing: false,
});
this.render(
'{{#if this.showing}}<div class="first"></div><div class="second"></div><Foo/>{{/if}}',
{
showing: false,
}
);

this.assert.throws(() => {
this.rerender({ showing: true });
Expand Down Expand Up @@ -838,7 +843,7 @@ export class GlimmerishComponents extends RenderTest {

this.registerComponent('TemplateOnly', 'Bar', '<div class="second"></div><Foo/>');

this.render('{{#if showing}}<div class="first"></div><Bar/>{{/if}}', {
this.render('{{#if this.showing}}<div class="first"></div><Bar/>{{/if}}', {
showing: false,
});

Expand Down Expand Up @@ -885,7 +890,7 @@ export class GlimmerishComponents extends RenderTest {

this.registerComponent('TemplateOnly', 'Bar', '<div class="second"></div><Foo/>');

this.render('{{#if showing}}<div class="first"></div><Bar/>{{/if}}', {
this.render('{{#if this.showing}}<div class="first"></div><Bar/>{{/if}}', {
showing: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class SerializedDOMHelperTests extends DOMHelperTests {

@test
'The compiler can handle unescaped HTML'() {
this.render('<div>{{{title}}}</div>', { title: '<strong>hello</strong>' });
this.render('<div>{{{this.title}}}</div>', { title: '<strong>hello</strong>' });
let b = blockStack();
this.assertHTML(strip`
<div>
Expand Down
7 changes: 5 additions & 2 deletions packages/@glimmer/integration-tests/lib/suites/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export class DebuggerSuite extends RenderTest {
this.assert.equal(get('foo'), expectedContext.foo);
});

this.render('{{#if a.b}}true{{debugger}}{{else}}false{{debugger}}{{/if}}', expectedContext);
this.render(
'{{#if this.a.b}}true{{debugger}}{{else}}false{{debugger}}{{/if}}',
expectedContext
);
this.assert.equal(callbackExecuted, 1);
this.assertHTML('true');
this.assertStableRerender();
Expand Down Expand Up @@ -71,7 +74,7 @@ export class DebuggerSuite extends RenderTest {
});

this.render(
'{{#with foo as |bar|}}{{#if a.b}}true{{debugger}}{{else}}false{{debugger}}{{/if}}{{/with}}',
'{{#with this.foo as |bar|}}{{#if this.a.b}}true{{debugger}}{{else}}false{{debugger}}{{/if}}{{/with}}',
expectedContext
);
this.assert.equal(callbackExecuted, 1);
Expand Down
Loading

0 comments on commit 8224439

Please sign in to comment.