@myissue/vue-website-page-builder 3.3.96 → 3.3.98

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.
@@ -5,20 +5,119 @@ import { usePageBuilderStateStore } from '../stores/page-builder-state'
5
5
  import componentsArray from './componentsArray.test.json'
6
6
 
7
7
  // Mock store (replace with your actual store or a better mock if needed)
8
- const mockStore: ReturnType<typeof usePageBuilderStateStore> = {
8
+ const mockStore = {
9
+ // Mock getters
10
+ getApplyImageToSelection: { src: '' },
11
+ getLocalStorageItemName: 'test-key',
12
+ getHyberlinkEnable: false,
13
+ getComponents: [],
14
+ getComponent: null,
15
+ getElement: null,
16
+ getComponentArrayAddMethod: null,
17
+ getShowModalTipTap: false,
18
+ getMenuRight: false,
19
+ getBorderStyle: null,
20
+ getBorderWidth: null,
21
+ getBorderColor: null,
22
+ getBorderRadiusGlobal: null,
23
+ getBorderRadiusTopLeft: null,
24
+ getBorderRadiusTopRight: null,
25
+ getBorderRadiusBottomleft: null,
26
+ getBorderRadiusBottomRight: null,
27
+ getElementContainsHyperlink: null,
28
+ getHyperlinkAbility: null,
29
+ getHyperlinkInput: null,
30
+ getHyperlinkMessage: null,
31
+ getHyperlinkError: null,
32
+ getOpenHyperlinkInNewTab: null,
33
+ getOpacity: null,
34
+ getBackgroundOpacity: null,
35
+ getTextAreaVueModel: null,
36
+ getCurrentClasses: [],
37
+ getCurrentStyles: {},
38
+ getFontVerticalPadding: null,
39
+ getFontHorizontalPadding: null,
40
+ getFontVerticalMargin: null,
41
+ getFontHorizontalMargin: null,
42
+ getFontStyle: null,
43
+ getFontFamily: null,
44
+ getFontWeight: null,
45
+ getFontBase: null,
46
+ getFontDesktop: null,
47
+ getFontTablet: null,
48
+ getFontMobile: null,
49
+ getBackgroundColor: null,
50
+ getTextColor: null,
51
+ getBasePrimaryImage: null,
52
+ getPageBuilderConfig: null,
53
+ getCurrentPreviewImage: null,
54
+ getBuilderStarted: false,
55
+ getIsLoadingGlobal: false,
56
+ getIsSaving: false,
57
+ getHasLocalDraftForUpdate: false,
58
+ getIsLoadingResumeEditing: false,
59
+ getIsRestoring: false,
60
+ getCurrentLanguage: null,
61
+ getHistoryIndex: 0,
62
+ getHistoryLength: 0,
63
+
64
+ // Mock actions
9
65
  setBuilderStarted: vi.fn(),
10
66
  setPageBuilderConfig: vi.fn(),
11
- getPageBuilderConfig: {},
67
+ setHistoryIndex: vi.fn(),
68
+ setHistoryLength: vi.fn(),
69
+ setLocalStorageItemName: vi.fn(),
70
+ setShowModalTipTap: vi.fn(),
71
+ setMenuRight: vi.fn(),
72
+ setBorderStyle: vi.fn(),
73
+ setBorderWidth: vi.fn(),
74
+ setBorderColor: vi.fn(),
75
+ setBorderRadiusGlobal: vi.fn(),
76
+ setBorderRadiusTopLeft: vi.fn(),
77
+ setBorderRadiusTopRight: vi.fn(),
78
+ setBorderRadiusBottomleft: vi.fn(),
79
+ setBorderRadiusBottomRight: vi.fn(),
80
+ setElementContainsHyperlink: vi.fn(),
81
+ setHyperlinkAbility: vi.fn(),
82
+ setHyperlinkInput: vi.fn(),
83
+ setHyperlinkMessage: vi.fn(),
84
+ setHyperlinkError: vi.fn(),
85
+ setHyberlinkEnable: vi.fn(),
86
+ setOpenHyperlinkInNewTab: vi.fn(),
87
+ setOpacity: vi.fn(),
88
+ setBackgroundOpacity: vi.fn(),
89
+ setTextAreaVueModel: vi.fn(),
90
+ setClass: vi.fn(),
91
+ removeClass: vi.fn(),
92
+ setCurrentClasses: vi.fn(),
93
+ setCurrentStyles: vi.fn(),
94
+ setFontVerticalPadding: vi.fn(),
95
+ setFontHorizontalPadding: vi.fn(),
96
+ setFontVerticalMargin: vi.fn(),
97
+ setFontHorizontalMargin: vi.fn(),
98
+ setFontStyle: vi.fn(),
99
+ setFontFamily: vi.fn(),
100
+ setFontWeight: vi.fn(),
101
+ setFontBase: vi.fn(),
102
+ setFontDesktop: vi.fn(),
103
+ setFontTablet: vi.fn(),
104
+ setFontMobile: vi.fn(),
105
+ setBackgroundColor: vi.fn(),
106
+ setTextColor: vi.fn(),
107
+ setElement: vi.fn(),
108
+ setComponent: vi.fn(),
12
109
  setComponents: vi.fn(),
110
+ setPushComponents: vi.fn(),
111
+ setBasePrimaryImage: vi.fn(),
112
+ setCurrentLayoutPreview: vi.fn(),
113
+ setApplyImageToSelection: vi.fn(),
114
+ setCurrentPreviewImage: vi.fn(),
13
115
  setIsLoadingGlobal: vi.fn(),
14
- setIsRestoring: vi.fn(),
15
- setIsLoadingResumeEditing: vi.fn(),
116
+ setIsSaving: vi.fn(),
16
117
  setHasLocalDraftForUpdate: vi.fn(),
17
- setComponent: vi.fn(),
18
- setElement: vi.fn(),
19
- getLocalStorageItemName: 'test-key',
20
- setLocalStorageItemName: vi.fn(),
21
- // ...add more as needed for your test
118
+ setIsLoadingResumeEditing: vi.fn(),
119
+ setIsRestoring: vi.fn(),
120
+ setCurrentLanguage: vi.fn(),
22
121
  } as unknown as ReturnType<typeof usePageBuilderStateStore>
23
122
 
24
123
  const configPageBuilder = {
@@ -60,7 +159,7 @@ describe('PageBuilderService', () => {
60
159
 
61
160
  it('should handle missing components array gracefully', async () => {
62
161
  const result = await service.startBuilder(configPageBuilder)
63
- expect(result).toHaveProperty('message', 'Page builder started successfully.')
64
- // Add more assertions for this scenario
162
+ expect(result).toHaveProperty('validation.error', true)
163
+ expect(result).toHaveProperty('validation.reason', 'Components data must be an array.')
65
164
  })
66
165
  })