@fluentui-react-native/tester 0.102.3 → 0.103.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 (73) hide show
  1. package/CHANGELOG.json +112 -1
  2. package/CHANGELOG.md +26 -2
  3. package/lib/E2E/LinkExperimental/pages/LinkPageObject.d.ts +15 -0
  4. package/lib/E2E/LinkExperimental/pages/LinkPageObject.d.ts.map +1 -0
  5. package/lib/E2E/LinkExperimental/pages/LinkPageObject.js +50 -0
  6. package/lib/E2E/LinkExperimental/pages/LinkPageObject.js.map +1 -0
  7. package/lib/E2E/LinkExperimental/specs/Link.spec.win.d.ts +2 -0
  8. package/lib/E2E/LinkExperimental/specs/Link.spec.win.d.ts.map +1 -0
  9. package/lib/E2E/LinkExperimental/specs/Link.spec.win.js +113 -0
  10. package/lib/E2E/LinkExperimental/specs/Link.spec.win.js.map +1 -0
  11. package/lib/E2E/common/NavigateAppPage.d.ts +2 -0
  12. package/lib/E2E/common/NavigateAppPage.d.ts.map +1 -1
  13. package/lib/E2E/common/NavigateAppPage.js +20 -0
  14. package/lib/E2E/common/NavigateAppPage.js.map +1 -1
  15. package/lib/TestComponents/LinkExperimental/E2ELinkTest.d.ts +3 -0
  16. package/lib/TestComponents/LinkExperimental/E2ELinkTest.d.ts.map +1 -0
  17. package/lib/TestComponents/LinkExperimental/E2ELinkTest.js +15 -0
  18. package/lib/TestComponents/LinkExperimental/E2ELinkTest.js.map +1 -0
  19. package/lib/TestComponents/LinkExperimental/LinkTest.d.ts +3 -0
  20. package/lib/TestComponents/LinkExperimental/LinkTest.d.ts.map +1 -0
  21. package/lib/TestComponents/LinkExperimental/LinkTest.js +134 -0
  22. package/lib/TestComponents/LinkExperimental/LinkTest.js.map +1 -0
  23. package/lib/TestComponents/LinkExperimental/consts.d.ts +7 -0
  24. package/lib/TestComponents/LinkExperimental/consts.d.ts.map +1 -0
  25. package/lib/TestComponents/LinkExperimental/consts.js +9 -0
  26. package/lib/TestComponents/LinkExperimental/consts.js.map +1 -0
  27. package/lib/TestComponents/LinkExperimental/index.d.ts +3 -0
  28. package/lib/TestComponents/LinkExperimental/index.d.ts.map +1 -0
  29. package/lib/TestComponents/LinkExperimental/index.js +3 -0
  30. package/lib/TestComponents/LinkExperimental/index.js.map +1 -0
  31. package/lib/testPages.d.ts.map +1 -1
  32. package/lib/testPages.js +7 -0
  33. package/lib/testPages.js.map +1 -1
  34. package/lib-commonjs/E2E/LinkExperimental/pages/LinkPageObject.d.ts +15 -0
  35. package/lib-commonjs/E2E/LinkExperimental/pages/LinkPageObject.d.ts.map +1 -0
  36. package/lib-commonjs/E2E/LinkExperimental/pages/LinkPageObject.js +52 -0
  37. package/lib-commonjs/E2E/LinkExperimental/pages/LinkPageObject.js.map +1 -0
  38. package/lib-commonjs/E2E/LinkExperimental/specs/Link.spec.win.d.ts +2 -0
  39. package/lib-commonjs/E2E/LinkExperimental/specs/Link.spec.win.d.ts.map +1 -0
  40. package/lib-commonjs/E2E/LinkExperimental/specs/Link.spec.win.js +115 -0
  41. package/lib-commonjs/E2E/LinkExperimental/specs/Link.spec.win.js.map +1 -0
  42. package/lib-commonjs/E2E/common/NavigateAppPage.d.ts +2 -0
  43. package/lib-commonjs/E2E/common/NavigateAppPage.d.ts.map +1 -1
  44. package/lib-commonjs/E2E/common/NavigateAppPage.js +54 -34
  45. package/lib-commonjs/E2E/common/NavigateAppPage.js.map +1 -1
  46. package/lib-commonjs/TestComponents/LinkExperimental/E2ELinkTest.d.ts +3 -0
  47. package/lib-commonjs/TestComponents/LinkExperimental/E2ELinkTest.d.ts.map +1 -0
  48. package/lib-commonjs/TestComponents/LinkExperimental/E2ELinkTest.js +20 -0
  49. package/lib-commonjs/TestComponents/LinkExperimental/E2ELinkTest.js.map +1 -0
  50. package/lib-commonjs/TestComponents/LinkExperimental/LinkTest.d.ts +3 -0
  51. package/lib-commonjs/TestComponents/LinkExperimental/LinkTest.d.ts.map +1 -0
  52. package/lib-commonjs/TestComponents/LinkExperimental/LinkTest.js +139 -0
  53. package/lib-commonjs/TestComponents/LinkExperimental/LinkTest.js.map +1 -0
  54. package/lib-commonjs/TestComponents/LinkExperimental/consts.d.ts +7 -0
  55. package/lib-commonjs/TestComponents/LinkExperimental/consts.d.ts.map +1 -0
  56. package/lib-commonjs/TestComponents/LinkExperimental/consts.js +12 -0
  57. package/lib-commonjs/TestComponents/LinkExperimental/consts.js.map +1 -0
  58. package/lib-commonjs/TestComponents/LinkExperimental/index.d.ts +3 -0
  59. package/lib-commonjs/TestComponents/LinkExperimental/index.d.ts.map +1 -0
  60. package/lib-commonjs/TestComponents/LinkExperimental/index.js +6 -0
  61. package/lib-commonjs/TestComponents/LinkExperimental/index.js.map +1 -0
  62. package/lib-commonjs/testPages.d.ts.map +1 -1
  63. package/lib-commonjs/testPages.js +7 -0
  64. package/lib-commonjs/testPages.js.map +1 -1
  65. package/package.json +17 -16
  66. package/src/E2E/LinkExperimental/pages/LinkPageObject.ts +34 -0
  67. package/src/E2E/LinkExperimental/specs/Link.spec.win.ts +49 -0
  68. package/src/E2E/common/NavigateAppPage.ts +9 -0
  69. package/src/TestComponents/LinkExperimental/E2ELinkTest.tsx +32 -0
  70. package/src/TestComponents/LinkExperimental/LinkTest.tsx +210 -0
  71. package/src/TestComponents/LinkExperimental/consts.ts +10 -0
  72. package/src/TestComponents/LinkExperimental/index.ts +2 -0
  73. package/src/testPages.ts +7 -0
