@telus-uds/components-base 1.6.0 → 1.7.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 (48) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +13 -13
  3. package/CHANGELOG.json +72 -1
  4. package/CHANGELOG.md +33 -2
  5. package/component-docs.json +60 -24
  6. package/generate-component-docs.js +20 -7
  7. package/lib/Link/TextButton.js +1 -10
  8. package/lib/List/ListItem.js +22 -12
  9. package/lib/Search/Search.js +27 -19
  10. package/lib/TextInput/TextArea.js +1 -1
  11. package/lib/TextInput/TextInput.js +1 -1
  12. package/lib/TextInput/TextInputBase.js +1 -1
  13. package/lib/Typography/Typography.js +12 -10
  14. package/lib/index.js +22 -1
  15. package/lib/utils/input.js +5 -6
  16. package/lib/utils/props/index.js +18 -0
  17. package/lib/utils/props/linkProps.js +3 -7
  18. package/lib/utils/props/textInputProps.js +207 -0
  19. package/lib/utils/props/textProps.js +72 -0
  20. package/lib-module/Link/TextButton.js +1 -10
  21. package/lib-module/List/ListItem.js +22 -12
  22. package/lib-module/Search/Search.js +29 -21
  23. package/lib-module/TextInput/TextArea.js +2 -2
  24. package/lib-module/TextInput/TextInput.js +2 -2
  25. package/lib-module/TextInput/TextInputBase.js +2 -2
  26. package/lib-module/Typography/Typography.js +13 -11
  27. package/lib-module/index.js +1 -1
  28. package/lib-module/utils/input.js +6 -6
  29. package/lib-module/utils/props/index.js +2 -0
  30. package/lib-module/utils/props/linkProps.js +3 -7
  31. package/lib-module/utils/props/textInputProps.js +194 -0
  32. package/lib-module/utils/props/textProps.js +59 -0
  33. package/package.json +1 -1
  34. package/src/Link/TextButton.jsx +1 -19
  35. package/src/List/ListItem.jsx +17 -9
  36. package/src/Search/Search.jsx +33 -21
  37. package/src/TextInput/TextArea.jsx +2 -0
  38. package/src/TextInput/TextInput.jsx +2 -0
  39. package/src/TextInput/TextInputBase.jsx +2 -0
  40. package/src/Typography/Typography.jsx +13 -9
  41. package/src/index.js +4 -1
  42. package/src/utils/input.js +5 -7
  43. package/src/utils/props/index.js +2 -0
  44. package/src/utils/props/linkProps.js +3 -6
  45. package/src/utils/props/textInputProps.js +178 -0
  46. package/src/utils/props/textProps.js +58 -0
  47. package/stories/Search/Search.stories.jsx +49 -2
  48. package/__tests__/Link/LinkBase.test.jsx +0 -22
@@ -13,6 +13,7 @@ import {
13
13
  headingTags,
14
14
  selectSystemProps,
15
15
  textTags,
16
+ textProps,
16
17
  viewProps,
17
18
  getA11yPropsFromHtmlTag
18
19
  } from '../utils'
@@ -20,7 +21,8 @@ import {
20
21
  * @typedef {import('../utils/a11y/semantics').TextTag} TextTag
21
22
  */
22
23
 
23
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
24
+ const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps])
25
+ const [selectTextProps, selectedTextPropTypes] = selectSystemProps([textProps])
24
26
 
