@telus-uds/components-base 1.26.0 → 1.28.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.
- package/CHANGELOG.md +28 -2
- package/component-docs.json +2 -1
- package/lib/Carousel/dictionary.js +6 -6
- package/lib-module/Carousel/dictionary.js +6 -6
- package/package.json +2 -2
- package/src/Carousel/dictionary.js +6 -6
- package/.eslintrc.js +0 -9
- package/__tests17__/A11yText/A11yText.test.jsx +0 -34
- package/__tests17__/ActivityIndicator/ActivityIndicator.test.jsx +0 -68
- package/__tests17__/ActivityIndicator/__snapshots__/ActivityIndicator.test.jsx.snap +0 -299
- package/__tests17__/Box/Box.test.jsx +0 -111
- package/__tests17__/Button/Button.test.jsx +0 -86
- package/__tests17__/Button/ButtonBase.test.jsx +0 -82
- package/__tests17__/Button/ButtonGroup.test.jsx +0 -347
- package/__tests17__/Button/ButtonLink.test.jsx +0 -61
- package/__tests17__/Card/Card.test.jsx +0 -63
- package/__tests17__/Carousel/Carousel.test.jsx +0 -128
- package/__tests17__/Carousel/CarouselTabs.test.jsx +0 -142
- package/__tests17__/Checkbox/Checkbox.test.jsx +0 -94
- package/__tests17__/Checkbox/CheckboxGroup.test.jsx +0 -246
- package/__tests17__/Divider/Divider.test.jsx +0 -91
- package/__tests17__/ExpandCollapse/ExpandCollapse.test.jsx +0 -109
- package/__tests17__/Feedback/Feedback.test.jsx +0 -42
- package/__tests17__/FlexGrid/Col.test.jsx +0 -261
- package/__tests17__/FlexGrid/FlexGrid.test.jsx +0 -136
- package/__tests17__/FlexGrid/Row.test.jsx +0 -273
- package/__tests17__/HorizontalScroll/HorizontalScroll.test.jsx +0 -165
- package/__tests17__/Icon/Icon.test.jsx +0 -61
- package/__tests17__/IconButton/IconButton.test.jsx +0 -52
- package/__tests17__/InputLabel/InputLabel.test.jsx +0 -28
- package/__tests17__/InputLabel/__snapshots__/InputLabel.test.jsx.snap +0 -3
- package/__tests17__/InputSupports/InputSupports.test.jsx +0 -60
- package/__tests17__/Link/Link.test.jsx +0 -63
- package/__tests17__/Link/TextButton.test.jsx +0 -35
- package/__tests17__/List/List.test.jsx +0 -82
- package/__tests17__/Modal/Modal.test.jsx +0 -47
- package/__tests17__/Notification/Notification.test.jsx +0 -20
- package/__tests17__/Pagination/Pagination.test.jsx +0 -160
- package/__tests17__/Progress/Progress.test.jsx +0 -79
- package/__tests17__/Radio/Radio.test.jsx +0 -87
- package/__tests17__/Radio/RadioGroup.test.jsx +0 -220
- package/__tests17__/RadioCard/RadioCard.test.jsx +0 -87
- package/__tests17__/RadioCard/RadioCardGroup.test.jsx +0 -246
- package/__tests17__/Search/Search.test.jsx +0 -87
- package/__tests17__/Select/Select.test.jsx +0 -94
- package/__tests17__/SideNav/SideNav.test.jsx +0 -110
- package/__tests17__/Skeleton/Skeleton.test.jsx +0 -61
- package/__tests17__/SkipLink/SkipLink.test.jsx +0 -61
- package/__tests17__/Spacer/Spacer.test.jsx +0 -63
- package/__tests17__/StackView/StackView.test.jsx +0 -211
- package/__tests17__/StackView/StackWrap.test.jsx +0 -47
- package/__tests17__/StackView/getStackedContent.test.jsx +0 -295
- package/__tests17__/StepTracker/StepTracker.test.jsx +0 -108
- package/__tests17__/Tabs/Tabs.test.jsx +0 -49
- package/__tests17__/Tags/Tags.test.jsx +0 -327
- package/__tests17__/TextInput/TextArea.test.jsx +0 -35
- package/__tests17__/TextInput/TextInputBase.test.jsx +0 -125
- package/__tests17__/ThemeProvider/ThemeProvider.test.jsx +0 -82
- package/__tests17__/ThemeProvider/useThemeTokens.test.jsx +0 -514
- package/__tests17__/ThemeProvider/utils/theme-tokens.test.js +0 -41
- package/__tests17__/ToggleSwitch/ToggleSwitch.test.jsx +0 -82
- package/__tests17__/ToggleSwitch/ToggleSwitchGroup.test.jsx +0 -192
- package/__tests17__/Tooltip/Tooltip.test.jsx +0 -65
- package/__tests17__/Tooltip/getTooltipPosition.test.js +0 -79
- package/__tests17__/Typography/typography.test.jsx +0 -90
- package/__tests17__/utils/children.test.jsx +0 -128
- package/__tests17__/utils/containUniqueFields.test.js +0 -25
- package/__tests17__/utils/input.test.js +0 -375
- package/__tests17__/utils/props.test.js +0 -36
- package/__tests17__/utils/semantics.test.jsx +0 -34
- package/__tests17__/utils/useCopy.test.js +0 -42
- package/__tests17__/utils/useResponsiveProp.test.jsx +0 -202
- package/__tests17__/utils/useSpacingScale.test.jsx +0 -273
- package/__tests17__/utils/useUniqueId.test.js +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 02 Mar 2023 22:29:43 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.28.0
|
|
8
|
+
|
|
9
|
+
Thu, 02 Mar 2023 22:29:43 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- [object Object] (khemkaran.singh@telusinternational.com)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- adding French translations to Carousel (21316148+donnavitan@users.noreply.github.com)
|
|
18
|
+
|
|
19
|
+
## 1.27.0
|
|
20
|
+
|
|
21
|
+
Thu, 23 Feb 2023 17:25:51 GMT
|
|
22
|
+
|
|
23
|
+
### Minor changes
|
|
24
|
+
|
|
25
|
+
- update public mobile themes (evander.owusu@telus.com)
|
|
26
|
+
- Bump @telus-uds/system-theme-tokens to v2.11.0
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- ignore unwanted files (evander.owusu@telus.com)
|
|
31
|
+
- Updated snapshots based on the SVG changes (101351850+nadaltelus@users.noreply.github.com)
|
|
32
|
+
|
|
7
33
|
## 1.26.0
|
|
8
34
|
|
|
9
|
-
Fri, 10 Feb 2023 17:
|
|
35
|
+
Fri, 10 Feb 2023 17:40:05 GMT
|
|
10
36
|
|
|
11
37
|
### Minor changes
|
|
12
38
|
|
package/component-docs.json
CHANGED
|
@@ -14,12 +14,12 @@ var _default = {
|
|
|
14
14
|
skipLink: 'Skip %{title}'
|
|
15
15
|
},
|
|
16
16
|
fr: {
|
|
17
|
-
//
|
|
18
|
-
carouselLabel: '
|
|
19
|
-
iconButtonLabel: '
|
|
20
|
-
stepLabel: '
|
|
21
|
-
stepTrackerLabel: '
|
|
22
|
-
skipLink: '
|
|
17
|
+
// French translations
|
|
18
|
+
carouselLabel: '%{stepCount} éléments',
|
|
19
|
+
iconButtonLabel: 'Montrer %{itemLabel} %{targetStep} de %{stepCount}',
|
|
20
|
+
stepLabel: '%{itemLabel} %{stepNumber}',
|
|
21
|
+
stepTrackerLabel: '%{itemLabel} %{stepNumber} de %{stepCount}',
|
|
22
|
+
skipLink: 'Passer %{title}'
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
exports.default = _default;
|
|
@@ -8,11 +8,11 @@ export default {
|
|
|
8
8
|
skipLink: 'Skip %{title}'
|
|
9
9
|
},
|
|
10
10
|
fr: {
|
|
11
|
-
//
|
|
12
|
-
carouselLabel: '
|
|
13
|
-
iconButtonLabel: '
|
|
14
|
-
stepLabel: '
|
|
15
|
-
stepTrackerLabel: '
|
|
16
|
-
skipLink: '
|
|
11
|
+
// French translations
|
|
12
|
+
carouselLabel: '%{stepCount} éléments',
|
|
13
|
+
iconButtonLabel: 'Montrer %{itemLabel} %{targetStep} de %{stepCount}',
|
|
14
|
+
stepLabel: '%{itemLabel} %{stepNumber}',
|
|
15
|
+
stepTrackerLabel: '%{itemLabel} %{stepNumber} de %{stepCount}',
|
|
16
|
+
skipLink: 'Passer %{title}'
|
|
17
17
|
}
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@floating-ui/react-native": "^0.8.1",
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@telus-uds/system-constants": "^1.2.0",
|
|
14
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
14
|
+
"@telus-uds/system-theme-tokens": "^2.11.0",
|
|
15
15
|
"airbnb-prop-types": "^2.16.0",
|
|
16
16
|
"lodash.debounce": "^4.0.8",
|
|
17
17
|
"lodash.merge": "^4.6.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"standard-engine": {
|
|
73
73
|
"skip": true
|
|
74
74
|
},
|
|
75
|
-
"version": "1.
|
|
75
|
+
"version": "1.28.0"
|
|
76
76
|
}
|
|
@@ -8,11 +8,11 @@ export default {
|
|
|
8
8
|
skipLink: 'Skip %{title}'
|
|
9
9
|
},
|
|
10
10
|
fr: {
|
|
11
|
-
//
|
|
12
|
-
carouselLabel: '
|
|
13
|
-
iconButtonLabel: '
|
|
14
|
-
stepLabel: '
|
|
15
|
-
stepTrackerLabel: '
|
|
16
|
-
skipLink: '
|
|
11
|
+
// French translations
|
|
12
|
+
carouselLabel: '%{stepCount} éléments',
|
|
13
|
+
iconButtonLabel: 'Montrer %{itemLabel} %{targetStep} de %{stepCount}',
|
|
14
|
+
stepLabel: '%{itemLabel} %{stepNumber}',
|
|
15
|
+
stepTrackerLabel: '%{itemLabel} %{stepNumber} de %{stepCount}',
|
|
16
|
+
skipLink: 'Passer %{title}'
|
|
17
17
|
}
|
|
18
18
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
rules: {
|
|
3
|
-
// Default props in React are deprecated outside of class-based components. Globally we use an
|
|
4
|
-
// option that skips this rule for functional components, but it doesn't play nicely with forwardRef.
|
|
5
|
-
// Since we don't intend to ever have class-based components within UDS components-base,
|
|
6
|
-
// but we do use forwardRef, best to turn off the rule completely for this package.
|
|
7
|
-
'react/require-default-props': 'off'
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react-native'
|
|
3
|
-
import A11yText from '../../src/A11yText'
|
|
4
|
-
|
|
5
|
-
describe('A11yText', () => {
|
|
6
|
-
it('has an accessible label', async () => {
|
|
7
|
-
const { getByA11yLabel } = render(<A11yText text="Some text" />)
|
|
8
|
-
|
|
9
|
-
const a11yText = getByA11yLabel('Some text')
|
|
10
|
-
expect(a11yText).toBeTruthy()
|
|
11
|
-
expect(() => getByA11yLabel('Not some text')).toThrow()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
it("doesn't render regular text", async () => {
|
|
15
|
-
const { getByText } = render(<A11yText text="Some text" />)
|
|
16
|
-
expect(() => getByText('Some text')).toThrow()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('defaults to text role', async () => {
|
|
20
|
-
const { getByRole } = render(<A11yText text="Some text" />)
|
|
21
|
-
|
|
22
|
-
const a11yText = getByRole('text')
|
|
23
|
-
expect(a11yText).toBeTruthy()
|
|
24
|
-
expect(() => getByRole('header')).toThrow()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('can be set to header role', async () => {
|
|
28
|
-
const { getByRole } = render(<A11yText text="Some text" heading />)
|
|
29
|
-
|
|
30
|
-
const a11yText = getByRole('header')
|
|
31
|
-
expect(a11yText).toBeTruthy()
|
|
32
|
-
expect(() => getByRole('text')).toThrow()
|
|
33
|
-
})
|
|
34
|
-
})
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Platform } from 'react-native'
|
|
3
|
-
import { render as baseRender } from '@testing-library/react-native'
|
|
4
|
-
import Theme from '../../__fixtures__/Theme'
|
|
5
|
-
import ActivityIndicator from '../../src/ActivityIndicator'
|
|
6
|
-
import * as A11yInfoProvider from '../../src/A11yInfoProvider'
|
|
7
|
-
|
|
8
|
-
// Used to remove the "Animated: `useNativeDriver` is not supported because the native animated module is missing." warnings
|
|
9
|
-
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')
|
|
10
|
-
|
|
11
|
-
const render = (jsx) => baseRender(jsx, { wrapper: Theme })
|
|
12
|
-
|
|
13
|
-
describe('ActivityIndicator', () => {
|
|
14
|
-
it('has an accessible label', async () => {
|
|
15
|
-
const { getByA11yLabel } = render(<ActivityIndicator label="I'm a loader" />)
|
|
16
|
-
|
|
17
|
-
expect(getByA11yLabel("I'm a loader")).toBeTruthy()
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('has a role of progressbar', async () => {
|
|
21
|
-
const { getByRole } = render(<ActivityIndicator label="I'm a loader" />)
|
|
22
|
-
|
|
23
|
-
expect(getByRole('progressbar')).toBeTruthy()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('has an a11y state of busy', async () => {
|
|
27
|
-
const { getAllByAccessibilityState } = render(<ActivityIndicator label="I'm a loader" />)
|
|
28
|
-
expect(getAllByAccessibilityState({ busy: true })).toBeTruthy()
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it("doesn't render regular text for the label", async () => {
|
|
32
|
-
const { getByText } = render(<ActivityIndicator label="I'm a loader" />)
|
|
33
|
-
expect(() => getByText("I'm a loader")).toThrow()
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it("doesn't animate when reduced motion is enabled", async () => {
|
|
37
|
-
jest
|
|
38
|
-
.spyOn(A11yInfoProvider, 'useA11yInfo')
|
|
39
|
-
.mockImplementation(() => ({ reduceMotionEnabled: true }))
|
|
40
|
-
// TODO: this won't be called until cross-platform Jest tests are configured
|
|
41
|
-
// see https://github.com/telus/universal-design-system/issues/319
|
|
42
|
-
if (Platform.OS === 'web') {
|
|
43
|
-
const { container } = render(<ActivityIndicator label="I'm a loader" />)
|
|
44
|
-
expect(container.querySelector('[attributeName="transform"]')).not.toBeInTheDocument()
|
|
45
|
-
expect(container.querySelector('[attributeName="stroke-dashoffset"]')).not.toBeInTheDocument()
|
|
46
|
-
expect(container.querySelector('[attributeName="stroke-dasharray"]')).not.toBeInTheDocument()
|
|
47
|
-
} else {
|
|
48
|
-
const component = render(<ActivityIndicator label="I'm a loader" />)
|
|
49
|
-
expect(component).toMatchSnapshot()
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
it("animates when reduced motion isn't enabled", async () => {
|
|
53
|
-
jest
|
|
54
|
-
.spyOn(A11yInfoProvider, 'useA11yInfo')
|
|
55
|
-
.mockImplementation(() => ({ reduceMotionEnabled: false }))
|
|
56
|
-
// TODO: this won't be called until cross-platform Jest tests are configured
|
|
57
|
-
// see https://github.com/telus/universal-design-system/issues/319
|
|
58
|
-
if (Platform.OS === 'web') {
|
|
59
|
-
const { container } = render(<ActivityIndicator label="I'm a loader" />)
|
|
60
|
-
expect(container.querySelector('[attributeName="transform"]')).toBeInTheDocument()
|
|
61
|
-
expect(container.querySelector('[attributeName="stroke-dashoffset"]')).toBeInTheDocument()
|
|
62
|
-
expect(container.querySelector('[attributeName="stroke-dasharray"]')).toBeInTheDocument()
|
|
63
|
-
} else {
|
|
64
|
-
const component = render(<ActivityIndicator label="I'm a loader" />)
|
|
65
|
-
expect(component).toMatchSnapshot()
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
})
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ActivityIndicator animates when reduced motion isn't enabled 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
accessibilityLabel="I'm a loader"
|
|
6
|
-
accessibilityRole="progressbar"
|
|
7
|
-
accessibilityState={
|
|
8
|
-
Object {
|
|
9
|
-
"busy": true,
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
accessible={true}
|
|
13
|
-
style={
|
|
14
|
-
Array [
|
|
15
|
-
Object {
|
|
16
|
-
"flexGrow": 0,
|
|
17
|
-
"flexShrink": 0,
|
|
18
|
-
},
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
>
|
|
22
|
-
<View
|
|
23
|
-
collapsable={false}
|
|
24
|
-
style={
|
|
25
|
-
Object {
|
|
26
|
-
"height": 24,
|
|
27
|
-
"width": 24,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
>
|
|
31
|
-
<View
|
|
32
|
-
collapsable={false}
|
|
33
|
-
style={
|
|
34
|
-
Object {
|
|
35
|
-
"alignItems": "center",
|
|
36
|
-
"bottom": 0,
|
|
37
|
-
"justifyContent": "center",
|
|
38
|
-
"left": 0,
|
|
39
|
-
"position": "absolute",
|
|
40
|
-
"right": 0,
|
|
41
|
-
"top": 0,
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
>
|
|
45
|
-
<View
|
|
46
|
-
collapsable={false}
|
|
47
|
-
style={
|
|
48
|
-
Object {
|
|
49
|
-
"height": 24,
|
|
50
|
-
"transform": Array [
|
|
51
|
-
Object {
|
|
52
|
-
"rotate": "45deg",
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
"width": 24,
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
>
|
|
59
|
-
<View
|
|
60
|
-
collapsable={false}
|
|
61
|
-
style={
|
|
62
|
-
Object {
|
|
63
|
-
"height": 12,
|
|
64
|
-
"overflow": "hidden",
|
|
65
|
-
"width": 24,
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
>
|
|
69
|
-
<View
|
|
70
|
-
collapsable={false}
|
|
71
|
-
style={
|
|
72
|
-
Object {
|
|
73
|
-
"height": 24,
|
|
74
|
-
"transform": Array [
|
|
75
|
-
Object {
|
|
76
|
-
"translateY": 0,
|
|
77
|
-
},
|
|
78
|
-
Object {
|
|
79
|
-
"rotate": "-165deg",
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
"width": 24,
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
>
|
|
86
|
-
<View
|
|
87
|
-
collapsable={false}
|
|
88
|
-
style={
|
|
89
|
-
Object {
|
|
90
|
-
"height": 12,
|
|
91
|
-
"overflow": "hidden",
|
|
92
|
-
"width": 24,
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
>
|
|
96
|
-
<View
|
|
97
|
-
collapsable={false}
|
|
98
|
-
style={
|
|
99
|
-
Object {
|
|
100
|
-
"borderColor": "#0e6ac8",
|
|
101
|
-
"borderRadius": 12,
|
|
102
|
-
"borderWidth": 2,
|
|
103
|
-
"height": 24,
|
|
104
|
-
"width": 24,
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/>
|
|
108
|
-
</View>
|
|
109
|
-
</View>
|
|
110
|
-
</View>
|
|
111
|
-
</View>
|
|
112
|
-
</View>
|
|
113
|
-
<View
|
|
114
|
-
collapsable={false}
|
|
115
|
-
style={
|
|
116
|
-
Object {
|
|
117
|
-
"alignItems": "center",
|
|
118
|
-
"bottom": 0,
|
|
119
|
-
"justifyContent": "center",
|
|
120
|
-
"left": 0,
|
|
121
|
-
"position": "absolute",
|
|
122
|
-
"right": 0,
|
|
123
|
-
"top": 0,
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
>
|
|
127
|
-
<View
|
|
128
|
-
collapsable={false}
|
|
129
|
-
style={
|
|
130
|
-
Object {
|
|
131
|
-
"height": 24,
|
|
132
|
-
"transform": Array [
|
|
133
|
-
Object {
|
|
134
|
-
"rotate": "45deg",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
"width": 24,
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
>
|
|
141
|
-
<View
|
|
142
|
-
collapsable={false}
|
|
143
|
-
style={
|
|
144
|
-
Object {
|
|
145
|
-
"height": 12,
|
|
146
|
-
"overflow": "hidden",
|
|
147
|
-
"top": 12,
|
|
148
|
-
"width": 24,
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
>
|
|
152
|
-
<View
|
|
153
|
-
collapsable={false}
|
|
154
|
-
style={
|
|
155
|
-
Object {
|
|
156
|
-
"height": 24,
|
|
157
|
-
"transform": Array [
|
|
158
|
-
Object {
|
|
159
|
-
"translateY": -12,
|
|
160
|
-
},
|
|
161
|
-
Object {
|
|
162
|
-
"rotate": "345deg",
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
"width": 24,
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
>
|
|
169
|
-
<View
|
|
170
|
-
collapsable={false}
|
|
171
|
-
style={
|
|
172
|
-
Object {
|
|
173
|
-
"height": 12,
|
|
174
|
-
"overflow": "hidden",
|
|
175
|
-
"width": 24,
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
>
|
|
179
|
-
<View
|
|
180
|
-
collapsable={false}
|
|
181
|
-
style={
|
|
182
|
-
Object {
|
|
183
|
-
"borderColor": "#0e6ac8",
|
|
184
|
-
"borderRadius": 12,
|
|
185
|
-
"borderWidth": 2,
|
|
186
|
-
"height": 24,
|
|
187
|
-
"width": 24,
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
/>
|
|
191
|
-
</View>
|
|
192
|
-
</View>
|
|
193
|
-
</View>
|
|
194
|
-
</View>
|
|
195
|
-
</View>
|
|
196
|
-
</View>
|
|
197
|
-
</View>
|
|
198
|
-
`;
|
|
199
|
-
|
|
200
|
-
exports[`ActivityIndicator doesn't animate when reduced motion is enabled 1`] = `
|
|
201
|
-
<View
|
|
202
|
-
accessibilityLabel="I'm a loader"
|
|
203
|
-
accessibilityRole="progressbar"
|
|
204
|
-
accessibilityState={
|
|
205
|
-
Object {
|
|
206
|
-
"busy": true,
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
accessible={true}
|
|
210
|
-
style={
|
|
211
|
-
Array [
|
|
212
|
-
Object {
|
|
213
|
-
"flexGrow": 0,
|
|
214
|
-
"flexShrink": 0,
|
|
215
|
-
},
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
>
|
|
219
|
-
<View
|
|
220
|
-
collapsable={false}
|
|
221
|
-
style={
|
|
222
|
-
Object {
|
|
223
|
-
"height": 24,
|
|
224
|
-
"width": 24,
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
>
|
|
228
|
-
<View
|
|
229
|
-
collapsable={false}
|
|
230
|
-
style={
|
|
231
|
-
Object {
|
|
232
|
-
"alignItems": "center",
|
|
233
|
-
"bottom": 0,
|
|
234
|
-
"justifyContent": "center",
|
|
235
|
-
"left": 0,
|
|
236
|
-
"position": "absolute",
|
|
237
|
-
"right": 0,
|
|
238
|
-
"top": 0,
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
>
|
|
242
|
-
<View
|
|
243
|
-
collapsable={false}
|
|
244
|
-
style={
|
|
245
|
-
Object {
|
|
246
|
-
"height": 24,
|
|
247
|
-
"width": 24,
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
>
|
|
251
|
-
<View
|
|
252
|
-
collapsable={false}
|
|
253
|
-
style={
|
|
254
|
-
Object {
|
|
255
|
-
"height": 16,
|
|
256
|
-
"overflow": "hidden",
|
|
257
|
-
"width": 24,
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
>
|
|
261
|
-
<View
|
|
262
|
-
collapsable={false}
|
|
263
|
-
style={
|
|
264
|
-
Object {
|
|
265
|
-
"height": 24,
|
|
266
|
-
"width": 24,
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
>
|
|
270
|
-
<View
|
|
271
|
-
collapsable={false}
|
|
272
|
-
style={
|
|
273
|
-
Object {
|
|
274
|
-
"height": 16,
|
|
275
|
-
"overflow": "hidden",
|
|
276
|
-
"width": 24,
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
>
|
|
280
|
-
<View
|
|
281
|
-
collapsable={false}
|
|
282
|
-
style={
|
|
283
|
-
Object {
|
|
284
|
-
"borderColor": "#0e6ac8",
|
|
285
|
-
"borderRadius": 12,
|
|
286
|
-
"borderWidth": 2,
|
|
287
|
-
"height": 24,
|
|
288
|
-
"width": 24,
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
/>
|
|
292
|
-
</View>
|
|
293
|
-
</View>
|
|
294
|
-
</View>
|
|
295
|
-
</View>
|
|
296
|
-
</View>
|
|
297
|
-
</View>
|
|
298
|
-
</View>
|
|
299
|
-
`;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Text } from 'react-native'
|
|
3
|
-
import { render, fireEvent } from '@testing-library/react-native'
|
|
4
|
-
import { Box } from '../../src'
|
|
5
|
-
import Theme from '../../__fixtures__/Theme'
|
|
6
|
-
|
|
7
|
-
const textContent = 'Some text content'
|
|
8
|
-
|
|
9
|
-
// Based on testTheme
|
|
10
|
-
const expectedScale = [0, 4, 8, 16, 24, 32, 36]
|
|
11
|
-
|
|
12
|
-
describe('Box', () => {
|
|
13
|
-
it('is scrollable if scroll props provided', async () => {
|
|
14
|
-
const onScroll = jest.fn()
|
|
15
|
-
const { getByText } = render(
|
|
16
|
-
<Theme>
|
|
17
|
-
<Box scroll={{ onScroll }}>
|
|
18
|
-
<Text>{textContent}</Text>
|
|
19
|
-
</Box>
|
|
20
|
-
</Theme>
|
|
21
|
-
)
|
|
22
|
-
const content = getByText(textContent)
|
|
23
|
-
|
|
24
|
-
expect(onScroll).toHaveBeenCalledTimes(0)
|
|
25
|
-
await fireEvent.scroll(content)
|
|
26
|
-
expect(onScroll).toHaveBeenCalledTimes(1)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('maps regular props to RN styles', () => {
|
|
30
|
-
const props = {
|
|
31
|
-
top: 1,
|
|
32
|
-
bottom: 2,
|
|
33
|
-
left: 3,
|
|
34
|
-
right: 4
|
|
35
|
-
}
|
|
36
|
-
const { getByText } = render(
|
|
37
|
-
<Theme>
|
|
38
|
-
<Box {...props}>
|
|
39
|
-
<Text>{textContent}</Text>
|
|
40
|
-
</Box>
|
|
41
|
-
</Theme>
|
|
42
|
-
)
|
|
43
|
-
expect(getByText(textContent).parent).toHaveStyle({
|
|
44
|
-
paddingTop: expectedScale[1],
|
|
45
|
-
paddingBottom: expectedScale[2],
|
|
46
|
-
paddingLeft: expectedScale[3],
|
|
47
|
-
paddingRight: expectedScale[4]
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it(`maps horizontal and vertical props to RN styles`, () => {
|
|
52
|
-
const props = {
|
|
53
|
-
horizontal: 1,
|
|
54
|
-
vertical: 2
|
|
55
|
-
}
|
|
56
|
-
const { getByText } = render(
|
|
57
|
-
<Theme>
|
|
58
|
-
<Box {...props}>
|
|
59
|
-
<Text>{textContent}</Text>
|
|
60
|
-
</Box>
|
|
61
|
-
</Theme>
|
|
62
|
-
)
|
|
63
|
-
expect(getByText(textContent).parent).toHaveStyle({
|
|
64
|
-
paddingLeft: expectedScale[1],
|
|
65
|
-
paddingRight: expectedScale[1],
|
|
66
|
-
paddingTop: expectedScale[2],
|
|
67
|
-
paddingBottom: expectedScale[2]
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it(`maps all-sides space prop to RN styles`, () => {
|
|
72
|
-
const props = {
|
|
73
|
-
space: 3
|
|
74
|
-
}
|
|
75
|
-
const { getByText } = render(
|
|
76
|
-
<Theme>
|
|
77
|
-
<Box {...props}>
|
|
78
|
-
<Text>{textContent}</Text>
|
|
79
|
-
</Box>
|
|
80
|
-
</Theme>
|
|
81
|
-
)
|
|
82
|
-
expect(getByText(textContent).parent).toHaveStyle({
|
|
83
|
-
paddingLeft: expectedScale[3],
|
|
84
|
-
paddingRight: expectedScale[3],
|
|
85
|
-
paddingTop: expectedScale[3],
|
|
86
|
-
paddingBottom: expectedScale[3]
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it(`applies side overrides in increasing specificity`, () => {
|
|
91
|
-
const props = {
|
|
92
|
-
space: 1,
|
|
93
|
-
horizontal: 2,
|
|
94
|
-
top: 3,
|
|
95
|
-
right: 4
|
|
96
|
-
}
|
|
97
|
-
const { getByText } = render(
|
|
98
|
-
<Theme>
|
|
99
|
-
<Box {...props}>
|
|
100
|
-
<Text>{textContent}</Text>
|
|
101
|
-
</Box>
|
|
102
|
-
</Theme>
|
|
103
|
-
)
|
|
104
|
-
expect(getByText(textContent).parent).toHaveStyle({
|
|
105
|
-
paddingLeft: expectedScale[2],
|
|
106
|
-
paddingRight: expectedScale[4],
|
|
107
|
-
paddingTop: expectedScale[3],
|
|
108
|
-
paddingBottom: expectedScale[1]
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
})
|