mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-02 10:35:54 +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} />);
|
render(<Text ref={ref} />);
|
||||||
expect(ref).toBeCalled();
|
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"', () => {
|
describe('prop "selectable"', () => {
|
||||||
|
|||||||
@@ -126,6 +126,18 @@ describe('components/View', () => {
|
|||||||
render(<View ref={ref} />);
|
render(<View ref={ref} />);
|
||||||
expect(ref).toBeCalled();
|
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"', () => {
|
test('prop "pointerEvents"', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user