@fluentui-react-native/tester 0.101.5 → 0.101.7

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 (74) hide show
  1. package/CHANGELOG.json +169 -1
  2. package/CHANGELOG.md +41 -2
  3. package/lib/E2E/FocusZone/pages/FocusZonePageObject.d.ts +37 -0
  4. package/lib/E2E/FocusZone/pages/FocusZonePageObject.d.ts.map +1 -1
  5. package/lib/E2E/FocusZone/pages/FocusZonePageObject.js +197 -4
  6. package/lib/E2E/FocusZone/pages/FocusZonePageObject.js.map +1 -1
  7. package/lib/E2E/FocusZone/specs/FocusZone.spec.win.js +457 -0
  8. package/lib/E2E/FocusZone/specs/FocusZone.spec.win.js.map +1 -1
  9. package/lib/E2E/common/BasePage.d.ts +2 -0
  10. package/lib/E2E/common/BasePage.d.ts.map +1 -1
  11. package/lib/E2E/common/BasePage.js +34 -14
  12. package/lib/E2E/common/BasePage.js.map +1 -1
  13. package/lib/E2E/common/consts.d.ts +15 -0
  14. package/lib/E2E/common/consts.d.ts.map +1 -1
  15. package/lib/TestComponents/Common/MenuPicker.d.ts +2 -0
  16. package/lib/TestComponents/Common/MenuPicker.d.ts.map +1 -1
  17. package/lib/TestComponents/Common/MenuPicker.js +2 -2
  18. package/lib/TestComponents/Common/MenuPicker.js.map +1 -1
  19. package/lib/TestComponents/FocusZone/FocusZoneE2ETest.d.ts +20 -0
  20. package/lib/TestComponents/FocusZone/FocusZoneE2ETest.d.ts.map +1 -0
  21. package/lib/TestComponents/FocusZone/FocusZoneE2ETest.js +51 -0
  22. package/lib/TestComponents/FocusZone/FocusZoneE2ETest.js.map +1 -0
  23. package/lib/TestComponents/FocusZone/FocusZoneTest.d.ts.map +1 -1
  24. package/lib/TestComponents/FocusZone/FocusZoneTest.js +26 -70
  25. package/lib/TestComponents/FocusZone/FocusZoneTest.js.map +1 -1
  26. package/lib/TestComponents/FocusZone/consts.d.ts +10 -0
  27. package/lib/TestComponents/FocusZone/consts.d.ts.map +1 -1
  28. package/lib/TestComponents/FocusZone/consts.js +11 -0
  29. package/lib/TestComponents/FocusZone/consts.js.map +1 -1
  30. package/lib/TestComponents/FocusZone/styles.d.ts +5 -0
  31. package/lib/TestComponents/FocusZone/styles.d.ts.map +1 -1
  32. package/lib/TestComponents/FocusZone/styles.js +5 -0
  33. package/lib/TestComponents/FocusZone/styles.js.map +1 -1
  34. package/lib-commonjs/E2E/FocusZone/pages/FocusZonePageObject.d.ts +37 -0
  35. package/lib-commonjs/E2E/FocusZone/pages/FocusZonePageObject.d.ts.map +1 -1
  36. package/lib-commonjs/E2E/FocusZone/pages/FocusZonePageObject.js +196 -3
  37. package/lib-commonjs/E2E/FocusZone/pages/FocusZonePageObject.js.map +1 -1
  38. package/lib-commonjs/E2E/FocusZone/specs/FocusZone.spec.win.js +457 -0
  39. package/lib-commonjs/E2E/FocusZone/specs/FocusZone.spec.win.js.map +1 -1
  40. package/lib-commonjs/E2E/common/BasePage.d.ts +2 -0
  41. package/lib-commonjs/E2E/common/BasePage.d.ts.map +1 -1
  42. package/lib-commonjs/E2E/common/BasePage.js +34 -14
  43. package/lib-commonjs/E2E/common/BasePage.js.map +1 -1
  44. package/lib-commonjs/E2E/common/consts.d.ts +15 -0
  45. package/lib-commonjs/E2E/common/consts.d.ts.map +1 -1
  46. package/lib-commonjs/TestComponents/Common/MenuPicker.d.ts +2 -0
  47. package/lib-commonjs/TestComponents/Common/MenuPicker.d.ts.map +1 -1
  48. package/lib-commonjs/TestComponents/Common/MenuPicker.js +2 -2
  49. package/lib-commonjs/TestComponents/Common/MenuPicker.js.map +1 -1
  50. package/lib-commonjs/TestComponents/FocusZone/FocusZoneE2ETest.d.ts +20 -0
  51. package/lib-commonjs/TestComponents/FocusZone/FocusZoneE2ETest.d.ts.map +1 -0
  52. package/lib-commonjs/TestComponents/FocusZone/FocusZoneE2ETest.js +57 -0
  53. package/lib-commonjs/TestComponents/FocusZone/FocusZoneE2ETest.js.map +1 -0
  54. package/lib-commonjs/TestComponents/FocusZone/FocusZoneTest.d.ts.map +1 -1
  55. package/lib-commonjs/TestComponents/FocusZone/FocusZoneTest.js +27 -71
  56. package/lib-commonjs/TestComponents/FocusZone/FocusZoneTest.js.map +1 -1
  57. package/lib-commonjs/TestComponents/FocusZone/consts.d.ts +10 -0
  58. package/lib-commonjs/TestComponents/FocusZone/consts.d.ts.map +1 -1
  59. package/lib-commonjs/TestComponents/FocusZone/consts.js +14 -1
  60. package/lib-commonjs/TestComponents/FocusZone/consts.js.map +1 -1
  61. package/lib-commonjs/TestComponents/FocusZone/styles.d.ts +5 -0
  62. package/lib-commonjs/TestComponents/FocusZone/styles.d.ts.map +1 -1
  63. package/lib-commonjs/TestComponents/FocusZone/styles.js +5 -0
  64. package/lib-commonjs/TestComponents/FocusZone/styles.js.map +1 -1
  65. package/package.json +25 -25
  66. package/src/E2E/FocusZone/pages/FocusZonePageObject.ts +135 -4
  67. package/src/E2E/FocusZone/specs/FocusZone.spec.win.ts +177 -2
  68. package/src/E2E/common/BasePage.ts +8 -3
  69. package/src/E2E/common/consts.ts +17 -0
  70. package/src/TestComponents/Common/MenuPicker.tsx +5 -2
  71. package/src/TestComponents/FocusZone/FocusZoneE2ETest.tsx +126 -0
  72. package/src/TestComponents/FocusZone/FocusZoneTest.tsx +40 -127
  73. package/src/TestComponents/FocusZone/consts.ts +17 -0
  74. package/src/TestComponents/FocusZone/styles.ts +5 -0
