@fluentui-react-native/tester 0.56.1 → 0.58.1

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 (143) hide show
  1. package/CHANGELOG.json +278 -1
  2. package/CHANGELOG.md +70 -2
  3. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts +11 -0
  4. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts.map +1 -0
  5. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js +57 -0
  6. package/lib/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js.map +1 -0
  7. package/lib/E2E/common/NativeTesting/specs/NativeTesting.spec.win.d.ts +2 -0
  8. package/lib/E2E/common/NativeTesting/specs/NativeTesting.spec.win.d.ts.map +1 -0
  9. package/lib/E2E/common/NativeTesting/specs/NativeTesting.spec.win.js +26 -0
  10. package/lib/E2E/common/NativeTesting/specs/NativeTesting.spec.win.js.map +1 -0
  11. package/lib/FluentTester/FluentTester.d.ts.map +1 -1
  12. package/lib/FluentTester/FluentTester.js +8 -8
  13. package/lib/FluentTester/FluentTester.js.map +1 -1
  14. package/lib/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.d.ts.map +1 -1
  15. package/lib/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.js +28 -23
  16. package/lib/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.js.map +1 -1
  17. package/lib/FluentTester/TestComponents/Avatar/CustomizedAvatar.d.ts.map +1 -1
  18. package/lib/FluentTester/TestComponents/Avatar/CustomizedAvatar.js +24 -29
  19. package/lib/FluentTester/TestComponents/Avatar/CustomizedAvatar.js.map +1 -1
  20. package/lib/FluentTester/TestComponents/Badge/BadgeTest.d.ts.map +1 -1
  21. package/lib/FluentTester/TestComponents/Badge/BadgeTest.js +9 -9
  22. package/lib/FluentTester/TestComponents/Badge/BadgeTest.js.map +1 -1
  23. package/lib/FluentTester/TestComponents/Button/ButtonHOCTestSection.d.ts.map +1 -1
  24. package/lib/FluentTester/TestComponents/Button/ButtonHOCTestSection.js +6 -1
  25. package/lib/FluentTester/TestComponents/Button/ButtonHOCTestSection.js.map +1 -1
  26. package/lib/FluentTester/TestComponents/Checkbox/CheckboxTest.js +27 -27
  27. package/lib/FluentTester/TestComponents/Checkbox/CheckboxTest.js.map +1 -1
  28. package/lib/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.d.ts.map +1 -1
  29. package/lib/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.js +27 -25
  30. package/lib/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.js.map +1 -1
  31. package/lib/FluentTester/TestComponents/CheckboxExperimental/E2ECheckboxExperimentalTest.js +1 -1
  32. package/lib/FluentTester/TestComponents/CheckboxExperimental/E2ECheckboxExperimentalTest.js.map +1 -1
  33. package/lib/FluentTester/TestComponents/ContextualMenu/ContextualMenuTest.js +2 -2
  34. package/lib/FluentTester/TestComponents/ContextualMenu/ContextualMenuTest.js.map +1 -1
  35. package/lib/FluentTester/TestComponents/Expander/ExpanderTest.d.ts.map +1 -1
  36. package/lib/FluentTester/TestComponents/Expander/ExpanderTest.js +22 -22
  37. package/lib/FluentTester/TestComponents/Expander/ExpanderTest.js.map +1 -1
  38. package/lib/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.d.ts.map +1 -1
  39. package/lib/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.js +11 -11
  40. package/lib/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.js.map +1 -1
  41. package/lib/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.d.ts.map +1 -1
  42. package/lib/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.js +11 -11
  43. package/lib/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.js.map +1 -1
  44. package/lib/FluentTester/TestComponents/Persona/CustomizeUsage.d.ts.map +1 -1
  45. package/lib/FluentTester/TestComponents/Persona/CustomizeUsage.js +13 -26
  46. package/lib/FluentTester/TestComponents/Persona/CustomizeUsage.js.map +1 -1
  47. package/lib/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.d.ts.map +1 -1
  48. package/lib/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.js +24 -29
  49. package/lib/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.js.map +1 -1
  50. package/lib/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.d.ts.map +1 -1
  51. package/lib/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.js +11 -20
  52. package/lib/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.js.map +1 -1
  53. package/lib/FluentTester/TestComponents/Shimmer/ShimmerTest.d.ts +2 -0
  54. package/lib/FluentTester/TestComponents/Shimmer/ShimmerTest.d.ts.map +1 -1
  55. package/lib/FluentTester/TestComponents/Shimmer/ShimmerTest.js +21 -9
  56. package/lib/FluentTester/TestComponents/Shimmer/ShimmerTest.js.map +1 -1
  57. package/lib/FluentTester/TestComponents/Text/CustomizeUsage.d.ts.map +1 -1
  58. package/lib/FluentTester/TestComponents/Text/CustomizeUsage.js +36 -36
  59. package/lib/FluentTester/TestComponents/Text/CustomizeUsage.js.map +1 -1
  60. package/lib/FluentTester/TestComponents/TextExperimental/CustomizeUsage.d.ts.map +1 -1
  61. package/lib/FluentTester/TestComponents/TextExperimental/CustomizeUsage.js +36 -36
  62. package/lib/FluentTester/TestComponents/TextExperimental/CustomizeUsage.js.map +1 -1
  63. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts +11 -0
  64. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.d.ts.map +1 -0
  65. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js +59 -0
  66. package/lib-commonjs/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.js.map +1 -0
  67. package/lib-commonjs/E2E/common/NativeTesting/specs/NativeTesting.spec.win.d.ts +2 -0
  68. package/lib-commonjs/E2E/common/NativeTesting/specs/NativeTesting.spec.win.d.ts.map +1 -0
  69. package/lib-commonjs/E2E/common/NativeTesting/specs/NativeTesting.spec.win.js +29 -0
  70. package/lib-commonjs/E2E/common/NativeTesting/specs/NativeTesting.spec.win.js.map +1 -0
  71. package/lib-commonjs/FluentTester/FluentTester.d.ts.map +1 -1
  72. package/lib-commonjs/FluentTester/FluentTester.js +8 -8
  73. package/lib-commonjs/FluentTester/FluentTester.js.map +1 -1
  74. package/lib-commonjs/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.d.ts.map +1 -1
  75. package/lib-commonjs/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.js +28 -23
  76. package/lib-commonjs/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.js.map +1 -1
  77. package/lib-commonjs/FluentTester/TestComponents/Avatar/CustomizedAvatar.d.ts.map +1 -1
  78. package/lib-commonjs/FluentTester/TestComponents/Avatar/CustomizedAvatar.js +24 -29
  79. package/lib-commonjs/FluentTester/TestComponents/Avatar/CustomizedAvatar.js.map +1 -1
  80. package/lib-commonjs/FluentTester/TestComponents/Badge/BadgeTest.d.ts.map +1 -1
  81. package/lib-commonjs/FluentTester/TestComponents/Badge/BadgeTest.js +9 -9
  82. package/lib-commonjs/FluentTester/TestComponents/Badge/BadgeTest.js.map +1 -1
  83. package/lib-commonjs/FluentTester/TestComponents/Button/ButtonHOCTestSection.d.ts.map +1 -1
  84. package/lib-commonjs/FluentTester/TestComponents/Button/ButtonHOCTestSection.js +6 -1
  85. package/lib-commonjs/FluentTester/TestComponents/Button/ButtonHOCTestSection.js.map +1 -1
  86. package/lib-commonjs/FluentTester/TestComponents/Checkbox/CheckboxTest.js +27 -27
  87. package/lib-commonjs/FluentTester/TestComponents/Checkbox/CheckboxTest.js.map +1 -1
  88. package/lib-commonjs/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.d.ts.map +1 -1
  89. package/lib-commonjs/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.js +27 -25
  90. package/lib-commonjs/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.js.map +1 -1
  91. package/lib-commonjs/FluentTester/TestComponents/CheckboxExperimental/E2ECheckboxExperimentalTest.js +1 -1
  92. package/lib-commonjs/FluentTester/TestComponents/CheckboxExperimental/E2ECheckboxExperimentalTest.js.map +1 -1
  93. package/lib-commonjs/FluentTester/TestComponents/ContextualMenu/ContextualMenuTest.js +2 -2
  94. package/lib-commonjs/FluentTester/TestComponents/ContextualMenu/ContextualMenuTest.js.map +1 -1
  95. package/lib-commonjs/FluentTester/TestComponents/Expander/ExpanderTest.d.ts.map +1 -1
  96. package/lib-commonjs/FluentTester/TestComponents/Expander/ExpanderTest.js +22 -22
  97. package/lib-commonjs/FluentTester/TestComponents/Expander/ExpanderTest.js.map +1 -1
  98. package/lib-commonjs/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.d.ts.map +1 -1
  99. package/lib-commonjs/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.js +11 -11
  100. package/lib-commonjs/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.js.map +1 -1
  101. package/lib-commonjs/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.d.ts.map +1 -1
  102. package/lib-commonjs/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.js +11 -11
  103. package/lib-commonjs/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.js.map +1 -1
  104. package/lib-commonjs/FluentTester/TestComponents/Persona/CustomizeUsage.d.ts.map +1 -1
  105. package/lib-commonjs/FluentTester/TestComponents/Persona/CustomizeUsage.js +13 -26
  106. package/lib-commonjs/FluentTester/TestComponents/Persona/CustomizeUsage.js.map +1 -1
  107. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.d.ts.map +1 -1
  108. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.js +24 -29
  109. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.js.map +1 -1
  110. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.d.ts.map +1 -1
  111. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.js +11 -20
  112. package/lib-commonjs/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.js.map +1 -1
  113. package/lib-commonjs/FluentTester/TestComponents/Shimmer/ShimmerTest.d.ts +2 -0
  114. package/lib-commonjs/FluentTester/TestComponents/Shimmer/ShimmerTest.d.ts.map +1 -1
  115. package/lib-commonjs/FluentTester/TestComponents/Shimmer/ShimmerTest.js +24 -10
  116. package/lib-commonjs/FluentTester/TestComponents/Shimmer/ShimmerTest.js.map +1 -1
  117. package/lib-commonjs/FluentTester/TestComponents/Text/CustomizeUsage.d.ts.map +1 -1
  118. package/lib-commonjs/FluentTester/TestComponents/Text/CustomizeUsage.js +36 -36
  119. package/lib-commonjs/FluentTester/TestComponents/Text/CustomizeUsage.js.map +1 -1
  120. package/lib-commonjs/FluentTester/TestComponents/TextExperimental/CustomizeUsage.d.ts.map +1 -1
  121. package/lib-commonjs/FluentTester/TestComponents/TextExperimental/CustomizeUsage.js +36 -36
  122. package/lib-commonjs/FluentTester/TestComponents/TextExperimental/CustomizeUsage.js.map +1 -1
  123. package/package.json +24 -24
  124. package/src/E2E/common/NativeTesting/pages/NativeTestingPageObject.win.ts +56 -0
  125. package/src/E2E/common/NativeTesting/specs/NativeTesting.spec.win.ts +28 -0
  126. package/src/FluentTester/FluentTester.tsx +10 -10
  127. package/src/FluentTester/TestComponents/ActivityIndicator/ActivityIndicatorTest.tsx +36 -26
  128. package/src/FluentTester/TestComponents/Avatar/CustomizedAvatar.tsx +25 -31
  129. package/src/FluentTester/TestComponents/Badge/BadgeTest.tsx +11 -11
  130. package/src/FluentTester/TestComponents/Button/ButtonHOCTestSection.tsx +8 -1
  131. package/src/FluentTester/TestComponents/Checkbox/CheckboxTest.tsx +29 -29
  132. package/src/FluentTester/TestComponents/CheckboxExperimental/CheckboxTest.tsx +34 -26
  133. package/src/FluentTester/TestComponents/CheckboxExperimental/E2ECheckboxExperimentalTest.tsx +1 -1
  134. package/src/FluentTester/TestComponents/ContextualMenu/ContextualMenuTest.tsx +3 -3
  135. package/src/FluentTester/TestComponents/Expander/ExpanderTest.tsx +23 -22
  136. package/src/FluentTester/TestComponents/MenuButton/CustomizedMenuButtonTest.tsx +12 -11
  137. package/src/FluentTester/TestComponents/MenuButtonExperimental/CustomizedMenuButtonTest.tsx +12 -11
  138. package/src/FluentTester/TestComponents/Persona/CustomizeUsage.tsx +15 -28
  139. package/src/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.mobile.tsx +12 -22
  140. package/src/FluentTester/TestComponents/PersonaCoin/CustomizeUsage.tsx +25 -31
  141. package/src/FluentTester/TestComponents/Shimmer/ShimmerTest.tsx +50 -10
  142. package/src/FluentTester/TestComponents/Text/CustomizeUsage.tsx +42 -42
  143. package/src/FluentTester/TestComponents/TextExperimental/CustomizeUsage.tsx +42 -42
