Skip to content

Commit

Permalink
Merge pull request #11203 from rwjblue/update-htmlbars
Browse files Browse the repository at this point in the history
Ensure components for void tagNames do not have childNodes.
  • Loading branch information
rwjblue committed May 18, 2015
2 parents cebcd8b + 26ad0ba commit 003caee
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"express": "^4.5.0",
"github": "^0.2.3",
"glob": "~4.3.2",
"htmlbars": "0.13.19",
"htmlbars": "0.13.20",
"qunit-extras": "^1.3.0",
"qunitjs": "^1.16.0",
"route-recognizer": "0.1.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import EmberView from "ember-views/views/view";
import { Registry } from "ember-runtime/system/container";
import compile from 'ember-template-compiler/system/compile';
import { runAppend, runDestroy } from "ember-runtime/tests/utils";
import ComponentLookup from 'ember-views/component_lookup';
import Component from "ember-views/views/component";

var registry, container, view;

QUnit.module('ember-htmlbars: components for void elements', {
setup() {
registry = new Registry();
container = registry.container();
registry.optionsForType('component', { singleton: false });
registry.optionsForType('view', { singleton: false });
registry.optionsForType('template', { instantiate: false });
registry.optionsForType('helper', { instantiate: false });
registry.register('component-lookup:main', ComponentLookup);
},

teardown() {
runDestroy(container);
runDestroy(view);
registry = container = view = null;
}
});

QUnit.test('a void element does not have childNodes', function() {
var component;
registry.register('component:x-foo', Component.extend({
tagName: 'input',

init() {
this._super(...arguments);
component = this;
}
}));

view = EmberView.create({
container: container,
template: compile('{{x-foo}}')
});

runAppend(view);

deepEqual(component.element.childNodes.length, 0, 'no childNodes are added for `<input>`');
});

0 comments on commit 003caee

Please sign in to comment.