mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
2fa38ac1cc
* Removed createReactNativeComponentClassStack and renamed createReactNativeComponentClassFiber => createReactNativeComponentClass * Removed findNumericNodeHandleStack and renamed findNumericNodeHandleFiber => findNumericNodeHandle * Renamed ReactNativeFiberEntry => ReactNativeEntry * Removed all references to ReactNativeFeatureFlags and RN stack * Removed severl RN modules that are no longer used * Renamed ReactNativeEntry => ReactNativeFiberEntry for now. We'll probably remove 'fiber' references later * Update build results json * Deleted snapshot * Re-add accidentally deleted test * Remove now-unnecessary hack in test * Fix lint * RN findNodeHandle no longer adds props directly to read-only owner (#10520) * Added ReactNativeMount-test snapshot for 'renders and reorders children' test
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
/**
|
|
* Copyright 2013-2015, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @emails react-core
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
let createReactNativeComponentClass;
|
|
let React;
|
|
let ReactNative;
|
|
|
|
describe('createReactNativeComponentClass', () => {
|
|
beforeEach(() => {
|
|
jest.resetModules();
|
|
|
|
createReactNativeComponentClass = require('createReactNativeComponentClass');
|
|
React = require('react');
|
|
ReactNative = require('react-native');
|
|
});
|
|
|
|
it('should register viewConfigs', () => {
|
|
const textViewConfig = {
|
|
validAttributes: {},
|
|
uiViewClassName: 'Text',
|
|
};
|
|
const viewViewConfig = {
|
|
validAttributes: {},
|
|
uiViewClassName: 'View',
|
|
};
|
|
|
|
const Text = createReactNativeComponentClass(textViewConfig);
|
|
const View = createReactNativeComponentClass(viewViewConfig);
|
|
|
|
expect(Text).not.toBe(View);
|
|
|
|
ReactNative.render(<Text />, 1);
|
|
ReactNative.render(<View />, 1);
|
|
});
|
|
|
|
it('should not allow viewConfigs with duplicate uiViewClassNames to be registered', () => {
|
|
const textViewConfig = {
|
|
validAttributes: {},
|
|
uiViewClassName: 'Text',
|
|
};
|
|
const altTextViewConfig = {
|
|
validAttributes: {},
|
|
uiViewClassName: 'Text', // Same
|
|
};
|
|
|
|
createReactNativeComponentClass(textViewConfig);
|
|
|
|
expect(() => {
|
|
createReactNativeComponentClass(altTextViewConfig);
|
|
}).toThrow('Tried to register two views with the same name Text');
|
|
});
|
|
});
|