@@ -1,19 +1,15 @@
1
1
  import * as React from 'react';
2
- import { View, Switch, ScrollView } from 'react-native';
3
- import { FocusZone, Text, FocusZoneDirection } from '@fluentui/react-native';
4
- import { ButtonV1 as Button, ButtonProps } from '@fluentui-react-native/button';
2
+ import { View, ScrollView } from 'react-native';
3
+ import { FocusZone, FocusZoneDirection, Text } from '@fluentui/react-native';
4
+ import { ButtonV1 as Button } from '@fluentui-react-native/button';
5
5
  import { Checkbox, CheckboxProps } from '@fluentui-react-native/experimental-checkbox';
6
6
  import { Test, TestSection, PlatformStatus } from '../Test';
7
7
  import { FOCUSZONE_TESTPAGE } from './consts';
8
- import { focusZoneTestStyles, GridButton, SubheaderText } from './styles';
9
- import { commonTestStyles } from '../Common/styles';
10
- import { CollectionItem, MenuPicker } from '../Common/MenuPicker';
8
+ import { focusZoneTestStyles, SubheaderText } from './styles';
9
+ import { FocusZone2D, FocusZoneDirections, FocusZoneListWrapper, GridOfButtons } from './FocusZoneE2ETest';
10
+ import { MenuPicker, CollectionItem } from '../Common/MenuPicker';
11
11
 
12
- const FocusZoneDirections: FocusZoneDirection[] = ['bidirectional', 'horizontal', 'vertical', 'none'];
13
- const directionCollection: CollectionItem<FocusZoneDirection>[] = FocusZoneDirections.map((x) => ({
14
- label: x,
15
- value: x,
16
- }));
12
+ const directionCollection: CollectionItem[] = FocusZoneDirections.map((dir) => ({ label: dir, value: dir }));
17
13
 
