Skip to content

Commit

Permalink
Some misc fixes to get components working in apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Godhuda authored and krisselden committed Apr 8, 2016
1 parent e6c4ba0 commit c236d37
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"express": "^4.5.0",
"finalhandler": "^0.4.0",
"github": "^0.2.3",
"glimmer-engine": "tildeio/glimmer#b184257",
"glimmer-engine": "tildeio/glimmer#2849de8",
"glob": "^5.0.13",
"htmlbars": "0.14.16",
"mocha": "^2.4.5",
Expand Down
2 changes: 2 additions & 0 deletions packages/ember-application/lib/system/application-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ const ApplicationInstance = EngineInstance.extend({

if (options.isInteractive) {
registry.injection('view', 'renderer', 'renderer:-dom');
registry.injection('component', 'renderer', 'renderer:-dom');
} else {
registry.injection('view', 'renderer', 'renderer:-inert');
registry.injection('component', 'renderer', 'renderer:-inert');
}

if (options.rootElement) {
Expand Down
5 changes: 4 additions & 1 deletion packages/ember-glimmer/lib/ember-metal-views/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ class DynamicScope {

class Renderer {
constructor({ dom, env, destinedForDOM = false }) {
this._root = null;
this._dom = dom;
this._env = env;
this._destinedForDOM = destinedForDOM;
}

appendOutletView(view, target) {
this._root = view;

let env = this._env;
let self = new RootReference(view);
let dynamicScope = new DynamicScope({
Expand Down Expand Up @@ -54,7 +57,7 @@ class Renderer {
}

rerender(view) {
view['_renderResult'].rerender();
(view['_renderResult'] || this._root['_renderResult']).rerender();
}

remove(view) {
Expand Down
5 changes: 4 additions & 1 deletion packages/ember-glimmer/lib/ember-routing-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export class OutletView {
}
}

appendChild() { }
appendChild(instance) {
instance.parentView = this;
instance.ownerView = this;
}

rerender() {
if (this._renderResult) { this.renderer.rerender(this); }
Expand Down
4 changes: 4 additions & 0 deletions packages/ember-glimmer/lib/ember-views/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ export default CoreView.extend(
init() {
this._super(...arguments);
this._viewRegistry = this._viewRegistry || EmberView.views;
},

__defineNonEnumerable(property) {
this[property.name] = property.descriptor.value;
}
});
1 change: 1 addition & 0 deletions packages/ember-glimmer/lib/utils/references.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class UpdatableReference extends EmberPathReference {
// @implements PathReference
export class GetHelperReference extends CachedReference {
constructor(sourceReference, pathReference) {
super();
this.sourceReference = sourceReference;
this.pathReference = pathReference;
this.tag = combineTagged([sourceReference, pathReference]);
Expand Down
11 changes: 3 additions & 8 deletions packages/ember/tests/component_registration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ QUnit.test('If a component is registered, it is used', function() {

}

if (!isEnabled('ember-glimmer')) {
// jscs:disable

QUnit.test('Late-registered components can be rendered with custom `layout` property', function() {
Ember.TEMPLATES.application = compile('<div id=\'wrapper\'>there goes {{my-hero}}</div>');

Expand All @@ -112,9 +115,6 @@ QUnit.test('Late-registered components can be rendered with custom `layout` prop
ok(!helpers['my-hero'], 'Component wasn\'t saved to global helpers hash');
});

if (!isEnabled('ember-glimmer')) {
// jscs:disable

QUnit.test('Late-registered components can be rendered with template registered on the container', function() {
Ember.TEMPLATES.application = compile('<div id=\'wrapper\'>hello world {{sally-rutherford}}-{{#sally-rutherford}}!!!{{/sally-rutherford}}</div>');

Expand Down Expand Up @@ -247,8 +247,6 @@ QUnit.test('Using name of component that does not exist', function () {
}, /A helper named 'no-good' could not be found/);
});

}

QUnit.module('Application Lifecycle - Component Context', {
setup: prepare,
teardown: cleanup
Expand Down Expand Up @@ -304,9 +302,6 @@ QUnit.test('Components without a block should have the proper content when a tem
equal(jQuery('#wrapper').text(), 'inner', 'The component is composed correctly');
});

if (!isEnabled('ember-glimmer')) {
// jscs:disable

QUnit.test('Components without a block should have the proper content', function() {
Ember.TEMPLATES.application = compile('<div id=\'wrapper\'>{{my-component}}</div>');

Expand Down
7 changes: 7 additions & 0 deletions packages/ember/tests/helpers/helper_registration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Helper, { helper } from 'ember-htmlbars/helper';
import Application from 'ember-application/system/application';
import jQuery from 'ember-views/system/jquery';
import inject from 'ember-runtime/inject';
import isEnabled from 'ember-metal/features';

import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils';
import viewKeyword from 'ember-htmlbars/keywords/view';
Expand Down Expand Up @@ -104,6 +105,10 @@ QUnit.test('Undashed helpers registered on the container can be invoked', functi
equal(jQuery('#wrapper').text(), 'OMG|boo|ya', 'The helper was invoked from the container');
});

if (!isEnabled('ember-glimmer')) {
// jscs:disable

// needs glimmer Helper
QUnit.test('Helpers can receive injections', function() {
Ember.TEMPLATES.application = compile('<div id=\'wrapper\'>{{full-name}}</div>');

Expand All @@ -124,3 +129,5 @@ QUnit.test('Helpers can receive injections', function() {

ok(serviceCalled, 'service was injected, method called');
});

}

0 comments on commit c236d37

Please sign in to comment.