本文整理匯總了TypeScript中react-dom/test-utils.renderIntoDocument函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript renderIntoDocument函數的具體用法?TypeScript renderIntoDocument怎麽用?TypeScript renderIntoDocument使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了renderIntoDocument函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: beforeEach
beforeEach(() => {
// @NOTE: set state of sidebarListWrapper in each test case
// might trigger component lifecycle function
sidebarListWrapper = ReactTestUtils.renderIntoDocument(
React.createElement(SidebarListWrapper, {
records: _records,
shouldTagDiffs: false,
openSource: () => { }
})
)
})
示例2: beforeEach
beforeEach(() => {
sidebarRootWrapper = ReactTestUtils.renderIntoDocument(
React.createElement(SidebarRootWrapper, {
records: _records,
shouldTagDiffs: false,
openSource: _openSource
})
)
sidebarFilter = ReactTestUtils.findRenderedComponentWithType(
sidebarRootWrapper,
SidebarFilter
)
sidebarList = ReactTestUtils.findRenderedComponentWithType(
sidebarRootWrapper,
SidebarList
)
})
示例3: it
it('scryRenderedDOMComponentsWithClass', () => {
const component = ReactTestUtils.renderIntoDocument(React.createElement(TestComponent));
ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'class');
});
示例4: it
it('isCompositeComponent', () => {
const element = React.createElement(TestComponent);
const instance: TestComponent = ReactTestUtils.renderIntoDocument(element);
const isCompositeComponent: boolean = ReactTestUtils.isCompositeComponent(instance);
});