playbook_ui 11.19.0 → 11.20.0.pre.alpha.passthrough1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +1 -0
  4. data/app/pb_kits/playbook/pb_body/_body.scss +10 -1
  5. data/app/pb_kits/playbook/pb_body/docs/_body_styled.html.erb +9 -0
  6. data/app/pb_kits/playbook/pb_body/docs/_body_styled.jsx +20 -0
  7. data/app/pb_kits/playbook/pb_body/docs/_body_styled.md +1 -0
  8. data/app/pb_kits/playbook/pb_body/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_body/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +7 -7
  11. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +69 -3
  12. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -1
  13. data/app/pb_kits/playbook/pb_dialog/dialog.rb +1 -1
  14. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +12 -0
  15. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +5 -4
  16. data/app/pb_kits/playbook/pb_file_upload/docs/_description.md +2 -3
  17. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_message.jsx +40 -0
  18. data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -2
  19. data/app/pb_kits/playbook/pb_file_upload/docs/index.js +1 -0
  20. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +12 -0
  21. data/app/pb_kits/playbook/pb_paginate/_paginate.scss +69 -0
  22. data/app/pb_kits/playbook/pb_paginate/docs/_paginate_default.html.erb +19 -0
  23. data/app/pb_kits/playbook/pb_paginate/docs/example.yml +6 -0
  24. data/app/pb_kits/playbook/pb_paginate/paginate.html.erb +5 -0
  25. data/app/pb_kits/playbook/pb_paginate/paginate.rb +19 -0
  26. data/app/pb_kits/playbook/pb_radio/_radio.tsx +4 -4
  27. data/app/pb_kits/playbook/pb_select/_select.scss +1 -1
  28. data/app/pb_kits/playbook/pb_selectable_card/{_selectable_card.jsx → _selectable_card.tsx} +47 -42
  29. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.jsx +1 -2
  30. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_single_select.jsx +1 -1
  31. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.test.js +185 -0
  32. data/app/pb_kits/playbook/pb_selectable_icon/{_selectable_icon.jsx → _selectable_icon.tsx} +29 -32
  33. data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +1 -5
  34. data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +1 -4
  35. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.test.js +148 -0
  36. data/lib/playbook/pagination_renderer.rb +41 -0
  37. data/lib/playbook/version.rb +2 -2
  38. data/lib/playbook.rb +2 -0
  39. metadata +32 -6
@@ -1,10 +1,9 @@
1
1
  /* @flow */
2
2
 