25
27
  const selectTextStyles = ({
26
28
  fontWeight,
@@ -62,23 +64,24 @@ const Typography = forwardRef(
62
64
  ) => {
63
65
  const viewport = useViewport()
64
66
  const themeTokens = useThemeTokens('Typography', tokens, variant, { viewport })
65
- const textProps = {
67
+ const resolvedTextProps = {
68
+ ...selectTextProps(rest),
66
69
  style: selectTextStyles(align ? { ...themeTokens, textAlign: align } : themeTokens),
67
70
  dataSet,
68
71
  maxFontSizeMultiplier: getMaxFontMultiplier(themeTokens)
69
72
  }
70
73
 
71
- const selectedProps = selectProps({
74
+ const containerProps = {
72
75
  ...getA11yPropsFromHtmlTag(tag, accessibilityRole),
73
- ...rest
74
- })
76
+ ...selectContainerProps(rest)
77
+ }
75
78
 
76
79
  return block ? (
77
- <View ref={ref} {...selectedProps}>
78
- <Text {...textProps}>{children}</Text>
80
+ <View ref={ref} {...containerProps}>
81
+ <Text {...resolvedTextProps}>{children}</Text>
79
82
  </View>
80
83
  ) : (
81
- <Text ref={ref} {...textProps} {...selectedProps}>
84
+ <Text ref={ref} {...containerProps} {...resolvedTextProps}>
82
85
  {children}
83
86
  </Text>
84
87
  )
@@ -87,7 +90,8 @@ const Typography = forwardRef(
87
90
  Typography.displayName = 'Typography'
88
91
 
89
92
  Typography.propTypes = {
90
- ...selectedSystemPropTypes,
93
+ ...selectedContainerPropTypes,
94
+ ...selectedTextPropTypes,
91
95
  tokens: getTokensPropType('Typography'),
92
96
  variant: variantProp.propType,
93
97
  /**
package/src/index.js CHANGED
@@ -50,7 +50,10 @@ export {
50
50
  useTheme,
51
51
  useSetTheme,
52
52
  useThemeTokens,
53
- getThemeTokens
53
+ getThemeTokens,
54
+ applyOuterBorder,
55
+ applyTextStyles,
56
+ applyShadowToken
54
57
  } from './ThemeProvider'
55
58
 
56
59
  export * from './utils'
@@ -1,4 +1,7 @@
1
1
  import { useCallback, useRef, useState } from 'react'
2
+ /**
3
+ * @typedef {import('react').SyntheticEvent} Event
4
+ */
2
5
 
3
6
  const pluralHooks = ['useMultipleInputValues']
4
7
 
@@ -51,16 +54,13 @@ Consumers of this hook must be one of:
51
54
  *
52
55
  * @param {string} hookName - optional, used for tailoring error messages
53
56
  *
54
- * @typedef {(oldValue: string|number|null) => string|number|null} UpdaterFunction - `setValue` takes a value or
55
- * a function returning a new value from the old value
56
57
  * @returns {{
57
58
  * currentValue: string|number|null
58
- * setValue: (newValue: string|number|null|UpdaterFunction) => void
59
+ * setValue: (newValue: string|number|null|(oldValue: string|number) => string|number, event: Event) => void
59
60
  * resetValue: () => void
60
61
  * isControlled: bool
61
62
  * }}
62
63
  */
63
-
64
64
  export const useInputValue = (props = {}, hookName = 'useInputValue') => {
65
65
  const isCurrentlyControlled = props.value !== undefined
66
66
  const [isControlled] = useState(isCurrentlyControlled)
@@ -108,12 +108,10 @@ export const useInputValue = (props = {}, hookName = 'useInputValue') => {
108
108
  *
109
109
  * @param {string} componentName - optional, used in error messages
110
110
  *
111
- * @typedef {(oldValues: string[]|number[]) => string[]|number[]} UpdaterFunction - `setValues` takes values or
112
- * a function returning new values from old values
113
111
  * @returns {{
114
112
  * currentValues: any
115
113
  * resetValues: () => void
116
- * setValues: (newValues: string[]|number[]|UpdaterFunction) => void
114
+ * setValues: (newValues: string[]|number[]|(oldValues: string[]|number[]) => string[]|number[], event: Event) => void
117
115
  * toggleOneValue: (value: string|number) => void
118
116
  * unsetValues: () => void
119
117
  * }}
@@ -13,5 +13,7 @@ export { default as rectProp } from './rectProp'
13
13
  export { default as responsiveProps } from './responsiveProps'
14
14
  export { default as spacingProps } from './spacingProps'
15
15
  export { default as selectSystemProps } from './selectSystemProps'
16
+ export { default as textInputProps } from './textInputProps'
17
+ export { default as textProps } from './textProps'
16
18
  export { default as variantProp } from './variantProp'
17
19
  export { default as viewProps } from './viewProps'
@@ -22,16 +22,13 @@ export default {
22
22
  */
23
23
  select: getPropSelector(linkPropTypes),
24
24
  /**
25
- * Turn hrefs into press handlers on Native and throw if not given `onPress` or `href`.
25
+ * Turn hrefs into press handlers that open links on Native.
26
26
  *
27
27
  * @param {({ onPress?: () => void, href?: string })}
28
- * @returns {(() => void)|undefined} Returns a press handler, or undefined on web if href
29
- * string is provided. Expects calling component to use href string on web (e.g. in `<a>`).
28
+ * @returns {(() => void)|undefined} Returns a press handler, or undefined on web if no press
29
+ * handler is provided (expects calling component to render as `<a href={href}>` on web).
30
30
  */
31
31
  handleHref: ({ onPress, href }) => {
32
- if (!href && !onPress) {
33
- throw new Error('handleHref requires either href or onPress')
34
- }
35
32
  return Platform.select({
36
33
  web: onPress,
37
34
  default: (...args) => {
@@ -0,0 +1,178 @@
1
+ import PropTypes from 'prop-types'
2
+ import { Platform } from 'react-native'
3
+ import getPropSelector from './getPropSelector'
4
+
5
+ // This file contains common props for components that render a React Native TextInput
6
+ // It excludes interaction handler functions which are in `./handlerProps.js`
7
+
8
+ /**
9
+ * TextInput (web and native) supports some common React Native props
10
+ * shared with React Native's Text component.
11
+ */
12
+ const textProps = {
13
+ maxFontSizeMultiplier: PropTypes.number,
14
+ nativeId: PropTypes.string,
15
+ onLayout: PropTypes.func
16
+ }
17
+
18
+ /**
19
+ * UDS text inputs accept props related to UDS's useInputValue hook
20
+ */
21
+ const inputValueProps = {
22
+ value: PropTypes.string,
23
+ initialValue: PropTypes.string,
24
+ readOnly: PropTypes.bool,
25
+ inactive: PropTypes.bool
26
+ }
27
+
28
+ /**
29
+ * This collection adds props that can be passed through to both React Native's
30
+ * and React Native Web's implementations of the React Native TextInput component.
31
+ */
32
+ const crossPlatform = {
33
+ ...textProps,
34
+ ...inputValueProps,
35
+ /**
36
+ * Web and Android; 'off' disables device autocomplete, other strings are platform-specific.
37
+ * Valid values on Native: https://reactnative.dev/docs/textinput#autocomplete-android
38
+ * Valid values on Web: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
39
+ */
40
+ autoComplete: PropTypes.string,
41
+ /**
42
+ * On Native, default is `true`, passing `false` disables autoCorrect.
43
+ * On web, only supported by Safari and expects "on" or "off" strings.
44
+ */
45
+ autoCorrect: PropTypes.oneOf([true, false, 'on', 'off']),
46
+ /**
47
+ * Focuses the element on mount. On Web, only the first form element with autoFocus is focussed.
48
+ */
49
+ autoFocus: PropTypes.bool,
50
+ /**
51
+ * Default is `true` for single line, `false` for multi-line
52
+ */
53
+ blurOnSubmit: PropTypes.bool,
54
+ /**
55
+ * iOS and Web only, no effect on Android
56
+ */
57
+ clearTextOnFocus: PropTypes.bool,
58
+ /**
59
+ * Default is `true`. On web, this works by mapping to input's `readonly` attribute
60
+ */
61
+ editable: PropTypes.bool,
62
+ /**
63
+ * See documentation for allowed values (varies between Web, Android and iOS) and important notes:
64
+ * - Native: https://reactnative.dev/docs/textinput#keyboardtype
65
+ * - Web: equivalent to `inputmode` but see https://necolas.github.io/react-native-web/docs/text-input/
66
+ */
67
+ keyboardType: PropTypes.string,
68
+ /**
69
+ * Uses native tools (no flicker) to cap the maximum number of characters.
70
+ * On Web, works via `maxlength` attr.
71
+ */
72
+ maxLength: PropTypes.number,
73
+ /**
74
+ * If passed as true, the text input can be multiple lines.
75
+ *
76
+ * > It is important to note that this aligns the text to the top on iOS, and centers it on Android.
77
+ * > Use with textAlignVertical set to top for the same behavior in both platforms.
78
+ */
79
+ multiline: PropTypes.bool,
80
+ /**
81
+ * Web and Android only, requires `multiline` to be `true`.
82
+ */
83
+ numberOfLines: PropTypes.number,
84
+ /**
85
+ * Text to display when no value set.
86
+ * Accesibility guidelines recommend using labels to describe the input and using
87
+ * placeholders rarely and sparingly to prompt a particular format.
88
+ */
89
+ placeholder: PropTypes.string,
90
+ /**
91
+ * Sets placeholder colour. On Web, uses `::placeholder { color: ... }` selector.
92
+ */
93
+ placeholderTextColor: PropTypes.string,
94
+ /**
95
+ * One of a subset of platform-specific options that controls labelling and presentation
96
+ * in on-screen keyboards and accessibility tools. Uses `enterkeyhint` attr on Web.
97
+ *
98
+ * 'done', 'go', 'next', 'search', and 'send' are available for Web, Android and iOS.
99
+ */
100
+ returnKeyType: PropTypes.string,
101
+ /**
102
+ * Obscures passwords and similar. Equivalent to type="password" on Web.
103
+ * Does not work if multiline is true.
104
+ */
105
+ secureTextEntry: PropTypes.bool,
106
+ /**
107
+ * If true, all text will automatically be selected on focus.
108
+ */
109
+ selectTextOnFocus: PropTypes.bool,
110
+ /**
111
+ * Web and iOS. On iOS, default inherits from `autoCorrect`.
112
+ * On Web, equivalent to `spellcheck` attr.
113
+ */
114
+ spellCheck: PropTypes.bool
115
+ }
116
+
117
+ /**
118
+ * These web-only props all control HTML `input` attributes of the same name.
119
+ * Refer to general HTML documentation for more details.
120
+ */
121
+ const webOnly = {
122
+ disabled: PropTypes.bool,
123
+ dir: PropTypes.oneOf(['auto', 'ltr', 'rtl']),
124
+ lang: PropTypes.string
125
+ }
126
+
127
+ /**
128
+ * These props are supported in React Native but not React Native Web.
129
+ *
130
+ * React Native text inputs can be quirky, so a full set of props should be allowed to handle edge cases.
131
+ * Refer to React Native documentation for details, allowed values, and Android/iOS support and versions:
132
+ * https://reactnative.dev/docs/textinput
133
+ *
134
+ * Beware that many React Native text input props apply via complicated logic that chooses a built-in
135
+ * native component based on the values of multiple boolean flags, and may sometimes appear to pick an
136
+ * option that is inappropriate for one flag based on the values of one or more other other flags.
137
+ */
138
+ const nativeOnly = {
139
+ caretHidden: PropTypes.bool,
140
+ clearButtonMode: PropTypes.string,
141
+ contextMenuHidden: PropTypes.bool,
142
+ dataDetectorTypes: PropTypes.string,
143
+ disableFullscreenUI: PropTypes.bool,
144
+ enablesReturnKeyAutomatically: PropTypes.bool,
145
+ importantForAutofill: PropTypes.string,
146
+ inlineImageLeft: PropTypes.string,
147
+ keyboardAppearance: PropTypes.string,
148
+ returnKeyLabel: PropTypes.string,
149
+ rejectResponderTermination: PropTypes.bool,
150
+ scrollEnabled: PropTypes.bool,
151
+ selection: PropTypes.object,
152
+ selectionColor: PropTypes.string,
153
+ showSoftInputOnFocus: PropTypes.bool,
154
+ textAlign: PropTypes.string,
155
+ textContentType: PropTypes.string,
156
+ passwordRules: PropTypes.string,
157
+ textBreakStrategy: PropTypes.string,
158
+ underlineColorAndroid: PropTypes.string
159
+ }
160
+
161
+ export default {
162
+ /**
163
+ * Subset of proptypes that can be passed down to a React Native or React Native Web
164
+ * `TextInput` component. Allow regardless of platform, so cross-platform apps don't warn.
165
+ */
166
+ types: { ...crossPlatform, ...webOnly, ...nativeOnly },
167
+ /**
168
+ * Filters a props object. Return only platform-appropriate TextInput props, native inputs
169
+ * may throw errors on receiving unknown props.
170
+ */
171
+ select: getPropSelector({
172
+ ...crossPlatform,
173
+ ...Platform.select({
174
+ web: webOnly,
175
+ default: nativeOnly
176
+ })
177
+ })
178
+ }
@@ -0,0 +1,58 @@
1
+ import PropTypes from 'prop-types'
2
+ import { Platform } from 'react-native'
3
+ import getPropSelector from './getPropSelector'
4
+
5
+ // These are the props accepted specifically on React Native (Web) `Text` elements.
6
+ // They are generally concerned with the behaviour of multiline text.
7
+
8
+ const crossPlatform = {
9
+ /**
10
+ * Truncates text after this many lines with an ellipsis at the end.
11
+ * On native, ellipsis behaviour may be changed with `ellipsizeMode` prop.
12
+ */
13
+ numberOfLines: PropTypes.number,
14
+ /**
15
+ * Default is true on web and false on native
16
+ */
17
+ selectable: PropTypes.bool
18
+ }
19
+
20
+ /**
21
+ * See React Native docs for latest details on these.
22
+ * https://reactnative.dev/docs/text
23
+ */
24
+ const nativeOnly = {
25
+ ellipsizeMode: PropTypes.string,
26
+ maxFontSizeMultiplier: PropTypes.number,
27
+ minimumFontScale: PropTypes.number,
28
+ onTextLayout: PropTypes.func,
29
+ suppressHighlighting: PropTypes.bool,
30
+ textBreakStrategy: PropTypes.string
31
+ }
32
+
33
+ /**
34
+ * These set HTML attributes of the same name.
35
+ */
36
+ const webOnly = {
37
+ dir: PropTypes.oneOf(['auto', 'ltr', 'rtl']),
38
+ lang: PropTypes.string
39
+ }
40
+
41
+ export default {
42
+ /**
43
+ * Set of prop types specific to React Native and React Native Web `Text`,
44
+ * which largely revolve around the behaviour of multiline non-pressable text.
45
+ */
46
+ types: { ...crossPlatform, ...webOnly, ...nativeOnly },
47
+ /**
48
+ * Filters a props object, returning only props specific to `Text` elements
49
+ * on the current platform. Does not include props applicable to `Text` and `View`.
50
+ */
51
+ select: getPropSelector({
52
+ ...crossPlatform,
53
+ ...Platform.select({
54
+ web: webOnly,
55
+ default: nativeOnly
56
+ })
57
+ })
58
+ }
@@ -1,6 +1,7 @@
1
- import React from 'react'
1
+ /* eslint-disable react/no-multi-comp */
2
+ import React, { useRef, useState } from 'react'
2
3
 
3
- import { Search } from '../../src'
4
+ import { Search, StackView, TextButton, Typography, List, ListItem } from '../../src'
4
5
 
5
6
  export default {
6
7
  title: 'Search',
@@ -17,3 +18,49 @@ Default.args = {}
17
18
 
18
19
  export const Inactive = Template.bind({})
19
20
  Inactive.args = { inactive: true }
21
+
22
+ // Lots of smartphone brands. No need to make the file really long, let them sit on one line.
23
+ // eslint-disable-next-line prettier/prettier
24
+ const options = ['Acer', 'Aermoo', 'AGM', 'Alcatel', 'Allcall', 'Allview', 'Amigoo', 'Amoi', 'Apple', 'Archos', 'Asus', 'Axgio', 'Black Shark', 'BlackBerry', 'Blackview', 'BLU', 'Bluboo', 'BQ', 'Bsimb', 'Cagabi', 'Cat', 'Caterpillar', 'Centric', 'China Mobile', 'Cong', 'Coolpad', 'Cubot', 'Dakele', 'Doogee', 'Doopro', 'E&L', 'Ecoo', 'Elephone', 'Energizer', 'Energy', 'Essential', 'EStar', 'Faea', 'Fairphone', 'Geotel', 'Gigabyte', 'Gigaset', 'Gionee', 'Gome', 'Google', 'Goophone', 'Gretel', 'Hafury', 'Haier', 'Hike', 'HiSense', 'HomTom', 'Honor', 'HP', 'HTC', 'Huawei', 'I Kall', 'iiiF150', 'iLA', 'iMan', 'iNew', 'Infinix', 'InFocus', 'InnJoo', 'Innos', 'Intex', 'iOcean', 'iRULU', 'IUNI', 'iVooMi', 'Jesy', 'Jiake', 'Jiayu', 'Karbonn', 'Kazam', 'Keecoo', 'Kenxinda', 'KingSing', 'KingZone', 'Kodak', 'Kolina', 'Koolnee', 'Landvo', 'Laude', 'Lava', 'Leagoo', 'LeEco (LeTV)', 'Lenovo', 'Leotec', 'LeRee', 'LG', 'Ly', 'Lyf', 'M-Horse', 'M-Net', 'Mann', 'Maze', 'Meiigoo', 'Meitu', 'Meizu', 'Micromax', 'Microsoft', 'Mijue', 'Milai', 'Mlais', 'Morefine', 'Motorola', 'Mpie', 'Mstar', 'MyWigo', 'Neken', 'Neo', 'Newman', 'NO.1', 'Noa', 'Nokia', 'Nomu', 'Nubia', 'Nubia Red Magic', 'NZone', 'OnePlus', 'Oppo', 'Otium', 'Oukitel', 'Palm', 'Panasonic', 'Pantech', 'Pepsi', 'Phicomm', 'Philips', 'Phonemax', 'Plunk', 'POCO', 'Pomp', 'Poptel', 'PPTV', 'Prestigio', 'Qiku', 'Ramos', 'Razer', 'realme', 'Runbo', 'Samsung', 'Sharp', 'Silent Circle', 'Siswoo', 'Smartisan', 'Snopow', 'Sony', 'Sony Ericsson', 'Star', 'Swipe', 'TCL', 'Tengda', 'THL', 'Tianhe', 'Timmy', 'TP-Link', 'Ubro', 'Uhans', 'Uhappy', 'Uimi', 'Ukozi', 'Ulefone', 'UMi', 'UMiDIGI', 'Vargo', 'Vernee', 'ViewSonic', 'Vivo', 'VKworld', 'Voto', 'VPhone', 'Vsmart', 'Weimei', 'Wico', 'Wiko', 'Wileyfox', 'Wolder', 'Woxter', 'Xiaomi', 'Xolo', 'Yota Devices', 'YU', 'Zoji', 'Zopo', 'ZTE', 'Zuk']
25
+
26
+ export const Controlled = (args) => {
27
+ const [value, setValue] = useState('')
28
+ const [searchedValue, setSearchedValue] = useState(null)
29
+ const searchRef = useRef()
30
+ const selectOption = (option) => {
31
+ setValue(option)
32
+ if (searchRef.current?.focus) searchRef.current?.focus()
33
+ }
34
+
35
+ return (
36
+ <StackView space={4}>
37
+ {searchedValue ? (
38
+ <>
39
+ <Typography>Search results page for {searchedValue}.</Typography>
40
+ <Typography>{searchedValue} phones are really good. You should buy one.</Typography>
41
+ <TextButton onPress={() => setSearchedValue(null)}>Go back</TextButton>
42
+ </>
43
+ ) : (
44
+ <>
45
+ <Search
46
+ {...args}
47
+ value={value}
48
+ onChange={setValue}
49
+ ref={searchRef}
50
+ onSubmit={setSearchedValue}
51
+ />
52
+ <List>
53
+ {options
54
+ .filter((option) => !value || option.toLowerCase().match(value.toLowerCase()))
55
+ .map((option) => (
56
+ <ListItem key={option}>
57
+ <TextButton onPress={() => selectOption(option)}>{option}</TextButton>
58
+ </ListItem>
59
+ ))}
60
+ </List>
61
+ </>
62
+ )}
63
+ </StackView>
64
+ )
65
+ }
66
+ Controlled.args = {}
@@ -1,22 +0,0 @@
1
- /* eslint-disable no-console */
2
- import React from 'react'
3
- import { render } from '@testing-library/react-native'
4
-
5
- import Theme from '../../__fixtures__/Theme'
6
- import LinkBase from '../../src/Link/LinkBase'
7
-
8
- beforeEach(() => jest.clearAllMocks())
9
-
10
- describe('LinkBase', () => {
11
- it('throws if neither href nor onPress are provided', async () => {
12
- jest.spyOn(console, 'error').mockImplementation()
13
- expect(() =>
14
- render(
15
- <Theme>
16
- <LinkBase>click me</LinkBase>
17
- </Theme>
18
- )
19
- ).toThrow()
20
- expect(console.error).toHaveBeenCalledTimes(1)
21
- })
22
- })