18
14
  const Checkboxes = (props: CheckboxProps) => {
19
15
  return (
@@ -25,6 +21,34 @@ const Checkboxes = (props: CheckboxProps) => {
25
21
  );
26
22
  };
27
23
 
24
+ const DirectionalFocusZone: React.FunctionComponent = () => {
25
+ const [direction, setDirection] = React.useState<FocusZoneDirection>('none');
26
+
27
+ return (
28
+ <>
29
+ <MenuPicker prompt="Direction" selected={direction} onChange={setDirection} collection={directionCollection} />
30
+ <FocusZone focusZoneDirection={direction}>
31
+ <Checkboxes />
32
+ </FocusZone>
33
+ </>
34
+ );
35
+ };
36
+
37
+ const CommonUsageFocusZone: React.FunctionComponent = () => {
38
+ return (
39
+ <FocusZoneListWrapper>
40
+ <FocusZone isCircularNavigation={true}>
41
+ <SubheaderText>FocusZone with Circular Navigation</SubheaderText>
42
+ <Checkboxes />
43
+ </FocusZone>
44
+ <FocusZone disabled={true}>
45
+ <SubheaderText>Disabled FocusZone</SubheaderText>
46
+ <Checkboxes />
47
+ </FocusZone>
48
+ </FocusZoneListWrapper>
49
+ );
50
+ };
51
+
28
52
  const FocusZoneInsideScrollView: React.FunctionComponent = () => {
29
53
  return (
30
54
  <FocusZoneListWrapper>
@@ -86,131 +110,16 @@ const NestedFocusZone: React.FunctionComponent = () => {
86
110
  );
87
111
  };
88
112
 
89
- const FocusZoneListWrapper = (props) => {
90
- const buttonProps: ButtonProps = { children: 'Click to Focus', style: focusZoneTestStyles.listWrapperButton };
91
- return (
92
- <>
93
- <Button {...buttonProps} />
94
- {React.Children.map(props.children, (child) => {
95
- return (
96
- <>
97
- {child}
98
- <Button {...buttonProps} />
99
- </>
100
- );
101
- })}
102
- </>
103
- );
104
- };
105
-
106
- const DirectionalFocusZone: React.FunctionComponent = () => {
107
- const [direction, setDirection] = React.useState<FocusZoneDirection>('none');
108
-
109
- return (
110
- <>
111
- <MenuPicker prompt="Direction" selected={direction} onChange={setDirection} collection={directionCollection} />
112
- <FocusZone focusZoneDirection={direction}>
113
- <Checkboxes />
114
- </FocusZone>
115
- </>
116
- );
117
- };
118
-
119
- const CommonUsageFocusZone: React.FunctionComponent = () => {
120
- return (
121
- <FocusZoneListWrapper>
122
- <FocusZone isCircularNavigation={true}>
123
- <SubheaderText>FocusZone with Circular Navigation</SubheaderText>
124
- <Checkboxes />
125
- </FocusZone>
126
- <FocusZone disabled={true}>
127
- <SubheaderText>Disabled FocusZone</SubheaderText>
128
- <Checkboxes />
129
- </FocusZone>
130
- </FocusZoneListWrapper>
131
- );
132
- };
133
-
134
- type GridOfButtonsProps = {
135
- gridWidth: number;
136
- gridHeight: number;
137
- };
138
-
139
- const GridOfButtons: React.FunctionComponent<GridOfButtonsProps> = (props: GridOfButtonsProps) => {
140
- return (
141
- <View style={focusZoneTestStyles.dashedBorder}>
142
- {[...Array(props.gridHeight)].map((_value, heightIndex: number) => {
143
- return (
144
- <View key={heightIndex} style={focusZoneTestStyles.focusZoneViewStyle}>
145
- {[...Array(props.gridWidth)].map((_value, widthIndex: number) => {
146
- const gridIndex = heightIndex * props.gridWidth + widthIndex + 1;
147
- return (
148
- <GridButton key={widthIndex} style={focusZoneTestStyles.focusZoneButton}>
149
- <Text>{gridIndex}</Text>
150
- </GridButton>
151
- );
152
- })}
153
- </View>
154
- );
155
- })}
156
- </View>
157
- );
158
- };
159
-
160
- interface ISwitchWithLabelProps {
161
- label: string;
162
- value: boolean;
163
- onValueChange: (value: boolean) => void;
164
- }
165
-
166
- function SwitchWithLabel(props: ISwitchWithLabelProps): React.ReactElement {
167
- const { label, value, onValueChange } = props;
168
- return (
169
- <View style={commonTestStyles.switch}>
170
- <Text>{label}</Text>
171
- <Switch value={value} onValueChange={onValueChange} />
172
- </View>
173
- );
174
- }
175
-
176
- const FocusZone2D: React.FunctionComponent = () => {
177
- const [is2DNav, set2dNav] = React.useState(false);
178
- const [isDisabled, setDisabled] = React.useState(false);
179
- const [isCircularNav, setIsCircularNav] = React.useState(false);
180
- const [direction, setDirection] = React.useState<FocusZoneDirection>('bidirectional');
181
-
182
- return (
183
- <View style={commonTestStyles.root}>
184
- <View style={commonTestStyles.settings}>
185
- <SwitchWithLabel label="2D Navigation" value={is2DNav} onValueChange={set2dNav} />
186
- <SwitchWithLabel label="Disabled" value={isDisabled} onValueChange={setDisabled} />
187
- <SwitchWithLabel label="Circular Navigation" value={isCircularNav} onValueChange={setIsCircularNav} />
188
- <MenuPicker prompt="Direction" selected={direction} onChange={setDirection} collection={directionCollection} />
189
- </View>
190
-
191
- <FocusZoneListWrapper>
192
- <FocusZone disabled={isDisabled} use2DNavigation={is2DNav} focusZoneDirection={direction} isCircularNavigation={isCircularNav}>
193
- <GridOfButtons gridWidth={3} gridHeight={3} />
194
- </FocusZone>
195
- </FocusZoneListWrapper>
196
- </View>
197
- );
198
- };
199
-
200
113
  const focusZoneSections: TestSection[] = [
201
114
  {
202
115
  name: 'Common FocusZone Usage',
203
116
  component: CommonUsageFocusZone,
117
+ testID: FOCUSZONE_TESTPAGE,
204
118
  },
205
119
  {
206
120
  name: 'Directional FocusZone Usage',
207
- testID: FOCUSZONE_TESTPAGE,
208
121
  component: DirectionalFocusZone,
209
122
  },
210
- {
211
- name: '2D Navigation',
212
- component: FocusZone2D,
213
- },
214
123
  {
215
124
  name: 'ScrollView inside FocusZone',
216
125
  component: FocusZoneInsideScrollView,
@@ -227,6 +136,10 @@ const focusZoneSections: TestSection[] = [
227
136
  name: 'Nested FocusZone',
228
137
  component: NestedFocusZone,
229
138
  },
139
+ {
140
+ name: '2D Navigation + E2E Testing',
141
+ component: FocusZone2D,
142
+ },
230
143
  ];
231
144
 
232
145
  export const FocusZoneTest: React.FunctionComponent = () => {
@@ -1,3 +1,5 @@
1
+ import { FocusZoneDirection } from '@fluentui/react-native';
2
+
1
3
  export const HOMEPAGE_FOCUSZONE_BUTTON = 'Homepage_FocusZone_Button';
2
4
  export const FOCUSZONE_TESTPAGE = 'FocusZone_TestPage';
3
5
 
@@ -6,3 +8,18 @@ export const FOCUSZONE_TEST_COMPONENT = 'FocusZone_Test_Component'; // A compone
6
8
 
7
9
  /* E2E Testing FocusZone 2 */
8
10
  export const FOCUSZONE_SECOND_TEST_COMPONENT = 'FocusZone_Second_Test_Component';
11
+
12
+ /* FocusZone List Wrapper Buttons Keys */
13
+ export const FOCUSZONE_GRID_BEFORE = 'FocusZone_Grid_Before';
14
+ export const FOCUSZONE_GRID_AFTER = 'FocusZone_Grid_After';
15
+
16
+ /* Grid Button Test IDs */
17
+ export const FOCUSZONE_GRID_BUTTON = (idx: number) => `FocusZone_GridButton_${idx}`;
18
+
19
+ export const FOCUSZONE_TWO_DIM_SWITCH = 'FocusZone_2D_Switch';
20
+ export const FOCUSZONE_DISABLED_SWITCH = 'FocusZone_Disabled_Switch';
21
+ export const FOCUSZONE_DEFAULT_TABBABLE_SWITCH = 'FocusZone_Default_Tabbable_Switch';
22
+ export const FOCUSZONE_CIRCLE_NAV_SWITCH = 'FocusZone_Circular_Navigation_Switch';
23
+
24
+ export const FOCUSZONE_DIRECTION_PICKER = 'FocusZone_Direction_Picker';
25
+ export const FOCUSZONE_DIRECTION_ID = (direction: FocusZoneDirection) => `FocusZone_Direction_Opt_${direction}`;
@@ -27,6 +27,11 @@ export const focusZoneTestStyles = StyleSheet.create({
27
27
  borderWidth: 1,
28
28
  borderStyle: 'dashed',
29
29
  },
30
+ radioGroup: {
31
+ display: 'flex',
32
+ flexDirection: 'row',
33
+ fontSize: 12,
34
+ },
30
35
  scrollViewStyle: {
31
36
  height: 100,
32
37
  width: 300,