Skip to content

Commit

Permalink
Merge pull request #17846 from emberjs/template-only-bounds
Browse files Browse the repository at this point in the history
[BUGFIX beta] Fix template-only components clearing
  • Loading branch information
chancancode authored Apr 3, 2019
2 parents 919ede7 + 9c98690 commit 82edd47
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const CAPABILITIES: ComponentCapabilities = {
createCaller: true,
dynamicScope: false,
updateHook: true,
createInstance: false,
createInstance: true,
};

export interface InputComponentState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const ROOT_CAPABILITIES: ComponentCapabilities = {
createCaller: true,
dynamicScope: true,
updateHook: true,
createInstance: false,
createInstance: true,
};

export class RootComponentDefinition implements ComponentDefinition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CAPABILITIES: ComponentCapabilities = {
createCaller: false,
dynamicScope: false,
updateHook: false,
createInstance: false,
createInstance: true,
};

export default class TemplateOnlyComponentManager extends AbstractManager<null, OwnedTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,30 @@ moduleFor(

this.assertInnerHTML('hello');
}

['@test it has the correct bounds']() {
this.registerComponent('foo-bar', 'hello');

this.render('outside {{#if this.isShowing}}before {{foo-bar}} after{{/if}} outside', {
isShowing: true,
});

this.assertInnerHTML('outside before hello after outside');

this.assertStableRerender();

runTask(() => this.context.set('isShowing', false));

this.assertInnerHTML('outside <!----> outside');

runTask(() => this.context.set('isShowing', null));

this.assertInnerHTML('outside <!----> outside');

runTask(() => this.context.set('isShowing', true));

this.assertInnerHTML('outside before hello after outside');
}
}
);

Expand Down

0 comments on commit 82edd47

Please sign in to comment.