@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.
Files changed (33) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/lib/FocusZone.d.ts +5 -2
  3. package/lib/FocusZone.js +28 -30
  4. package/lib/FocusZone.js.map +1 -1
  5. package/lib/FocusZone.types.d.ts +74 -70
  6. package/lib/FocusZone.types.js +1 -1
  7. package/lib/FocusZoneNativeComponent.d.ts +10 -10
  8. package/lib/FocusZoneNativeComponent.d.ts.map +1 -1
  9. package/lib/FocusZoneNativeComponent.js +3 -3
  10. package/lib/FocusZoneNativeComponent.js.map +1 -1
  11. package/lib/__tests__/FocusZone.test.d.ts +1 -1
  12. package/lib/__tests__/FocusZone.test.js +134 -75
  13. package/lib/__tests__/FocusZone.test.js.map +1 -1
  14. package/lib/index.d.ts +13 -2
  15. package/lib/index.js +1 -1
  16. package/lib-commonjs/FocusZone.d.ts +5 -2
  17. package/lib-commonjs/FocusZone.js +91 -64
  18. package/lib-commonjs/FocusZone.js.map +1 -1
  19. package/lib-commonjs/FocusZone.types.d.ts +74 -70
  20. package/lib-commonjs/FocusZone.types.js +3 -3
  21. package/lib-commonjs/FocusZoneNativeComponent.d.ts +10 -10
  22. package/lib-commonjs/FocusZoneNativeComponent.d.ts.map +1 -1
  23. package/lib-commonjs/FocusZoneNativeComponent.js +5 -8
  24. package/lib-commonjs/FocusZoneNativeComponent.js.map +1 -1
  25. package/lib-commonjs/__tests__/FocusZone.test.d.ts +1 -1
  26. package/lib-commonjs/__tests__/FocusZone.test.js +194 -103
  27. package/lib-commonjs/__tests__/FocusZone.test.js.map +1 -1
  28. package/lib-commonjs/index.d.ts +13 -2
  29. package/lib-commonjs/index.js +17 -7
  30. package/lib-commonjs/index.js.map +1 -1
  31. package/package.json +62 -62
  32. package/src/FocusZoneNativeComponent.ts +3 -3
  33. package/src/__tests__/FocusZone.test.tsx +60 -48
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
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
- const tree = renderer.create(<FocusZone />).toJSON();
15
- expect(tree).toMatchSnapshot();
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
- const tree = renderer
20
- .create(
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
- .toJSON();
26
- expect(tree).toMatchSnapshot();
28
+ );
29
+ });
30
+ expect(component!.toJSON()).toMatchSnapshot();
27
31
  });
28
32
 
29
33
  it('Two children', () => {
30
- const tree = renderer
31
- .create(
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
- .toJSON();
38
- expect(tree).toMatchSnapshot();
41
+ );
42
+ });
43
+ expect(component!.toJSON()).toMatchSnapshot();
39
44
  });
40
45
 
41
46
  it('Three children', () => {
42
- const tree = renderer
43
- .create(
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
- .toJSON();
51
- expect(tree).toMatchSnapshot();
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
- const tree = renderer
58
- .create(
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
- .toJSON();
66
- expect(tree).toMatchSnapshot();
71
+ );
72
+ });
73
+ expect(component!.toJSON()).toMatchSnapshot();
67
74
  });
68
75
 
69
76
  it('focusZoneDirection Prop', () => {
70
- const tree = renderer
71
- .create(
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
- .toJSON();
79
- expect(tree).toMatchSnapshot();
85
+ );
86
+ });
87
+ expect(component!.toJSON()).toMatchSnapshot();
80
88
  });
81
89
 
82
90
  it('disabled Prop', () => {
83
- const tree = renderer
84
- .create(
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
- .toJSON();
92
- expect(tree).toMatchSnapshot();
99
+ );
100
+ });
101
+ expect(component!.toJSON()).toMatchSnapshot();
93
102
  });
94
103
 
95
104
  it('isCircularNavigation Prop', () => {
96
- const tree = renderer
97
- .create(
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
- .toJSON();
105
- expect(tree).toMatchSnapshot();
113
+ );
114
+ });
115
+ expect(component!.toJSON()).toMatchSnapshot();
106
116
  });
107
117
 
108
118
  it('use2DNavigation Prop', () => {
109
- const tree = renderer
110
- .create(
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
- .toJSON();
118
- expect(tree).toMatchSnapshot();
127
+ );
128
+ });
129
+ expect(component!.toJSON()).toMatchSnapshot();
119
130
  });
120
131
 
121
132
  it('All Props', () => {
122
- const tree = renderer
123
- .create(
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
- .toJSON();
137
- expect(tree).toMatchSnapshot();
147
+ );
148
+ });
149
+ expect(component!.toJSON()).toMatchSnapshot();
138
150
  });
139
151
  });