@@ -0,0 +1,56 @@
1
+ import { BasePage, By } from '../../../common/BasePage.win';
2
+
3
+ const ScrollViewTestId = 'SCROLLVIEW_TEST_ID';
4
+
5
+ class NativeTestingPageObject extends BasePage {
6
+ waitForScrollViewDisplayed(timeout?: number): void {
7
+ browser.waitUntil(
8
+ () => {
9
+ return this.doesScrollViewParentExist();
10
+ },
11
+ {
12
+ timeout: timeout ?? this.waitForPageTimeout,
13
+ timeoutMsg:
14
+ 'For testing purposes we require that the root view contains a non-empty, immutable ScrollView of buttons that navigate to test pages.',
15
+ interval: 1000,
16
+ },
17
+ );
18
+ }
19
+
20
+ doesScrollViewParentExist(): boolean {
21
+ return this._scrollViewParent.isExisting();
22
+ }
23
+
24
+ /* Validate the Children of the ScrollView stay intact. The children are the buttons that
25
+ * navigate to each test page. Also, validate these children exist with the proper testId format */
26
+ validateScrollViewChildren(): boolean {
27
+ // Gets all the children
28
+ const testChildren = this._scrollViewParent.$$('//*');
29
+ let foundValidButton = false;
30
+
31
+ // Ensure the testID (maps 1:1 to automationId) properties of the button children match the defined testing format
32
+ const reg = new RegExp('Homepage_[a-zA-Z]*_Button');
33
+
34
+ // Iterate through children. Validate at least one valid button exists as a child to the ScrollView.
35
+ // If automationId is found in the wrong format, return false.
36
+ for (const child of testChildren) {
37
+ const autoId = child.getAttribute('AutomationId');
38
+ if (autoId && autoId !== ScrollViewTestId) {
39
+ if (autoId.match(reg)) {
40
+ foundValidButton = true;
41
+ } else {
42
+ // The correct format for testId was not followed. Return a failure.
43
+ return false;
44
+ }
45
+ }
46
+ }
47
+
48
+ return foundValidButton;
49
+ }
50
+
51
+ get _scrollViewParent() {
52
+ return By(ScrollViewTestId);
53
+ }
54
+ }
55
+
56
+ export default new NativeTestingPageObject();
@@ -0,0 +1,28 @@
1
+ import NavigateAppPage from '../../../common/NavigateAppPage.win';
2
+ import NativeTestingPageObject from '../pages/NativeTestingPageObject.win';
3
+ import { PAGE_TIMEOUT, BOOT_APP_TIMEOUT } from '../../../common/consts';
4
+
5
+ describe('Native Safety Check Testing Initialization', () => {
6
+ it('Wait for app load', () => {
7
+ NavigateAppPage.waitForPageDisplayed(BOOT_APP_TIMEOUT);
8
+ expect(NavigateAppPage.isPageLoaded()).toBeTruthy(NavigateAppPage.ERRORMESSAGE_APPLOAD);
9
+ });
10
+
11
+ // The ScrollView in testing is the one that contains all the buttons that navigate to each component's
12
+ // test page. This is vital for our native testing, as we grab this ScrollView on the native side and
13
+ // to climb down the UI tree and find all of FURN's testable components.
14
+ // We need to make sure this ScrollView:
15
+ // 1) Continues to parent all the test buttons
16
+ // 2) Keeps testID='SCROLLVIEW_TEST_ID'
17
+ it('Validate the ScrollView containing all the navigational buttons exists', () => {
18
+ NativeTestingPageObject.waitForScrollViewDisplayed(PAGE_TIMEOUT);
19
+ expect(NativeTestingPageObject.doesScrollViewParentExist()).toBeTruthy();
20
+ });
21
+
22
+ // In addition to existing, we want to ensure the Children of the ScrollView stay intact. The children are the buttons that
23
+ // navigate to each test page. Validate these children exist with the proper testId format.
24
+ it('Validate the children of ScrollView are the buttons that navigate to each test page with proper automationId', () => {
25
+ NativeTestingPageObject.waitForScrollViewDisplayed(PAGE_TIMEOUT);
26
+ expect(NativeTestingPageObject.validateScrollViewChildren()).toBeTruthy();
27
+ });
28
+ });
@@ -44,6 +44,16 @@ const getThemedStyles = themedStyleSheet((t: Theme) => {
44
44
  };
45
45
  });
