Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (instance == null) {
return null;
}
// If a native node, weex may not export ownerDocument property
if (instance.ownerDocument || instance.nodeType) {
return instance;
}
// Native component
if (instance._nativeNode) {
return instance._nativeNode;
}
if (typeof instance == 'string') {
return getElementById(instance);
}
if (typeof instance.render !== 'function') {
throw new Error('findDOMNode: find by neither component nor DOM node.');
}
// Composite component
let internal = instance._internal;
if (internal) {
while (!internal._nativeNode) {
internal = internal._renderedComponent;
// If not mounted
if (internal == null) {
return null;
}
it('getElementById with id', () => {
let mockFn = jest.fn();
Host.driver = {
getElementById: mockFn,
};
getElementById('id');
expect(mockFn).toBeCalledWith('id');
});