Skip to content

Commit

Permalink
Update for glimmer-vm changes.
Browse files Browse the repository at this point in the history
* Enable previously skipped `has-block` test
* Remove guard from `CurlyComponentManager#didCreateElement` (it is no
  longer called for each `...attributes` invocation).
  • Loading branch information
rwjblue committed May 29, 2018
1 parent cc3147d commit 2828435
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 42 deletions.
73 changes: 32 additions & 41 deletions packages/ember-glimmer/lib/component-managers/curly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,60 +323,51 @@ export default class CurlyComponentManager
}

didCreateElement(
{ hasWrappedElement, component, classRef, environment }: ComponentStateBucket,
{ component, classRef, environment }: ComponentStateBucket,
element: HTMLElement,
operations: ElementOperations
): void {
// TODO: EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION update glimmer-vm to _not_
// call `didCreateElement` for each `...attributes`
if (hasWrappedElement) {
setViewElement(component, element);
setViewElement(component, element);

let { attributeBindings, classNames, classNameBindings } = component;
let { attributeBindings, classNames, classNameBindings } = component;

operations.setAttribute('id', PrimitiveReference.create(guidFor(component)), false, null);
operations.setAttribute('id', PrimitiveReference.create(guidFor(component)), false, null);

if (attributeBindings && attributeBindings.length) {
applyAttributeBindings(element, attributeBindings, component, operations);
} else {
if (component.elementId) {
operations.setAttribute(
'id',
PrimitiveReference.create(component.elementId),
false,
null
);
}
IsVisibleBinding.install(element, component, operations);
if (attributeBindings && attributeBindings.length) {
applyAttributeBindings(element, attributeBindings, component, operations);
} else {
if (component.elementId) {
operations.setAttribute('id', PrimitiveReference.create(component.elementId), false, null);
}
IsVisibleBinding.install(element, component, operations);
}

if (classRef) {
const ref = new SimpleClassNameBindingReference(classRef, classRef['_propertyKey']);
operations.setAttribute('class', ref, false, null);
}
if (classRef) {
const ref = new SimpleClassNameBindingReference(classRef, classRef['_propertyKey']);
operations.setAttribute('class', ref, false, null);
}

if (classNames && classNames.length) {
classNames.forEach((name: string) => {
operations.setAttribute('class', PrimitiveReference.create(name), false, null);
});
}
if (classNames && classNames.length) {
classNames.forEach((name: string) => {
operations.setAttribute('class', PrimitiveReference.create(name), false, null);
});
}

if (classNameBindings && classNameBindings.length) {
classNameBindings.forEach((binding: string) => {
ClassNameBinding.install(element, component, binding, operations);
});
}
operations.setAttribute('class', PrimitiveReference.create('ember-view'), false, null);
if (classNameBindings && classNameBindings.length) {
classNameBindings.forEach((binding: string) => {
ClassNameBinding.install(element, component, binding, operations);
});
}
operations.setAttribute('class', PrimitiveReference.create('ember-view'), false, null);

if ('ariaRole' in component) {
operations.setAttribute('role', referenceForKey(component, 'ariaRole'), false, null);
}
if ('ariaRole' in component) {
operations.setAttribute('role', referenceForKey(component, 'ariaRole'), false, null);
}

component._transitionTo('hasElement');
component._transitionTo('hasElement');

if (environment.isInteractive) {
component.trigger('willInsertElement');
}
if (environment.isInteractive) {
component.trigger('willInsertElement');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ if (EMBER_GLIMMER_ANGLE_BRACKET_INVOCATION) {
this.assertStableRerender();
}

'@skip has-block'() {
'@test has-block'() {
this.registerComponent('check-block', {
template: strip`
{{#if (has-block)}}
Expand Down

0 comments on commit 2828435

Please sign in to comment.