46
46
 
47
+ const HeaderSeparator = Separator.customize((t) => ({
48
+ color: t.colors.bodyFrameDivider,
49
+ separatorWidth: 2,
50
+ }));
51
+
52
+ const TestListSeparator = Separator.customize((t) => ({
53
+ color: t.colors.menuDivider,
54
+ separatorWidth: 2,
55
+ }));
56
+
47
57
  export const FluentTester: React.FunctionComponent<FluentTesterProps> = (props: FluentTesterProps) => {
48
58
  // sort tests alphabetically by name
49
59
  const sortedTestComponents = props.enabledTests.sort((a, b) => a.name.localeCompare(b.name));
@@ -66,16 +76,6 @@ export const FluentTester: React.FunctionComponent<FluentTesterProps> = (props:
66
76
 
67
77
  const TestComponent = selectedTestIndex == -1 ? EmptyComponent : sortedTestComponents[selectedTestIndex].component;
68
78
 
69
- const HeaderSeparator = Separator.customize((t) => ({
70
- color: t.colors.bodyFrameDivider,
71
- separatorWidth: 2,
72
- }));
73
-
74
- const TestListSeparator = Separator.customize((t) => ({
75
- color: t.colors.menuDivider,
76
- separatorWidth: 2,
77
- }));
78
-
79
79
  const themedStyles = getThemedStyles(useTheme());
80
80
 
81
81
  const RootView = Platform.select({
@@ -7,14 +7,30 @@ import { Test, TestSection, PlatformStatus } from '../Test';
7
7
  import { ACTIVITY_INDICATOR_TESTPAGE } from './consts';
8
8
  import { View, Switch } from 'react-native';
9
9
 
10
+ const basicActivityIndicator: React.FunctionComponent = () => {
11
+ const [animating, setAnimating] = React.useState(true);
12
+ const [hidesWhenStopped, setHidesWhenStopped] = React.useState(true);
13
+
14
+ return (
15
+ <Stack style={stackStyle}>
16
+ <View style={commonStyles.root}>
17
+ <View style={commonStyles.settings}>
18
+ <View style={commonStyles.switch}>
19
+ <Text>Animating</Text>
20
+ <Switch value={animating} onValueChange={setAnimating} />
21
+ </View>
22
+ <View style={commonStyles.switch}>
23
+ <Text>HidesWhenStopped</Text>
24
+ <Switch value={hidesWhenStopped} onValueChange={setHidesWhenStopped} />
25
+ </View>
26
+ </View>
27
+ <ActivityIndicator animating={animating} hidesWhenStopped={hidesWhenStopped} />
28
+ </View>
29
+ </Stack>
30
+ );
31
+ };
32
+
10
33
  const activityIndicatorTest: React.FunctionComponent = () => {
11
- /** Customize doesn't do anything
12
- * Tried having tokens not be props, but didn't work
13
- * Not sure how to test/check where the tokens are passed through other than just looking at the final render
14
- */
15
- const CustomizedActivityIndicator = ActivityIndicator.customize({
16
- activityIndicatorColor: 'orange',
17
- });
18
34
  return (
19
35
  <Stack style={stackStyle}>
20
36
  <Text>Extra Small</Text>
@@ -32,38 +48,27 @@ const activityIndicatorTest: React.FunctionComponent = () => {
32
48
  <ActivityIndicator size="xLarge" lineThickness="large" />
33
49
  <Text>Color props</Text>
34
50
  <ActivityIndicator activityIndicatorColor="orange" accessibilityLabel="orange progressbar" />
35
- <Text>Customized Activity Indicator (currently not working)</Text>
36
- <CustomizedActivityIndicator />
37
51
  </Stack>
38
52
  );
39
53
  };
40
54
 
41
- const basicActivityIndicator: React.FunctionComponent = () => {
42
- const [animating, setAnimating] = React.useState(true);
43
- const [hidesWhenStopped, setHidesWhenStopped] = React.useState(true);
55
+ const CustomizedActivityIndicator = ActivityIndicator.customize({
56
+ activityIndicatorColor: 'orange',
57
+ size: 'large',
58
+ });
44
59
 
60
+ const customizedActivityIndicatorTest: React.FunctionComponent = () => {
45
61
  return (
46
62
  <Stack style={stackStyle}>
47
- <View style={commonStyles.root}>
48
- <View style={commonStyles.settings}>
49
- <View style={commonStyles.switch}>
50
- <Text>Animating</Text>
51
- <Switch value={animating} onValueChange={setAnimating} />
52
- </View>
53
- <View style={commonStyles.switch}>
54
- <Text>HidesWhenStopped</Text>
55
- <Switch value={hidesWhenStopped} onValueChange={setHidesWhenStopped} />
56
- </View>
57
- </View>
58
- <ActivityIndicator animating={animating} hidesWhenStopped={hidesWhenStopped} />
59
- </View>
63
+ <Text>Customized Activity Indicator</Text>
64
+ <CustomizedActivityIndicator />
60
65
  </Stack>
61
66
  );
62
67
  };
63
68
 
64
69
  const activityIndicatorSections: TestSection[] = [
65
70
  {
66
- name: 'BaseActivityIndicator',
71
+ name: 'Base ActivityIndicator',
67
72
  testID: ACTIVITY_INDICATOR_TESTPAGE,
68
73
  component: basicActivityIndicator,
69
74
  },
@@ -72,6 +77,11 @@ const activityIndicatorSections: TestSection[] = [
72
77
  testID: ACTIVITY_INDICATOR_TESTPAGE,
73
78
  component: activityIndicatorTest,
74
79
  },
80
+ {
81
+ name: 'Customized ActivityIndicator',
82
+ testID: ACTIVITY_INDICATOR_TESTPAGE,
83
+ component: customizedActivityIndicatorTest,
84
+ },
75
85
  ];
76
86
 
77
87
  export const ActivityIndicatorTest: React.FunctionComponent = () => {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { JSAvatar, IconAlignment, JSAvatarTokens } from '@fluentui-react-native/experimental-avatar';
2
+ import { JSAvatar, IconAlignment } from '@fluentui-react-native/experimental-avatar';
3
3
  import { Switch, View, Text, TextInput, TextStyle } from 'react-native';
4
4
  import { Slider } from '../Common/Slider';
5
5
  import { steveBallmerPhotoUrl } from './../PersonaCoin/styles';
@@ -29,36 +29,30 @@ export const CustomizeUsage: React.FunctionComponent = () => {
29
29
  borderColor: theme.colors.inputBorder,
30
30
  };
31
31
 
32
- const tokens: JSAvatarTokens = {};
33
- if (coinColor) {
34
- tokens.backgroundColor = coinColor;
35
- }
36
- if (textColor) {
37
- tokens.color = textColor;
38
- }
39
- if (horizontalAlignment) {
40
- tokens.horizontalIconAlignment = horizontalAlignment;
41
- }
42
- if (verticalAlignment) {
43
- tokens.verticalIconAlignment = verticalAlignment;
44
- }
45
- if (iconSize) {
46
- tokens.iconSize = iconSize;
47
- }
48
- if (iconStrokeWidth) {
49
- tokens.iconStrokeWidth = iconStrokeWidth;
50
- }
51
- if (iconStrokeColor) {
52
- tokens.iconStrokeColor = iconStrokeColor;
53
- }
54
- if (initialsSize) {
55
- tokens.initialsSize = initialsSize;
56
- }
57
- if (physicalSize) {
58
- tokens.avatarSize = physicalSize;
59
- }
60
-
61
- const CustomizedAvatar = JSAvatar.customize(tokens);
32
+ const CustomizedAvatar = React.useMemo(() => {
33
+ const tokens = {
34
+ backgroundColor: coinColor,
35
+ color: textColor,
36
+ horizontalIconAlignment: horizontalAlignment,
37
+ verticalIconAlignment: verticalAlignment,
38
+ iconSize: iconSize,
39
+ iconStrokeWidth: iconStrokeWidth,
40
+ iconStrokeColor: iconStrokeColor,
41
+ initialsSize: initialsSize,
42
+ avatarSize: physicalSize,
43
+ };
44
+ return JSAvatar.customize(tokens);
45
+ }, [
46
+ coinColor,
47
+ textColor,
48
+ horizontalAlignment,
49
+ verticalAlignment,
50
+ iconSize,
51
+ iconStrokeWidth,
52
+ iconStrokeColor,
53
+ initialsSize,
54
+ physicalSize,
55
+ ]);
62
56
 
63
57
  return (
64
58
  <View style={commonStyles.root}>
@@ -8,6 +8,17 @@ import BadgeSvg from './oof.svg';
8
8
 
9
9
  import { SvgIconProps } from '@fluentui-react-native/icon';
10
10
 
11
+ const BadgeNoBorder = Badge.customize({
12
+ borderColor: 'transparent',
13
+ borderWidth: 0,
14
+ });
15
+
16
+ const StyledBadge = Badge.customize({
17
+ backgroundColor: 'yellow',
18
+ borderColor: '#f09',
19
+ borderWidth: 4,
20
+ });
21
+
11
22
  export const BasicBadge: React.FunctionComponent = () => {
12
23
  const svgProps: SvgIconProps = {
13
24
  src: BadgeSvg,
@@ -20,17 +31,6 @@ export const BasicBadge: React.FunctionComponent = () => {
20
31
  fontSize: 16,
21
32
  };
22
33
 
23
- const BadgeNoBorder = Badge.customize({
24
- borderColor: 'transparent',
25
- borderWidth: 0,
26
- });
27
-
28
- const StyledBadge = Badge.customize({
29
- backgroundColor: 'yellow',
30
- borderColor: '#f09',
31
- borderWidth: 4,
32
- });
33
-
34
34
  const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
35
35
  const iconProps = { svgSource: svgProps, width: 20, height: 20 };
36
36
 
@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
  import { Platform, View } from 'react-native';
6
6
  import { commonTestStyles, stackStyle } from '../Common/styles';
7
7
  import TestSvg from './test.svg';
8
+ import { InteractionEvent, isGestureResponderEvent } from '@fluentui-react-native/interactive-hooks';
8
9
 
9
10
  const CustomText = Text.customize({ fontSize: 'header', color: 'hotpink' });
10
11
  const CustomButton = Button.customize({ backgroundColor: 'pink' });
@@ -38,7 +39,13 @@ export const ButtonHOCTest: React.FunctionComponent = () => {
38
39
  {svgIconsEnabled && <CustomIconButton icon={{ svgSource: svgProps }}>Customized Icon Button</CustomIconButton>}
39
40
  <Button
40
41
  style={commonTestStyles.vmargin}
41
- onClick={() => {
42
+ onClick={(e: InteractionEvent) => {
43
+ console.log(e.timeStamp);
44
+
45
+ if (isGestureResponderEvent(e)) {
46
+ console.log('I was clicked!');
47
+ }
48
+
42
49
  if (buttonRef.current) {
43
50
  buttonRef.current.focus();
44
51
  }
@@ -53,41 +53,41 @@ const otherCheckbox: React.FunctionComponent = () => {
53
53
  );
54
54
  };
55
55
 
56
- const tokenCheckbox: React.FunctionComponent = () => {
57
- const CircularCheckbox = Checkbox.customize({ tokens: { borderRadius: 50 } });
58
-
59
- const CircleColorCheckbox = Checkbox.customize({
60
- tokens: { borderRadius: 50, checkboxBackgroundColor: 'white' },
61
- _overrides: {
62
- checked: {
63
- tokens: {
64
- checkboxBackgroundColor: 'green',
65
- checkboxBorderColor: 'green',
66
- checkmarkColor: 'white',
67
- },
56
+ const CircularCheckbox = Checkbox.customize({ tokens: { borderRadius: 50 } });
57
+
58
+ const CircleColorCheckbox = Checkbox.customize({
59
+ tokens: { borderRadius: 50, checkboxBackgroundColor: 'white' },
60
+ _overrides: {
61
+ checked: {
62
+ tokens: {
63
+ checkboxBackgroundColor: 'green',
64
+ checkboxBorderColor: 'green',
65
+ checkmarkColor: 'white',
68
66
  },
69
- focused: { tokens: { checkboxBackgroundColor: 'menuItemBackgroundHovered' } },
70
- hovered: { tokens: { checkboxBackgroundColor: 'menuItemBackgroundHovered' } },
71
- pressed: { tokens: { checkboxBackgroundColor: 'menuItemBackgroundPressed' } },
72
67
  },
73
- });
74
-
75
- const HoverCheckbox = Checkbox.customize({
76
- _overrides: {
77
- checked: {
78
- tokens: {
79
- checkboxBackgroundColor: 'black',
80
- checkmarkColor: 'white',
81
- },
68
+ focused: { tokens: { checkboxBackgroundColor: 'menuItemBackgroundHovered' } },
69
+ hovered: { tokens: { checkboxBackgroundColor: 'menuItemBackgroundHovered' } },
70
+ pressed: { tokens: { checkboxBackgroundColor: 'menuItemBackgroundPressed' } },
71
+ },
72
+ });
73
+
74
+ const HoverCheckbox = Checkbox.customize({
75
+ _overrides: {
76
+ checked: {
77
+ tokens: {
78
+ checkboxBackgroundColor: 'black',
79
+ checkmarkColor: 'white',
82
80
  },
83
- hovered: {
84
- tokens: {
85
- checkmarkVisibility: 1,
86
- },
81
+ },
82
+ hovered: {
83
+ tokens: {
84
+ checkmarkVisibility: 1,
87
85
  },
88
86
  },
89
- });
87
+ },
88
+ });
90
89
 
90
+ const tokenCheckbox: React.FunctionComponent = () => {
91
91
  const [checkboxColor, setCheckboxColor] = React.useState('blue');
92
92
  const [checkmarkColor, setCheckmarkColor] = React.useState('white');
93
93
 
@@ -6,8 +6,9 @@ import { useTheme } from '@fluentui-react-native/theme-types';
6
6
  import { View, TextInput, TextStyle } from 'react-native';
7
7
  import { commonTestStyles as commonStyles } from '../Common/styles';
8
8
  import { E2ECheckboxExperimentalTest } from './E2ECheckboxExperimentalTest';
9
+ import { InteractionEvent } from '@fluentui-react-native/interactive-hooks';
9
10
 
10
- function onChangeUncontrolled(isChecked: boolean) {
11
+ function onChangeUncontrolled(_e: InteractionEvent, isChecked: boolean) {
11
12
  console.log(isChecked);
12
13
  }
13
14
 
@@ -20,8 +21,9 @@ const basicCheckbox: React.FunctionComponent = () => {
20
21
  <Checkbox label="Disabled checkbox" disabled />
21
22
  <Checkbox label="Disabled checked checkbox" defaultChecked disabled />
22
23
  <Checkbox label="Checkbox will display a tooltip" tooltip="This is a tooltip" />
23
- <Checkbox label="A circular checkbox" circular />
24
- <Checkbox label="A circular checkbox" labelPosition="before" />
24
+ <Checkbox label="A circular checkbox" shape="circular" />
25
+ <Checkbox label="A checkbox with label placed before" labelPosition="before" />
26
+ <Checkbox label="A required checkbox" required />
25
27
  </View>
26
28
  );
27
29
  };
@@ -57,33 +59,34 @@ const otherCheckbox: React.FunctionComponent = () => {
57
59
  labelPosition="before"
58
60
  checked={Boolean(isCheckedControlled2)}
59
61
  />
62
+ <Checkbox label="A required checkbox with other required text" required="**" />
60
63
  </View>
61
64
  );
62
65
  };
63
66
 
64
- const tokenCheckbox: React.FunctionComponent = () => {
65
- const CircleColorCheckbox = Checkbox.customize({
66
- checkboxBackgroundColor: 'white',
67
- checked: {
68
- checkboxBackgroundColor: 'green',
69
- checkboxBorderColor: 'green',
70
- checkmarkColor: 'white',
71
- },
72
- focused: { checkboxBackgroundColor: 'menuItemBackgroundHovered' },
73
- hovered: { checkboxBackgroundColor: 'menuItemBackgroundHovered' },
74
- pressed: { checkboxBackgroundColor: 'menuItemBackgroundPressed' },
75
- });
76
-
77
- const HoverCheckbox = Checkbox.customize({
78
- checked: {
79
- checkboxBackgroundColor: 'black',
80
- checkmarkColor: 'white',
81
- },
82
- hovered: {
83
- checkmarkOpacity: 1,
84
- },
85
- });
67
+ const CircleColorCheckbox = Checkbox.customize({
68
+ checkboxBackgroundColor: 'white',
69
+ checked: {
70
+ checkboxBackgroundColor: 'green',
71
+ checkboxBorderColor: 'green',
72
+ checkmarkColor: 'white',
73
+ },
74
+ focused: { checkboxBackgroundColor: 'menuItemBackgroundHovered' },
75
+ hovered: { checkboxBackgroundColor: 'menuItemBackgroundHovered' },
76
+ pressed: { checkboxBackgroundColor: 'menuItemBackgroundPressed' },
77
+ });
78
+
79
+ const HoverCheckbox = Checkbox.customize({
80
+ checked: {
81
+ checkboxBackgroundColor: 'black',
82
+ checkmarkColor: 'white',
83
+ },
84
+ hovered: {
85
+ checkmarkOpacity: 1,
86
+ },
87
+ });
86
88
 
89
+ const tokenCheckbox: React.FunctionComponent = () => {
87
90
  const [checkboxColor, setCheckboxColor] = React.useState('blue');
88
91
  const [checkmarkColor, setCheckmarkColor] = React.useState('white');
89
92
 
@@ -106,7 +109,12 @@ const tokenCheckbox: React.FunctionComponent = () => {
106
109
  return (
107
110
  <View>
108
111
  <HoverCheckbox label="A checkbox with checkmark visible on hover" onChange={onChangeUncontrolled} defaultChecked={false} />
109
- <CircleColorCheckbox label="A circular token-customized checkbox" circular onChange={onChangeUncontrolled} defaultChecked={true} />
112
+ <CircleColorCheckbox
113
+ label="A circular token-customized checkbox"
114
+ shape="circular"
115
+ onChange={onChangeUncontrolled}
116
+ defaultChecked={true}
117
+ />
110
118
  <BlueCheckbox
111
119
  label="Token-customized checkbox. Customizable below."
112
120
  onChange={onChangeUncontrolled}
@@ -16,7 +16,7 @@ export const E2ECheckboxExperimentalTest: React.FunctionComponent = () => {
16
16
  const [checkboxPressed, setCheckboxPressed] = React.useState(false);
17
17
 
18
18
  const onClick = React.useCallback(
19
- (checked) => {
19
+ (_e, checked) => {
20
20
  setCheckboxPressed(checked);
21
21
  },
22
22
  [setCheckboxPressed],
@@ -232,6 +232,9 @@ const nestedContextualMenu: React.FunctionComponent = () => {
232
232
  );
233
233
  };
234
234
 
235
+ // custom text
236
+ const IndigoHeroBold = FURNText.customize({ tokens: { variant: 'heroStandard', fontWeight: '100', color: '#4b0082' } });
237
+
235
238
  const IconContextualMenu: React.FunctionComponent = () => {
236
239
  const stdBtnRef = React.useRef(null);
237
240
 
@@ -258,9 +261,6 @@ const IconContextualMenu: React.FunctionComponent = () => {
258
261
  setIsContextualMenuVisible(false);
259
262
  }, [setShowContextualMenu]);
260
263
 
261
- // custom text
262
- const IndigoHeroBold = FURNText.customize({ tokens: { variant: 'heroStandard', fontWeight: '100', color: '#4b0082' } });
263
-
264
264
  return (
265
265
  <View>
266
266
  <View style={{ flexDirection: 'row', paddingVertical: 5 }}>
@@ -7,33 +7,34 @@ import { Test, TestSection, PlatformStatus } from '../Test';
7
7
  import { EXPANDER_TESTPAGE } from './consts';
8
8
  import { View, Switch } from 'react-native';
9
9
 
10
+ const CustomizedExpander = Expander.customize({
11
+ headerBackground: '#9c9c9c',
12
+ headerForeground: '#ffffff',
13
+ contentBackground: '#c3c3c3',
14
+ chevronBackground: '#ff7f7f',
15
+ chevronForeground: '#ffffff',
16
+ chevronPointerOverBackground: '#b5ffb2',
17
+ chevronPointerOverForeground: '#bfbdbd',
18
+ chevronPressedBackground: '#ffb2f4',
19
+ chevronPressedForeground: '#912a2a',
20
+ headerForegroundPointerOver: '#27f238',
21
+ headerForegroundPressed: '#f227eb',
22
+ headerBorderBrush: '#f22727',
23
+ headerBorderPointerOverBrush: '#27f238',
24
+ headerBorderPressedBrush: '#f227eb',
25
+ contentBorderBrush: '#f227eb',
26
+ headerBorderThickness: 2,
27
+ chevronBorderBrush: '#f22727',
28
+ chevronBorderPointerOverBrush: '#27f238',
29
+ chevronBorderPressedBrush: '#f227eb',
30
+ chevronBorderThickness: 2,
31
+ });
32
+
10
33
  const expanderTest: React.FunctionComponent = () => {
11
34
  /** This test page has not yet been tested and does not currently build because
12
35
  * the react-native-test-app does not yet support WinUI 2.6
13
36
  * Filed issue in react-native-test-app: https://github.com/microsoft/react-native-test-app/issues/444
14
37
  */
15
- const CustomizedExpander = Expander.customize({
16
- headerBackground: '#9c9c9c',
17
- headerForeground: '#ffffff',
18
- contentBackground: '#c3c3c3',
19
- chevronBackground: '#ff7f7f',
20
- chevronForeground: '#ffffff',
21
- chevronPointerOverBackground: '#b5ffb2',
22
- chevronPointerOverForeground: '#bfbdbd',
23
- chevronPressedBackground: '#ffb2f4',
24
- chevronPressedForeground: '#912a2a',
25
- headerForegroundPointerOver: '#27f238',
26
- headerForegroundPressed: '#f227eb',
27
- headerBorderBrush: '#f22727',
28
- headerBorderPointerOverBrush: '#27f238',
29
- headerBorderPressedBrush: '#f227eb',
30
- contentBorderBrush: '#f227eb',
31
- headerBorderThickness: 2,
32
- chevronBorderBrush: '#f22727',
33
- chevronBorderPointerOverBrush: '#27f238',
34
- chevronBorderPressedBrush: '#f227eb',
35
- chevronBorderThickness: 2,
36
- });
37
38
 
38
39
  const [switchValue, setSwitchValue] = React.useState(false);
39
40
  const [expanderText, setExpanderText] = React.useState('Initial state');
@@ -4,18 +4,19 @@ import { MenuButton } from '@fluentui/react-native';
4
4
  import { menuItems } from './testData';
5
5
  import { viewWrapperStyle, columnStyle, rowStyle } from './MenuButtonTestStyles';
6
6
 
7
+ const StyledMenuButton = MenuButton.customize({
8
+ button: {
9
+ borderRadius: 4,
10
+ backgroundColor: '#0095ff',
11
+ borderWidth: 0,
12
+ color: '#fff',
13
+ variant: 'heroSemibold',
14
+ fontFamily: 'Georgia',
15
+ },
16
+ contextualMenu: { backgroundColor: '#a9dbff' },
17
+ });
18
+
7
19
  export const CustomizedMenuButton: React.FunctionComponent = () => {
8
- const StyledMenuButton = MenuButton.customize({
9
- button: {
10
- borderRadius: 4,
11
- backgroundColor: '#0095ff',
12
- borderWidth: 0,
13
- color: '#fff',
14
- variant: 'heroSemibold',
15
- fontFamily: 'Georgia',
16
- },
17
- contextualMenu: { backgroundColor: '#a9dbff' },
18
- });
19
20
  return (
20
21
  <View>
21
22
  <View style={viewWrapperStyle}>
@@ -4,18 +4,19 @@ import { MenuButton } from '@fluentui/react-native';
4
4
  import { menuItems } from './testData';
5
5
  import { viewWrapperStyle, columnStyle, rowStyle } from './MenuButtonTestStyles';
6
6
 
7
+ const StyledMenuButton = MenuButton.customize({
8
+ button: {
9
+ borderRadius: 4,
10
+ backgroundColor: '#0095ff',
11
+ borderWidth: 0,
12
+ color: '#fff',
13
+ variant: 'heroSemibold',
14
+ fontFamily: 'Georgia',
15
+ },
16
+ contextualMenu: { backgroundColor: '#a9dbff' },
17
+ });
18
+
7
19
  export const CustomizedMenuButton: React.FunctionComponent = () => {
8
- const StyledMenuButton = MenuButton.customize({
9
- button: {
10
- borderRadius: 4,
11
- backgroundColor: '#0095ff',
12
- borderWidth: 0,
13
- color: '#fff',
14
- variant: 'heroSemibold',
15
- fontFamily: 'Georgia',
16
- },
17
- contextualMenu: { backgroundColor: '#a9dbff' },
18
- });
19
20
  return (
20
21
  <View>
21
22
  <View style={viewWrapperStyle}>