Ensure FullPageComponents are treated as DOM components

We currently override a couple DOM components. We need to ensure everything we
override is still treated as a DOM component, even if it has a composite
component wrapper.
This commit is contained in:
Paul O’Shannessy 2015-03-16 13:40:17 -07:00
parent 93e67a0a5b
commit 99cbaed836
2 changed files with 25 additions and 0 deletions

View File

@ -33,6 +33,7 @@ function createFullPageComponent(tag) {
var elementFactory = ReactElement.createFactory(tag);
var FullPageComponent = ReactClass.createClass({
tagName: tag.toUpperCase(),
displayName: 'ReactFullPageComponent' + tag,
componentWillUnmount: function() {

View File

@ -206,4 +206,28 @@ describe('ReactTestUtils', function() {
expect(console.warn.calls.length).toBe(0);
});
it('should support injected wrapper components as DOM components', function() {
var injectedDOMComponents = [
'button',
'form',
'iframe',
'img',
'input',
'option',
'select',
'textarea',
'html',
'head',
'body'
];
injectedDOMComponents.forEach(function(type) {
var component = ReactTestUtils.renderIntoDocument(
React.createElement(type)
);
expect(component.tagName).toBe(type.toUpperCase());
expect(ReactTestUtils.isDOMComponent(component)).toBe(true);
});
});
});