@eturnity/eturnity_reusable_components 9.28.2 → 9.28.3-ZOO-3.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.
@@ -7,6 +7,25 @@ const basicOptions = [
7
7
  { value: 'delete', name: 'Delete' },
8
8
  ]
9
9
 
10
+ const nestedOptions = [
11
+ { value: 'edit', name: 'Edit' },
12
+ {
13
+ value: 'move',
14
+ name: 'Move to',
15
+ children: [
16
+ { value: 'folder_a', name: 'Folder A' },
17
+ { value: 'folder_b', name: 'Folder B' },
18
+ ],
19
+ },
20
+ { value: 'delete', name: 'Delete' },
21
+ ]
22
+
23
+ const withDisabledOptions = [
24
+ { value: 'edit', name: 'Edit' },
25
+ { value: 'duplicate', name: 'Duplicate', disabled: true },
26
+ { value: 'delete', name: 'Delete' },
27
+ ]
28
+
10
29
  export default {
11
30
  title: 'Components/ThreeDots/ThreeDots',
12
31
  component: ThreeDots,
@@ -57,3 +76,33 @@ Loading.args = {
57
76
  ...Default.args,
58
77
  isLoading: true,
59
78
  }
79
+
80
+ export const WithNestedChildren = Template.bind({})
81
+ WithNestedChildren.args = {
82
+ ...Default.args,
83
+ options: nestedOptions,
84
+ }
85
+
86
+ export const WithDisabledOption = Template.bind({})
87
+ WithDisabledOption.args = {
88
+ ...Default.args,
89
+ options: withDisabledOptions,
90
+ }
91
+
92
+ export const DarkTheme = Template.bind({})
93
+ DarkTheme.args = {
94
+ ...Default.args,
95
+ colorTheme: 'dark',
96
+ }
97
+
98
+ export const NoTextWrap = Template.bind({})
99
+ NoTextWrap.args = {
100
+ ...Default.args,
101
+ textWrap: false,
102
+ }
103
+
104
+ export const CustomIconColor = Template.bind({})
105
+ CustomIconColor.args = {
106
+ ...Default.args,
107
+ iconColor: '#2196F3',
108
+ }
@@ -0,0 +1,46 @@
1
+ /* eslint-disable */
2
+ import { mount } from '@vue/test-utils'
3
+ import VideoThumbnail from './index.vue'
4
+ import Icon from '@/components/icon'
5
+
6
+ jest.mock('@/components/icon/iconCache.mjs', () => ({
7
+ fetchIcon: jest.fn(() => Promise.resolve('')),
8
+ }))
9
+
10
+ const SRC = 'https://example.com/thumb.jpg'
11
+
12
+ const mountThumbnail = (props = {}) =>
13
+ mount(VideoThumbnail, { props: { src: SRC, ...props } })
14
+
15
+ describe('VideoThumbnail', () => {
16
+ it('renders the image with the provided src', () => {
17
+ expect(mountThumbnail().find('img').attributes('src')).toBe(SRC)
18
+ })
19
+
20
+ it('updates the image when the src prop changes', async () => {
21
+ const wrapper = mountThumbnail()
22
+ await wrapper.setProps({ src: 'https://example.com/other.jpg' })
23
+ expect(wrapper.find('img').attributes('src')).toBe(
24
+ 'https://example.com/other.jpg'
25
+ )
26
+ })
27
+
28
+ it('renders the play icon', () => {
29
+ expect(mountThumbnail().findComponent(Icon).attributes('name')).toBe('play')
30
+ })
31
+
32
+ it('uses the default play icon color and size', () => {
33
+ const icon = mountThumbnail().findComponent(Icon)
34
+ expect(icon.attributes('color')).toBe('blue')
35
+ expect(icon.attributes('size')).toBe('50px')
36
+ })
37
+
38
+ it('forwards playIconColor and playIconSize to the icon', () => {
39
+ const icon = mountThumbnail({
40
+ playIconColor: 'red',
41
+ playIconSize: '20px',
42
+ }).findComponent(Icon)
43
+ expect(icon.attributes('color')).toBe('red')
44
+ expect(icon.attributes('size')).toBe('20px')
45
+ })
46
+ })