mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-22 22:44:52 +00:00
Add unit tests for ref imperative methods
This commit is contained in:
@@ -122,6 +122,18 @@ describe('components/Text', () => {
|
||||
render(<Text ref={ref} />);
|
||||
expect(ref).toBeCalled();
|
||||
});
|
||||
|
||||
test('node has imperative methods', () => {
|
||||
const ref = React.createRef();
|
||||
act(() => {
|
||||
render(<Text ref={ref} />);
|
||||
});
|
||||
const node = ref.current;
|
||||
expect(typeof node.measure === 'function');
|
||||
expect(typeof node.measureLayout === 'function');
|
||||
expect(typeof node.measureInWindow === 'function');
|
||||
expect(typeof node.setNativeProps === 'function');
|
||||
});
|
||||
});
|
||||
|
||||
describe('prop "selectable"', () => {
|
||||
|
||||
@@ -126,6 +126,18 @@ describe('components/View', () => {
|
||||
render(<View ref={ref} />);
|
||||
expect(ref).toBeCalled();
|
||||
});
|
||||
|
||||
test('node has imperative methods', () => {
|
||||
const ref = React.createRef();
|
||||
act(() => {
|
||||
render(<View ref={ref} />);
|
||||
});
|
||||
const node = ref.current;
|
||||
expect(typeof node.measure === 'function');
|
||||
expect(typeof node.measureLayout === 'function');
|
||||
expect(typeof node.measureInWindow === 'function');
|
||||
expect(typeof node.setNativeProps === 'function');
|
||||
});
|
||||
});
|
||||
|
||||
test('prop "pointerEvents"', () => {
|
||||
|
||||
Reference in New Issue
Block a user