@@ -0,0 +1,210 @@
1
+ import * as React from 'react';
2
+ import { Alert, View, StyleSheet, Text, TextInput } from 'react-native';
3
+ import { Link, LinkTokens } from '@fluentui-react-native/experimental-link';
4
+ import { Stack } from '@fluentui-react-native/stack';
5
+ import { stackStyle, commonTestStyles as commonStyles } from '../Common/styles';
6
+ import { EXPERIMENTAL_LINK_TESTPAGE } from './consts';
7
+ import { Test, TestSection, PlatformStatus } from '../Test';
8
+ import { LinkE2ETest } from './E2ELinkTest';
9
+
10
+ const DefaultLinks: React.FunctionComponent = () => {
11
+ const doPress = React.useCallback(() => Alert.alert('Alert.', 'You have been alerted.'), []);
12
+ const doAllyTap = React.useCallback(() => Alert.alert('Alert.', 'You have invoked onAllyTap.'), []);
13
+
14
+ return (
15
+ <Stack style={stackStyle}>
16
+ <Link tooltip={'https://www.bing.com/'} url="https://www.bing.com/">
17
+ Click to navigate.
18
+ </Link>
19
+ <Link onPress={doPress} onAccessibilityTap={doAllyTap}>
20
+ Click to alert.
21
+ </Link>
22
+ <Link disabled focusable>
23
+ Disabled focusable Link
24
+ </Link>
25
+ </Stack>
26
+ );
27
+ };
28
+
29
+ const InlineLinks: React.FunctionComponent = () => {
30
+ const doPress = React.useCallback(() => Alert.alert('Alert.', 'You have been alerted.'), []);
31
+ const doAllyTap = React.useCallback(() => Alert.alert('Alert.', 'You have invoked onAllyTap.'), []);
32
+
33
+ return (
34
+ <Stack style={stackStyle}>
35
+ <Text>
36
+ Click{' '}
37
+ <Link inline onPress={doPress} onAccessibilityTap={doAllyTap}>
38
+ this link
39
+ </Link>{' '}
40
+ to alert me.
41
+ </Text>
42
+ <Text>
43
+ This{' '}
44
+ <Link inline onPress={doPress} disabled focusable>
45
+ link
46
+ </Link>{' '}
47
+ is disabled but focusable.
48
+ </Text>
49
+ <Text>
50
+ Follow this{' '}
51
+ <Link inline url="https://www.bing.com/">
52
+ link
53
+ </Link>{' '}
54
+ to navigate.
55
+ </Text>
56
+ </Stack>
57
+ );
58
+ };
59
+
60
+ const SubtleLinks: React.FunctionComponent = () => {
61
+ const doPress = React.useCallback(() => Alert.alert('Alert.', 'You have been alerted.'), []);
62
+ const doAllyTap = React.useCallback(() => Alert.alert('Alert.', 'You have invoked onAllyTap.'), []);
63
+
64
+ return (
65
+ <Stack style={stackStyle}>
66
+ <Link appearance="subtle" url="https://www.bing.com/">
67
+ Click to navigate.
68
+ </Link>
69
+ <Text>
70
+ This is inline Link.{' '}
71
+ <Link appearance="subtle" inline onPress={doPress} onAccessibilityTap={doAllyTap}>
72
+ Click to alert.
73
+ </Link>
74
+ </Text>
75
+ <Link appearance="subtle" onPress={doPress} disabled>
76
+ Disabled Link
77
+ </Link>
78
+ </Stack>
79
+ );
80
+ };
81
+
82
+ const styles = StyleSheet.create({
83
+ tokensRow: {
84
+ flexDirection: 'row',
85
+ marginBottom: 10,
86
+ },
87
+ tokensColumn: {
88
+ flexDirection: 'column',
89
+ margin: 10,
90
+ },
91
+ });
92
+
93
+ const BlueHeaderBold = Link.customize({ variant: 'headerStandard', fontWeight: '700', color: '#0229c4', textAlign: 'right' });
94
+ const CustomLinks: React.FunctionComponent = () => {
95
+ const [linkColor, setLinkColor] = React.useState<string>('blue');
96
+ const [linkFont, setLinkFont] = React.useState<string>('Ariel');
97
+ const [linkFontSize, setLinkFontSize] = React.useState<number>(12);
98
+ const [linkText, setLinkText] = React.useState<string>('Click to Navigate');
99
+ const [linkUrl, setLinkUrl] = React.useState<string>('https://www.bing.com/');
100
+
101
+ const CustomLink = React.useMemo(() => {
102
+ const tokens: LinkTokens = {
103
+ color: linkColor,
104
+ fontFamily: linkFont,
105
+ fontSize: linkFontSize,
106
+ };
107
+ return Link.customize(tokens);
108
+ }, [linkColor, linkFont, linkFontSize, linkText, linkUrl]);
109
+
110
+ return (
111
+ <View style={styles.tokensColumn}>
112
+ <View style={styles.tokensRow}>
113
+ <View>
114
+ <Text>Text Tokens</Text>
115
+ <TextInput
116
+ accessibilityLabel="Link color"
117
+ style={commonStyles.textBox}
118
+ placeholder="Link color"
119
+ blurOnSubmit={true}
120
+ onSubmitEditing={(e) => {
121
+ setLinkColor(e.nativeEvent.text);
122
+ }}
123
+ />
124
+ <TextInput
125
+ accessibilityLabel="Link font"
126
+ style={commonStyles.textBox}
127
+ placeholder="Link font"
128
+ blurOnSubmit={true}
129
+ onSubmitEditing={(e) => {
130
+ setLinkFont(e.nativeEvent.text);
131
+ }}
132
+ />
133
+ <TextInput
134
+ accessibilityLabel="Link font size"
135
+ style={commonStyles.textBox}
136
+ placeholder="Link font size"
137
+ blurOnSubmit={true}
138
+ onSubmitEditing={(e) => {
139
+ setLinkFontSize(parseInt(e.nativeEvent.text));
140
+ }}
141
+ />
142
+ </View>
143
+ <View>
144
+ <Text>Content and URL customize</Text>
145
+ <TextInput
146
+ accessibilityLabel="Link text"
147
+ style={commonStyles.textBox}
148
+ placeholder="Link text"
149
+ blurOnSubmit={true}
150
+ onSubmitEditing={(e) => {
151
+ setLinkText(e.nativeEvent.text);
152
+ }}
153
+ />
154
+ <TextInput
155
+ accessibilityLabel="Link Url"
156
+ style={commonStyles.textBox}
157
+ placeholder="Link URL"
158
+ blurOnSubmit={true}
159
+ onSubmitEditing={(e) => {
160
+ setLinkUrl(e.nativeEvent.text);
161
+ }}
162
+ />
163
+ </View>
164
+ </View>
165
+ <CustomLink align="end" url={linkUrl}>
166
+ {linkText}
167
+ </CustomLink>
168
+ <BlueHeaderBold>BlueHeaderBold</BlueHeaderBold>
169
+ </View>
170
+ );
171
+ };
172
+
173
+ const linkSections: TestSection[] = [
174
+ {
175
+ name: 'Default Links',
176
+ testID: EXPERIMENTAL_LINK_TESTPAGE,
177
+ component: DefaultLinks,
178
+ },
179
+ {
180
+ name: 'Inline Links',
181
+ component: InlineLinks,
182
+ },
183
+ {
184
+ name: 'Subtle Links',
185
+ component: SubtleLinks,
186
+ },
187
+ {
188
+ name: 'Custom Link',
189
+ component: CustomLinks,
190
+ },
191
+ {
192
+ name: 'Link E2E Test',
193
+ component: LinkE2ETest,
194
+ },
195
+ ];
196
+
197
+ export const ExperimentalLinkTest: React.FunctionComponent = () => {
198
+ const status: PlatformStatus = {
199
+ win32Status: 'Beta',
200
+ uwpStatus: 'Experimental',
201
+ iosStatus: 'Experimental',
202
+ macosStatus: 'Beta',
203
+ androidStatus: 'Backlog',
204
+ };
205
+
206
+ const description =
207
+ 'With a Link, users can navigate to another page, window, or Help topic; display a definition; initiate a command; or choose an option. A Link indicates that it can be clicked, typically by being displayed using the visited or unvisited link system colors. Traditionally, Links are underlined as well, but that approach is often unnecessary and falling out of favor to reduce visual clutter.\n\nA Link is the lightest weight clickable control, and is often used to reduce the visual complexity of a design.';
208
+
209
+ return <Test name="Link Test" description={description} sections={linkSections} status={status}></Test>;
210
+ };
@@ -0,0 +1,10 @@
1
+ export const HOMEPAGE_EXPERIMENTAL_LINK_BUTTON = 'Homepage_LinkExperimental_Button';
2
+ export const EXPERIMENTAL_LINK_TESTPAGE = 'LinkExperimental_TestPage';
3
+
4
+ /* E2E Testing Link 1 */
5
+ export const EXPERIMENTAL_LINK_TEST_COMPONENT = 'Experimental_Link_Test_Component'; // A component on each specific test page
6
+ export const EXPERIMENTAL_LINK_ACCESSIBILITY_LABEL = 'E2E testing Experimental Link accessibility label';
7
+
8
+ /* E2E Testing Link 2 */
9
+ export const EXPERIMENTAL_LINK_NO_A11Y_LABEL_COMPONENT = 'Experimental Link_No_A11y_label_Component';
10
+ export const EXPERIMENTAL_LINK_TEST_COMPONENT_LABEL = 'Test Experimental Link2 - No Accessibility Label'; // A component on each specific test page
@@ -0,0 +1,2 @@
1
+ export * from './LinkTest';
2
+ export * from './consts';
package/src/testPages.ts CHANGED
@@ -36,6 +36,7 @@ import { TextTest, HOMEPAGE_TEXT_BUTTON } from './TestComponents/Text';
36
36
  import { TextExperimentalTest, HOMEPAGE_EXPERIMENTAL_TEXT_BUTTON } from './TestComponents/TextExperimental';
37
37
  import { ThemeTest, HOMEPAGE_THEME_BUTTON } from './TestComponents/Theme';
38
38
  import { TokenTest, HOMEPAGE_TOKEN_BUTTON } from './TestComponents/Tokens';
39
+ import { ExperimentalLinkTest, HOMEPAGE_EXPERIMENTAL_LINK_BUTTON } from './TestComponents/LinkExperimental';
39
40
 
40
41
  export const tests: TestDescription[] = [
41
42
  {
@@ -141,6 +142,12 @@ export const tests: TestDescription[] = [
141
142
  testPage: HOMEPAGE_LINK_BUTTON,
142
143
  platforms: ['android', 'ios', 'macos', 'web', 'win32', 'windows'],
143
144
  },
145
+ {
146
+ name: 'Link (Experimental)',
147
+ component: ExperimentalLinkTest,
148
+ testPage: HOMEPAGE_EXPERIMENTAL_LINK_BUTTON,
149
+ platforms: ['win32'],
150
+ },
144
151
  {
145
152
  name: 'Menu',
146
153
  component: MenuTest,