@eturnity/eturnity_reusable_components 9.37.0-ATE-95.0 → 9.37.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "9.37.0-ATE-95.0",
3
+ "version": "9.37.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -3,31 +3,37 @@ import { mount } from '@vue/test-utils'
3
3
  import Option from '@/components/inputs/select/option'
4
4
  import theme from '@/assets/theme'
5
5
 
6
+ // jsdom never receives the stylesheet vue3-styled-components generates, so the
7
+ // hashed class on the rendered option is the observable: two mounts share a
8
+ // class only when they resolve to the same styles.
6
9
  describe('RCoption', () => {
7
- const mountOption = (props = {}) =>
10
+ const styleClass = (props = {}) =>
8
11
  mount(Option, {
9
12
  props: { value: 'a', ...props },
10
13
  slots: { default: 'Option A' },
11
14
  })
15
+ .classes()
16
+ .join(' ')
12
17
 
13
18
  it('hovers on grey 300 by default', () => {
14
- expect(mountOption().vm.hoveredBackgroundColor).toBe(
15
- theme.semanticColors.grey[300]
19
+ expect(styleClass()).toBe(
20
+ styleClass({ hoveredBgColor: theme.semanticColors.grey[300] })
16
21
  )
17
22
  })
18
23
 
19
24
  it('lets an explicit hoveredBgColor win over the default', () => {
20
- expect(
21
- mountOption({ hoveredBgColor: 'grey4' }).vm.hoveredBackgroundColor
22
- ).toBe('grey4')
25
+ expect(styleClass({ hoveredBgColor: 'grey4' })).not.toBe(styleClass())
26
+ expect(styleClass({ hoveredBgColor: 'grey4' })).toBe(
27
+ styleClass({ hoveredBgColor: theme.colors.grey4 })
28
+ )
23
29
  })
24
30
 
25
31
  it('keeps its own hover colours in dark and transparent colour modes', () => {
26
- expect(mountOption({ colorMode: 'dark' }).vm.hoveredBackgroundColor).toBe(
27
- theme.semanticColors.teal[800]
32
+ expect(styleClass({ colorMode: 'dark', hoveredBgColor: 'grey4' })).toBe(
33
+ styleClass({ colorMode: 'dark' })
28
34
  )
29
35
  expect(
30
- mountOption({ colorMode: 'transparent' }).vm.hoveredBackgroundColor
31
- ).toBe('grey6')
36
+ styleClass({ colorMode: 'transparent', hoveredBgColor: 'grey4' })
37
+ ).toBe(styleClass({ colorMode: 'transparent' }))
32
38
  })
33
39
  })
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable */
2
2
  import { mount, DOMWrapper } from '@vue/test-utils'
3
3
  import ThreeDots from './index.vue'
4
+ import theme from '@/assets/theme'
4
5
 
5
6
  jest.mock('@/components/icon/iconCache.mjs', () => ({
6
7
  fetchIcon: jest.fn(() => Promise.resolve('')),
@@ -118,4 +119,28 @@ describe('ThreeDots', () => {
118
119
  expect(w.emitted('on-select')).toHaveLength(1)
119
120
  expect(w.emitted('on-select')[0][0]).toMatchObject({ value: 'c1' })
120
121
  })
122
+
123
+ // jsdom never receives the stylesheet vue3-styled-components generates, so the
124
+ // hashed class on the trigger is the observable: two mounts share a class only
125
+ // when they resolve to the same styles.
126
+ describe('hovered background colour', () => {
127
+ const styleClass = (props = {}) => {
128
+ const w = mount(ThreeDots, { props: { options, ...props } })
129
+ const classes = w.classes().join(' ')
130
+ w.unmount()
131
+ return classes
132
+ }
133
+
134
+ it('hovers on grey 300 by default', () => {
135
+ expect(styleClass()).toBe(
136
+ styleClass({ hoveredBackgroundColor: theme.semanticColors.grey[300] })
137
+ )
138
+ })
139
+
140
+ it('lets an explicit hoveredBackgroundColor win over the default', () => {
141
+ expect(
142
+ styleClass({ hoveredBackgroundColor: theme.colors.grey5 })
143
+ ).not.toBe(styleClass())
144
+ })
145
+ })
121
146
  })