-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11203 from rwjblue/update-htmlbars
Ensure components for void tagNames do not have childNodes.
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/ember-htmlbars/tests/integration/void-element-component-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>`'); | ||
}); |