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.
Paul O’Shannessy committed
Mar 16, 2015 at 13:40 UTC
99cbaed83678f76e10f688bff6f976803ce57241
2 files changed
+25
src/browser/ui/dom/components/createFullPageComponent.js
+1
@@ -33,6 +33,7 @@ function createFullPageComponent(tag) {
33
var elementFactory = ReactElement.createFactory(tag);
34
35
var FullPageComponent = ReactClass.createClass({
36
+ tagName: tag.toUpperCase(),
37
displayName: 'ReactFullPageComponent' + tag,
38
39
componentWillUnmount: function() {
src/test/__tests__/ReactTestUtils-test.js
+24
@@ -206,4 +206,28 @@ describe('ReactTestUtils', function() {
206
207
expect(console.warn.calls.length).toBe(0);
208
});
209
+
210
+ it('should support injected wrapper components as DOM components', function() {
211
+ var injectedDOMComponents = [
212
+ 'button',
213
+ 'form',
214
+ 'iframe',
215
+ 'img',
216
+ 'input',
217
+ 'option',
218
+ 'select',
219
+ 'textarea',
220
+ 'html',
221
+ 'head',
222
+ 'body'
223
+ ];
224
+
225
+ injectedDOMComponents.forEach(function(type) {
226
+ var component = ReactTestUtils.renderIntoDocument(
227
+ React.createElement(type)
228
+ );
229
+ expect(component.tagName).toBe(type.toUpperCase());
230
+ expect(ReactTestUtils.isDOMComponent(component)).toBe(true);
231
+ });
232
+ });
233
});