forked from microsoft/fluentui-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonTest.tsx
More file actions
97 lines (90 loc) · 3.43 KB
/
ButtonTest.tsx
File metadata and controls
97 lines (90 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import * as React from 'react';
import { Platform } from 'react-native';
import { ButtonShapeTest } from './ButtonShapeTestSection';
import { ButtonSizeTest } from './ButtonSizeTestSection';
import { ButtonVariantTest } from './ButtonVariantTestSection';
import { ButtonFocusTest_deprecated } from './deprecated/ButtonFocusTest';
import { ButtonIconTest_deprecated } from './deprecated/ButtonIconTest';
import { E2EButtonTest_deprecated } from './deprecated/E2EButtonTest';
import { E2EButtonTest } from './E2EButtonTest';
import { ToggleButtonTest } from './ToggleButtonTestSection';
import { BUTTON_TESTPAGE } from '../../../../E2E/src/ButtonLegacy/consts';
import { ButtonHOCTest } from '../Button/ButtonHOCTestSection';
import { ButtonIconTest } from '../Button/ButtonIconTestSection';
import type { TestSection, PlatformStatus } from '../Test';
import { Test } from '../Test';
const buttonSections: TestSection[] = [
{
name: 'Button Variants',
testID: BUTTON_TESTPAGE,
component: ButtonVariantTest,
},
{
name: 'Icon Button',
component: ButtonIconTest,
},
...Platform.select({
// The following sections are not supported for iOS or Android
ios: [],
android: [],
default: [
{
name: 'Toggle Button',
component: ToggleButtonTest,
},
{
name: 'Button Shape',
component: ButtonShapeTest,
},
],
}),
{
name: 'Sizes',
component: ButtonSizeTest,
},
Platform.select({
android: null,
default: {
name: 'Customize, Compose, and Ref',
component: ButtonHOCTest,
},
}),
...Platform.select({
android: [], // Following sections are not supported from Fluent Android
default: [
{
name: 'Deprecated Basic Button',
component: ButtonFocusTest_deprecated,
},
{
name: 'Deprecated Icon Button',
component: ButtonIconTest_deprecated,
},
],
}),
];
const e2eSections: TestSection[] = [
{
name: 'E2E Button Testing',
component: E2EButtonTest,
},
{
name: 'Deprecated E2E Button Testing',
component: E2EButtonTest_deprecated,
},
];
export const ButtonTest: React.FunctionComponent = () => {
const status: PlatformStatus = {
win32Status: 'Production',
uwpStatus: 'Backlog',
iosStatus: 'Production',
macosStatus: 'Production',
androidStatus: 'Production',
};
const description =
'Buttons are best used to enable a user to commit a change or complete steps in a task. They are typically found inside forms, dialogs, panels or pages. An example of their usage is confirming the deletion of a file in a confirmation dialog.\n\nWhen considering their place in a layout, contemplate the order in which a user will flow through the UI. As an example, in a form, the individual will need to read and interact with the form fields before submiting the form. Therefore, as a general rule, the button should be placed at the bottom of the UI container (a dialog, panel, or page) which holds the related UI elements.\n\nWhile buttons can technically be used to navigate a user to another part of the experience, this is not recommended unless that navigation is part of an action or their flow.';
const spec = 'https://github.com/microsoft/fluentui-react-native/blob/main/packages/components/Button/SPEC.md';
return (
<Test name="Button Test" description={description} spec={spec} sections={buttonSections} status={status} e2eSections={e2eSections} />
);
};