3
- import React from 'react'
3
+ import React, {useRef} from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import type { InputCallback } from '../types'
7
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
8
7
  import {
9
8
  buildAriaProps,
10
9
  buildCss,
@@ -19,13 +18,13 @@ import Flex from '../pb_flex/_flex'
19
18
  import Radio from '../pb_radio/_radio'
20
19
 
21
20
  type SelectableCardProps = {
22
- aria?: object,
23
- checked: boolean,
24
- children?: array<React.ReactChild>,
21
+ aria?: { [key: string]: string },
22
+ checked?: boolean,
23
+ children?: React.ReactChild[] | React.ReactChild,
25
24
  className?: string,
26
- customIcon?: SVGElement,
25
+ customIcon?: {[key: string] :SVGElement},
27
26
  dark?: boolean,
28
- data: object,
27
+ data?: { [key: string]: string },
29
28
  disabled?: boolean,
30
29
  error?: boolean,
31
30
  icon?: boolean,
@@ -33,32 +32,31 @@ type SelectableCardProps = {
33
32
  inputId?: string,
34
33
  multi?: boolean,
35
34
  name?: string,
36
- onChange: InputCallback<HTMLInputElement>,
35
+ onChange: (event: React.FormEvent<HTMLInputElement>) => void,
37
36
  text?: string,
38
37
  value?: string,
39
38
  variant?: string,
40
- }
39
+ } & GlobalProps
41
40
 
42
- const SelectableCard = ({
43
- aria = {},
44
- checked = false,
45
- children,
46
- className,
47
- customIcon,
48
- dark = false,
49
- data = {},
50
- disabled = false,
51
- error = false,
52
- icon = false,
53
- inputId = null,
54
- multi = true,
55
- name,
56
- onChange = noop,
57
- text,
58
- value,
59
- variant = 'default',
60
- ...props
61
- }: SelectableCardProps) => {
41
+ const SelectableCard = (props: SelectableCardProps) => {
42
+ const {
43
+ aria = {},
44
+ checked = false,
45
+ className,
46
+ customIcon,
47
+ dark = false,
48
+ data = {},
49
+ disabled = false,
50
+ error = false,
51
+ icon = false,
52
+ inputId = null,
53
+ multi = true,
54
+ name,
55
+ onChange = noop,
56
+ text,
57
+ value,
58
+ variant = 'default',
59
+ } = props
62
60
  const ariaProps = buildAriaProps(aria)
63
61
  const dataProps = buildDataProps(data)
64
62
 
@@ -87,7 +85,7 @@ const SelectableCard = ({
87
85
  }
88
86
  }
89
87
 
90
- const inputRef = React.createRef()
88
+ const inputRef = useRef(null)
91
89
  // Delegate clicks to hidden input from visible one
92
90
  const handleClick = () => {
93
91
  inputRef.current.click()
@@ -96,7 +94,15 @@ const SelectableCard = ({
96
94
  const inputType = multi ? 'checkbox' : 'radio'
97
95
  const inputIdPresent = inputId !== null ? inputId : name
98
96
  const Input = multi ? Checkbox : Radio
99
- const labelProps = variant === 'displayInput' ? Object.assign(props, { padding: 'none' }) : props
97
+
98
+ const filteredProps = {...props}
99
+ delete filteredProps?.inputId
100
+ delete filteredProps?.children
101
+ delete filteredProps?.icon
102
+ delete filteredProps?.error
103
+ delete filteredProps?.dark
104
+ delete filteredProps?.multi
105
+ const labelProps: GlobalProps = variant === 'displayInput' ? { ...filteredProps, padding: 'none' } : { ...filteredProps }
100
106
 
101
107
  return (
102
108
  <div
@@ -105,7 +111,6 @@ const SelectableCard = ({
105
111
  className={classes}
106
112
  >
107
113
  <input
108
- {...props}
109
114
  checked={checked}
110
115
  disabled={disabled}
111
116
  id={inputIdPresent}
@@ -114,6 +119,7 @@ const SelectableCard = ({
114
119
  ref={inputRef}
115
120
  type={inputType}
116
121
  value={value}
122
+ {...filteredProps}
117
123
  />
118
124
 
119
125
  <label
@@ -121,8 +127,7 @@ const SelectableCard = ({
121
127
  htmlFor={inputIdPresent}
122
128
  >
123
129
  <div className="buffer">
124
- <Choose>
125
- <When condition={variant === 'displayInput'}>
130
+ {variant === 'displayInput' ?
126
131
  <Flex vertical="center">
127
132
  <Flex
128
133
  orientation="column"
@@ -130,7 +135,9 @@ const SelectableCard = ({
130
135
  paddingRight="xs"
131
136
  vertical="center"
132
137
  >
133
- <Input dark={dark}>
138
+ <Input
139
+ dark={dark}
140
+ >
134
141
  <input
135
142
  checked={checked}
136
143
  disabled={disabled}
@@ -146,14 +153,12 @@ const SelectableCard = ({
146
153
  padding="sm"
147
154
  status={error ? 'negative' : null}
148
155
  >
149
- {text || children}
156
+ {text ||props.children}
150
157
  </Card.Body>
151
158
  </Flex>
152
- </When>
153
- <Otherwise>
154
- {text || children}
155
- </Otherwise>
156
- </Choose>
159
+ :
160
+ text || props.children
161
+ }
157
162
  {displayIcon()}
158
163
  </div>
159
164
  </label>
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import SelectableCard from '../_selectable_card.jsx'
2
+ import SelectableCard from '../_selectable_card.tsx'
3
3
 
4
4
  const SelectableCardDefault = (props) => {
5
5
  const [selectedWithIcon, setSelectedWithIcon] = useState(true)
@@ -24,7 +24,6 @@ const SelectableCardDefault = (props) => {
24
24
 
25
25
  <SelectableCard
26
26
  checked={selectedNoIcon}
27
- icon={false}
28
27
  inputId="selectedWithoutIcon"
29
28
  name="selectedWithoutIcon"
30
29
  onChange={() => setSelectedNoIcon(!selectedNoIcon)}
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import SelectableCard from '../_selectable_card.jsx'
2
+ import SelectableCard from '../_selectable_card.tsx'
3
3
 
4
4
  const SelectableCardSingleSelect = (props) => {
5
5
  const [selected, setSelected] = useState(null)
@@ -0,0 +1,185 @@
1
+ import React, { useState } from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+ import SelectableCard from './_selectable_card'
4
+ import { Body, Title, Image } from '../'
5
+
6
+ const SelectableCardMultiSelect = () => {
7
+ const [selected, setSelected] = useState(true)
8
+ const [unselected, setUnselected] = useState(false)
9
+ const [disabled, setDisabled] = useState(false)
10
+
11
+ return (
12
+ <>
13
+ <SelectableCard
14
+ checked={selected}
15
+ inputId="selected"
16
+ name="selected"
17
+ onChange={() => setSelected(!selected)}
18
+ value="selected"
19
+ >
20
+ {'Selected'}
21
+ </SelectableCard>
22
+
23
+ <SelectableCard
24
+ checked={unselected}
25
+ inputId="unselected"
26
+ name="unselected"
27
+ onChange={() => setUnselected(!unselected)}
28
+ value="unselected"
29
+ >
30
+ {'Unselected'}
31
+ </SelectableCard>
32
+
33
+ <SelectableCard
34
+ checked={disabled}
35
+ disabled
36
+ inputId="disabled"
37
+ name="disabled"
38
+ onChange={() => setDisabled(!disabled)}
39
+ value="disabled"
40
+ >
41
+ {'Disabled'}
42
+ </SelectableCard>
43
+
44
+ </>
45
+ )
46
+ }
47
+
48
+ const SelectableCardSingleSelect = () => {
49
+ const [selected, setSelected] = useState(null)
50
+ const handleSelect = (event) => {
51
+ setSelected(event.target.value)
52
+ }
53
+
54
+ return (
55
+ <>
56
+ <SelectableCard
57
+ checked={selected === 'male'}
58
+ inputId="male1"
59
+ multi={false}
60
+ name="gender"
61
+ onChange={handleSelect}
62
+ value="male"
63
+ >
64
+ {'Male'}
65
+ </SelectableCard>
66
+
67
+ <SelectableCard
68
+ checked={selected === 'female'}
69
+ inputId="female1"
70
+ multi={false}
71
+ name="gender"
72
+ onChange={handleSelect}
73
+ value="female"
74
+ >
75
+ {'Female'}
76
+ </SelectableCard>
77
+
78
+ <SelectableCard
79
+ checked={selected === 'other'}
80
+ inputId="other1"
81
+ multi={false}
82
+ name="gender"
83
+ onChange={handleSelect}
84
+ value="other"
85
+ >
86
+ {'Other'}
87
+ </SelectableCard>
88
+ </>
89
+ )
90
+ }
91
+
92
+
93
+ test('should start with a checked item', () => {
94
+ render(<SelectableCardMultiSelect />)
95
+
96
+ const kit = screen.getByLabelText('Selected')
97
+ expect(kit).toBeChecked()
98
+ })
99
+
100
+ test('should start with a disabled item', () => {
101
+ render(<SelectableCardMultiSelect />)
102
+
103
+ const kit = screen.getByLabelText('Disabled')
104
+ expect(kit).toBeDisabled()
105
+ })
106
+
107
+ test('should click and check an item', () => {
108
+ render(<SelectableCardMultiSelect />)
109
+
110
+ const kit = screen.getByLabelText('Unselected')
111
+ expect(kit).not.toBeChecked()
112
+ kit.click()
113
+ expect(kit).toBeChecked()
114
+ })
115
+
116
+ test('should check multiple items', () => {
117
+ render(<SelectableCardMultiSelect />)
118
+
119
+ const checkedItem = screen.getByLabelText('Selected')
120
+ expect(checkedItem).toBeChecked()
121
+
122
+ const uncheckedItem = screen.getByLabelText('Unselected')
123
+ expect(uncheckedItem).not.toBeChecked()
124
+
125
+ uncheckedItem.click()
126
+
127
+ expect(checkedItem).toBeChecked
128
+ expect(uncheckedItem).toBeChecked
129
+ })
130
+
131
+ test('should check only single item', () => {
132
+ render(<SelectableCardSingleSelect/>)
133
+
134
+ const male = screen.getByLabelText('Male')
135
+ expect(male).not.toBeChecked
136
+
137
+ const female = screen.getByLabelText('Female')
138
+ expect(female).not.toBeChecked
139
+
140
+ const other = screen.getByLabelText('Other')
141
+ expect(other).not.toBeChecked
142
+
143
+ male.click()
144
+ other.click()
145
+
146
+ expect(male).not.toBeChecked
147
+ expect(female).not.toBeChecked
148
+ expect(other).toBeChecked
149
+ })
150
+
151
+ test('should have text passed through the text prop', () => {
152
+ render (<SelectableCard text="This passes text through the tag"/>)
153
+
154
+ expect(screen.getByText("This passes text through the tag")).toBeInTheDocument()
155
+ })
156
+
157
+ test('should pass block content', () => {
158
+ render (<SelectableCard>
159
+ <Title
160
+ size={4}
161
+ text="Block"
162
+ />
163
+ <Body
164
+ tag="span"
165
+ >
166
+ {'This uses block'}
167
+ </Body>
168
+ </SelectableCard>
169
+ )
170
+ expect(screen.getByText("This uses block")).toBeInTheDocument()
171
+ })
172
+
173
+ test('should pass image inside card content', () => {
174
+ render (<SelectableCard>
175
+ <Image
176
+ rounded
177
+ size="xl"
178
+ url="https://unsplash.it/500/400/?image=634"
179
+ />
180
+ </SelectableCard>
181
+ )
182
+ const dispalyedImg = document.querySelector("img")
183
+
184
+ expect(dispalyedImg.src).toContain("image=634")
185
+ })
@@ -1,23 +1,20 @@
1
1
  /* @flow */
2
-
3
2
  import React from 'react'
4
3
  import classnames from 'classnames'
5
-
6
4
  import { globalProps } from '../utilities/globalProps'
7
5
  import {
8
6
  buildAriaProps,
9
7
  buildCss,
10
8
  buildDataProps,
11
9
  } from '../utilities/props'
12
-
13
10
  import Icon from '../pb_icon/_icon'
14
11
  import Title from '../pb_title/_title'
15
12
 
16
13
  type SelectableIconProps = {
17
- aria?: Object,
14
+ aria?: {[key: string]: string},
18
15
  checked?: boolean,
19
16
  className?: string,
20
- customIcon?: SVGElement,
17
+ customIcon?: {[key: string] :SVGElement},
21
18
  disabled?: boolean,
22
19
  data?: Object,
23
20
  icon: string,
@@ -59,54 +56,54 @@ const SelectableIcon = ({
59
56
  )
60
57
 
61
58
  const inputType = multi === false ? 'radio' : 'checkbox'
62
-
63
59
  const inputIdPresent = inputId !== null ? inputId : name
64
60
 
65
61
  return (
66
62
  <div
67
- {...ariaProps}
68
- {...dataProps}
69
- className={classes}
63
+ {...ariaProps}
64
+ {...dataProps}
65
+ className={classes}
70
66
  >
71
- <If condition={inputs === 'disabled'}>
67
+ {inputs === 'disabled' && (
72
68
  <>
73
69
  <Icon
74
- customIcon={customIcon}
75
- icon={icon}
76
- size="2x"
70
+ customIcon={customIcon}
71
+ icon={icon}
72
+ size="2x"
77
73
  />
78
74
  <Title
79
- size={4}
80
- tag="h4"
81
- text={text}
75
+ size={4}
76
+ tag="h4"
77
+ text={text}
82
78
  />
83
79
  </>
84
- </If>
85
- <If condition={inputs === 'enabled'}>
80
+ )}
81
+
82
+ {inputs === 'enabled' && (
86
83
  <>
87
84
  <input
88
- {...props}
89
- checked={checked}
90
- disabled={disabled}
91
- id={inputIdPresent}
92
- name={name}
93
- type={inputType}
94
- value={value}
85
+ {...props}
86
+ checked={checked}
87
+ disabled={disabled}
88
+ id={inputIdPresent}
89
+ name={name}
90
+ type={inputType}
91
+ value={value}
95
92
  />
96
93
  <label htmlFor={inputIdPresent}>
97
94
  <Icon
98
- customIcon={customIcon}
99
- icon={icon}
100
- size="2x"
95
+ customIcon={customIcon}
96
+ icon={icon}
97
+ size="2x"
101
98
  />
102
99
  <Title
103
- size={4}
104
- tag="h4"
105
- text={text}
100
+ size={4}
101
+ tag="h4"
102
+ text={text}
106
103
  />
107
104
  </label>
108
105
  </>
109
- </If>
106
+ )}
110
107
  </div>
111
108
  )
112
109
  }
@@ -1,8 +1,7 @@
1
1
  import React, { useState } from 'react'
2
-
3
2
  import SelectableIcon from '../_selectable_icon'
4
3
 
5
- const SelectableIconDefault = (props) => {
4
+ const SelectableIconDefault = () => {
6
5
  const [ checkSelected, toggleSelected ] = useState(true)
7
6
  const [ checkUnselected, toggleUnselected ] = useState(false)
8
7
  const [ checkDisabled, toggleDisabled ] = useState(false)
@@ -16,7 +15,6 @@ const SelectableIconDefault = (props) => {
16
15
  inputId={10}
17
16
  onChange={() => toggleSelected(!checkSelected)}
18
17
  text="US Dollar"
19
- {...props}
20
18
  />
21
19
 
22
20
  <SelectableIcon
@@ -25,7 +23,6 @@ const SelectableIconDefault = (props) => {
25
23
  inputId={11}
26
24
  onChange={() => toggleUnselected(!checkUnselected)}
27
25
  text="Euro"
28
- {...props}
29
26
  />
30
27
 
31
28
  <SelectableIcon
@@ -35,7 +32,6 @@ const SelectableIconDefault = (props) => {
35
32
  inputId={12}
36
33
  onChange={() => toggleDisabled(!checkDisabled)}
37
34
  text="Yen"
38
- {...props}
39
35
  />
40
36
  </div>
41
37
  )
@@ -2,7 +2,7 @@ import React, { useState } from 'react'
2
2
 
3
3
  import SelectableIcon from '../_selectable_icon'
4
4
 
5
- const SelectableIconSingleSelect = (props) => {
5
+ const SelectableIconSingleSelect = () => {
6
6
  const [ selectedFormat, toggleFormat ] = useState(null)
7
7
 
8
8
  return (
@@ -17,7 +17,6 @@ const SelectableIconSingleSelect = (props) => {
17
17
  onChange={() => toggleFormat('Cassette')}
18
18
  text="Cassette"
19
19
  value="Cassette"
20
- {...props}
21
20
  />
22
21
 
23
22
  <SelectableIcon
@@ -29,7 +28,6 @@ const SelectableIconSingleSelect = (props) => {
29
28
  onChange={() => toggleFormat('CD')}
30
29
  text="CD"
31
30
  value="CD"
32
- {...props}
33
31
  />
34
32
 
35
33
  <SelectableIcon
@@ -41,7 +39,6 @@ const SelectableIconSingleSelect = (props) => {
41
39
  onChange={() => toggleFormat('Vinyl')}
42
40
  text="Vinyl"
43
41
  value="Vinyl"
44
- {...props}
45
42
  />
46
43
  </div>
47
44
  )
@@ -0,0 +1,148 @@
1
+ import React, { useState } from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+ import SelectableIcon from './_selectable_icon'
4
+
5
+ const testId = "selectableIcon"
6
+
7
+ const SelectableIconMultiSelect = () => {
8
+ const [checkSelected, toggleSelected] = useState(true)
9
+ const [checkUnselected, toggleUnselected] = useState(false)
10
+ const [checkDisabled, toggleDisabled] = useState(false)
11
+
12
+ return (
13
+ <>
14
+ <SelectableIcon
15
+ checked={checkSelected}
16
+ className="custom-class"
17
+ data={{ testid: testId }}
18
+ icon="dollar-sign"
19
+ inputId={10}
20
+ onChange={() => toggleSelected(!checkSelected)}
21
+ text="US Dollar"
22
+ />
23
+
24
+ <SelectableIcon
25
+ checked={checkUnselected}
26
+ icon="euro-sign"
27
+ inputId={11}
28
+ onChange={() => toggleUnselected(!checkUnselected)}
29
+ text="Euro"
30
+ />
31
+
32
+ <SelectableIcon
33
+ checked={checkDisabled}
34
+ disabled
35
+ icon="yen-sign"
36
+ inputId={12}
37
+ onChange={() => toggleDisabled(!checkDisabled)}
38
+ text="Yen"
39
+ />
40
+ </>
41
+ )
42
+ }
43
+
44
+ const SelectableIconSingleSelect = () => {
45
+ const [selectedFormat, toggleFormat] = useState('')
46
+
47
+ return (
48
+ <>
49
+ <SelectableIcon
50
+ checked={selectedFormat === 'Cassette'}
51
+ icon="cassette-tape"
52
+ inputId={13}
53
+ multi={false}
54
+ name="music-format"
55
+ onChange={() => toggleFormat('Cassette')}
56
+ text="Cassette"
57
+ value="Cassette"
58
+ />
59
+
60
+ <SelectableIcon
61
+ checked={selectedFormat === 'CD'}
62
+ icon="compact-disc"
63
+ inputId={14}
64
+ multi={false}
65
+ name="music-format"
66
+ onChange={() => toggleFormat('CD')}
67
+ text="CD"
68
+ value="CD"
69
+ />
70
+
71
+ <SelectableIcon
72
+ checked={selectedFormat === 'Vinyl'}
73
+ icon="album-collection"
74
+ inputId={15}
75
+ multi={false}
76
+ name="music-format"
77
+ onChange={() => toggleFormat('Vinyl')}
78
+ text="Vinyl"
79
+ value="Vinyl"
80
+ />
81
+ </>
82
+ )
83
+ }
84
+
85
+ test('should start with a checked item', () => {
86
+ render(<SelectableIconMultiSelect />)
87
+
88
+ const kit = screen.getByLabelText('US Dollar')
89
+ expect(kit).toBeChecked()
90
+ })
91
+
92
+ test('should start with a disabled item', () => {
93
+ render(<SelectableIconMultiSelect />)
94
+
95
+ const kit = screen.getByLabelText('Yen')
96
+ expect(kit).toBeDisabled()
97
+ })
98
+
99
+ test('should click and check an item', () => {
100
+ render(<SelectableIconMultiSelect />)
101
+
102
+ const kit = screen.getByLabelText('Euro')
103
+ expect(kit).not.toBeChecked()
104
+ kit.click()
105
+ expect(kit).toBeChecked()
106
+ })
107
+
108
+ test('should check multiple items', () => {
109
+ render(<SelectableIconMultiSelect />)
110
+
111
+ const usDollarItem = screen.getByLabelText('US Dollar')
112
+ expect(usDollarItem).toBeChecked()
113
+
114
+ const euroItem = screen.getByLabelText('Euro')
115
+ expect(euroItem).not.toBeChecked()
116
+
117
+ euroItem.click()
118
+
119
+ expect(usDollarItem).toBeChecked()
120
+ expect(euroItem).toBeChecked()
121
+ })
122
+
123
+ test('should check single item', () => {
124
+ render(<SelectableIconSingleSelect />)
125
+
126
+ const cassetteItem = screen.getByLabelText('Cassette')
127
+ expect(cassetteItem).not.toBeChecked()
128
+
129
+ const cdItem = screen.getByLabelText('CD')
130
+ expect(cdItem).not.toBeChecked()
131
+
132
+ const vinylItem = screen.getByLabelText('Vinyl')
133
+ expect(vinylItem).not.toBeChecked()
134
+
135
+ cassetteItem.click()
136
+ cdItem.click()
137
+
138
+ expect(cassetteItem).not.toBeChecked()
139
+ expect(cdItem).toBeChecked()
140
+ expect(vinylItem).not.toBeChecked()
141
+ })
142
+
143
+ test('should render custom class and data', () => {
144
+ render(<SelectableIconMultiSelect />)
145
+
146
+ const kit = screen.getByTestId(testId)
147
+ expect(kit).toHaveClass('custom-class')
148
+ })