@fluentui-react-native/focus-zone 0.21.15 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -1
- package/lib/FocusZone.d.ts +5 -2
- package/lib/FocusZone.js +28 -30
- package/lib/FocusZone.js.map +1 -1
- package/lib/FocusZone.types.d.ts +74 -70
- package/lib/FocusZone.types.js +1 -1
- package/lib/FocusZoneNativeComponent.d.ts +10 -10
- package/lib/FocusZoneNativeComponent.d.ts.map +1 -1
- package/lib/FocusZoneNativeComponent.js +3 -3
- package/lib/FocusZoneNativeComponent.js.map +1 -1
- package/lib/__tests__/FocusZone.test.d.ts +1 -1
- package/lib/__tests__/FocusZone.test.js +134 -75
- package/lib/__tests__/FocusZone.test.js.map +1 -1
- package/lib/index.d.ts +13 -2
- package/lib/index.js +1 -1
- package/lib-commonjs/FocusZone.d.ts +5 -2
- package/lib-commonjs/FocusZone.js +91 -64
- package/lib-commonjs/FocusZone.js.map +1 -1
- package/lib-commonjs/FocusZone.types.d.ts +74 -70
- package/lib-commonjs/FocusZone.types.js +3 -3
- package/lib-commonjs/FocusZoneNativeComponent.d.ts +10 -10
- package/lib-commonjs/FocusZoneNativeComponent.d.ts.map +1 -1
- package/lib-commonjs/FocusZoneNativeComponent.js +5 -8
- package/lib-commonjs/FocusZoneNativeComponent.js.map +1 -1
- package/lib-commonjs/__tests__/FocusZone.test.d.ts +1 -1
- package/lib-commonjs/__tests__/FocusZone.test.js +194 -103
- package/lib-commonjs/__tests__/FocusZone.test.js.map +1 -1
- package/lib-commonjs/index.d.ts +13 -2
- package/lib-commonjs/index.js +17 -7
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +62 -62
- package/src/FocusZoneNativeComponent.ts +3 -3
- package/src/__tests__/FocusZone.test.tsx +60 -48
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { act } from 'react';
|
|
2
2
|
import { Button } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import * as renderer from 'react-test-renderer';
|
|
@@ -11,116 +11,128 @@ const onPress = () => {
|
|
|
11
11
|
|
|
12
12
|
describe('FocusZone No Props', () => {
|
|
13
13
|
it('No children', () => {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let component: renderer.ReactTestRenderer;
|
|
15
|
+
act(() => {
|
|
16
|
+
component = renderer.create(<FocusZone />);
|
|
17
|
+
});
|
|
18
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
16
19
|
});
|
|
17
20
|
|
|
18
21
|
it('One child', () => {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
let component: renderer.ReactTestRenderer;
|
|
23
|
+
act(() => {
|
|
24
|
+
component = renderer.create(
|
|
21
25
|
<FocusZone>
|
|
22
26
|
<Button title="button" onPress={onPress} />
|
|
23
27
|
</FocusZone>,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
expect(
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
it('Two children', () => {
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
let component: renderer.ReactTestRenderer;
|
|
35
|
+
act(() => {
|
|
36
|
+
component = renderer.create(
|
|
32
37
|
<FocusZone>
|
|
33
38
|
<Button title="button" onPress={onPress} />
|
|
34
39
|
<Button title="button" onPress={onPress} />
|
|
35
40
|
</FocusZone>,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
expect(
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
39
44
|
});
|
|
40
45
|
|
|
41
46
|
it('Three children', () => {
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
let component: renderer.ReactTestRenderer;
|
|
48
|
+
act(() => {
|
|
49
|
+
component = renderer.create(
|
|
44
50
|
<FocusZone>
|
|
45
51
|
<Button title="button" onPress={onPress} />
|
|
46
52
|
<Button title="button" onPress={onPress} />
|
|
47
53
|
<Button title="button" onPress={onPress} />
|
|
48
54
|
</FocusZone>,
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
expect(
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
52
58
|
});
|
|
53
59
|
});
|
|
54
60
|
|
|
55
61
|
describe('FocusZone With Props', () => {
|
|
56
62
|
it('defaultTabbableElement Prop', () => {
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
let component: renderer.ReactTestRenderer;
|
|
64
|
+
act(() => {
|
|
65
|
+
component = renderer.create(
|
|
59
66
|
<FocusZone defaultTabbableElement={null}>
|
|
60
67
|
<Button title="button" onPress={onPress} />
|
|
61
68
|
<Button title="button" onPress={onPress} />
|
|
62
69
|
<Button title="button" onPress={onPress} />
|
|
63
70
|
</FocusZone>,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
expect(
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
67
74
|
});
|
|
68
75
|
|
|
69
76
|
it('focusZoneDirection Prop', () => {
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
let component: renderer.ReactTestRenderer;
|
|
78
|
+
act(() => {
|
|
79
|
+
component = renderer.create(
|
|
72
80
|
<FocusZone focusZoneDirection="bidirectional">
|
|
73
81
|
<Button title="button" onPress={onPress} />
|
|
74
82
|
<Button title="button" onPress={onPress} />
|
|
75
83
|
<Button title="button" onPress={onPress} />
|
|
76
84
|
</FocusZone>,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
expect(
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
80
88
|
});
|
|
81
89
|
|
|
82
90
|
it('disabled Prop', () => {
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
let component: renderer.ReactTestRenderer;
|
|
92
|
+
act(() => {
|
|
93
|
+
component = renderer.create(
|
|
85
94
|
<FocusZone disabled={true}>
|
|
86
95
|
<Button title="button" onPress={onPress} />
|
|
87
96
|
<Button title="button" onPress={onPress} />
|
|
88
97
|
<Button title="button" onPress={onPress} />
|
|
89
98
|
</FocusZone>,
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
expect(
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
93
102
|
});
|
|
94
103
|
|
|
95
104
|
it('isCircularNavigation Prop', () => {
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
let component: renderer.ReactTestRenderer;
|
|
106
|
+
act(() => {
|
|
107
|
+
component = renderer.create(
|
|
98
108
|
<FocusZone isCircularNavigation={true}>
|
|
99
109
|
<Button title="button" onPress={onPress} />
|
|
100
110
|
<Button title="button" onPress={onPress} />
|
|
101
111
|
<Button title="button" onPress={onPress} />
|
|
102
112
|
</FocusZone>,
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
expect(
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
106
116
|
});
|
|
107
117
|
|
|
108
118
|
it('use2DNavigation Prop', () => {
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
let component: renderer.ReactTestRenderer;
|
|
120
|
+
act(() => {
|
|
121
|
+
component = renderer.create(
|
|
111
122
|
<FocusZone use2DNavigation={true}>
|
|
112
123
|
<Button title="button" onPress={onPress} />
|
|
113
124
|
<Button title="button" onPress={onPress} />
|
|
114
125
|
<Button title="button" onPress={onPress} />
|
|
115
126
|
</FocusZone>,
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
expect(
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
119
130
|
});
|
|
120
131
|
|
|
121
132
|
it('All Props', () => {
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
let component: renderer.ReactTestRenderer;
|
|
134
|
+
act(() => {
|
|
135
|
+
component = renderer.create(
|
|
124
136
|
<FocusZone
|
|
125
137
|
disabled={false}
|
|
126
138
|
use2DNavigation={true}
|
|
@@ -132,8 +144,8 @@ describe('FocusZone With Props', () => {
|
|
|
132
144
|
<Button title="button" onPress={onPress} />
|
|
133
145
|
<Button title="button" onPress={onPress} />
|
|
134
146
|
</FocusZone>,
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
expect(
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
138
150
|
});
|
|
139
151
|
});
|