@usertour/helpers 0.0.59 → 0.0.61
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/dist/__tests__/convert-settings.test.cjs +1257 -0
- package/dist/__tests__/convert-settings.test.d.cts +2 -0
- package/dist/__tests__/convert-settings.test.d.ts +2 -0
- package/dist/__tests__/convert-settings.test.js +874 -0
- package/dist/chunk-XKSTKX45.js +336 -0
- package/dist/convert-settings.cjs +211 -116
- package/dist/convert-settings.js +2 -1
- package/dist/index.cjs +252 -167
- package/dist/index.js +6 -6
- package/package.json +2 -2
- package/dist/chunk-MA5IMKG6.js +0 -248
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
import {
|
|
2
|
+
convertSettings,
|
|
3
|
+
convertToCssVars,
|
|
4
|
+
mergeThemeDefaultSettings
|
|
5
|
+
} from "../chunk-XKSTKX45.js";
|
|
6
|
+
import "../chunk-5C3J4DM2.js";
|
|
7
|
+
import "../chunk-FZFHBCB6.js";
|
|
8
|
+
import "../chunk-GFH3VWOC.js";
|
|
9
|
+
import "../chunk-XEO3YXBM.js";
|
|
10
|
+
|
|
11
|
+
// src/__tests__/convert-settings.test.ts
|
|
12
|
+
import { defaultSettings } from "@usertour/types";
|
|
13
|
+
var originalDefaultMainColorHover = defaultSettings.mainColor.hover;
|
|
14
|
+
var originalDefaultBrandColorHover = defaultSettings.brandColor.hover;
|
|
15
|
+
describe("convert-settings", () => {
|
|
16
|
+
const completeSettings = {
|
|
17
|
+
mainColor: {
|
|
18
|
+
background: "#FFFFFF",
|
|
19
|
+
color: "#0f172a",
|
|
20
|
+
hover: "Auto",
|
|
21
|
+
active: "Auto",
|
|
22
|
+
autoHover: "#e7eefd",
|
|
23
|
+
autoActive: "#cedcfb"
|
|
24
|
+
},
|
|
25
|
+
brandColor: {
|
|
26
|
+
background: "#2563eb",
|
|
27
|
+
color: "#ffffff",
|
|
28
|
+
hover: "Auto",
|
|
29
|
+
active: "Auto",
|
|
30
|
+
autoHover: "#4b7eee",
|
|
31
|
+
autoActive: "#2055c9"
|
|
32
|
+
},
|
|
33
|
+
font: {
|
|
34
|
+
fontFamily: "System font",
|
|
35
|
+
fontSize: 16,
|
|
36
|
+
lineHeight: 24,
|
|
37
|
+
fontWeightNormal: 400,
|
|
38
|
+
fontWeightBold: 600,
|
|
39
|
+
h1FontSize: 24,
|
|
40
|
+
h2FontSize: 20,
|
|
41
|
+
linkColor: "Auto"
|
|
42
|
+
},
|
|
43
|
+
border: {
|
|
44
|
+
borderRadius: "10",
|
|
45
|
+
borderWidthEnabled: false,
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderColor: "Auto"
|
|
48
|
+
},
|
|
49
|
+
xbutton: {
|
|
50
|
+
color: "Auto"
|
|
51
|
+
},
|
|
52
|
+
progress: {
|
|
53
|
+
enabled: true,
|
|
54
|
+
color: "Auto",
|
|
55
|
+
height: 2,
|
|
56
|
+
type: "full-width",
|
|
57
|
+
position: "top",
|
|
58
|
+
narrowHeight: 5,
|
|
59
|
+
chainSquaredHeight: 4,
|
|
60
|
+
chainRoundedHeight: 6,
|
|
61
|
+
dotsHeight: 6,
|
|
62
|
+
numberedHeight: 12
|
|
63
|
+
},
|
|
64
|
+
survey: {
|
|
65
|
+
color: "Auto"
|
|
66
|
+
},
|
|
67
|
+
launcherBeacon: {
|
|
68
|
+
color: "Auto",
|
|
69
|
+
size: 16
|
|
70
|
+
},
|
|
71
|
+
launcherIcon: {
|
|
72
|
+
color: {
|
|
73
|
+
color: "Auto",
|
|
74
|
+
hover: "Auto",
|
|
75
|
+
active: "Auto",
|
|
76
|
+
background: "#1d4ed8"
|
|
77
|
+
},
|
|
78
|
+
opacity: 100,
|
|
79
|
+
size: 16
|
|
80
|
+
},
|
|
81
|
+
checklist: {
|
|
82
|
+
checkmarkColor: "#4ade80",
|
|
83
|
+
width: 360,
|
|
84
|
+
placement: {
|
|
85
|
+
position: "rightBottom",
|
|
86
|
+
positionOffsetX: 20,
|
|
87
|
+
positionOffsetY: 20
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
checklistLauncher: {
|
|
91
|
+
borderRadius: 30,
|
|
92
|
+
height: 60,
|
|
93
|
+
fontWeight: 600,
|
|
94
|
+
placement: {
|
|
95
|
+
position: "rightBottom",
|
|
96
|
+
positionOffsetX: 100,
|
|
97
|
+
positionOffsetY: 20
|
|
98
|
+
},
|
|
99
|
+
color: {
|
|
100
|
+
color: "Auto",
|
|
101
|
+
hover: "Auto",
|
|
102
|
+
active: "Auto",
|
|
103
|
+
background: "Auto"
|
|
104
|
+
},
|
|
105
|
+
counter: {
|
|
106
|
+
color: "Auto",
|
|
107
|
+
background: "Auto"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
buttons: {
|
|
111
|
+
height: 32,
|
|
112
|
+
minWidth: 0,
|
|
113
|
+
px: 16,
|
|
114
|
+
borderRadius: 8,
|
|
115
|
+
primary: {
|
|
116
|
+
fontWeight: 600,
|
|
117
|
+
textColor: {
|
|
118
|
+
color: "Auto",
|
|
119
|
+
hover: "Auto",
|
|
120
|
+
active: "Auto",
|
|
121
|
+
background: "#FFFFFF"
|
|
122
|
+
},
|
|
123
|
+
backgroundColor: {
|
|
124
|
+
color: "#FFFFFF",
|
|
125
|
+
hover: "Auto",
|
|
126
|
+
active: "Auto",
|
|
127
|
+
background: "Auto"
|
|
128
|
+
},
|
|
129
|
+
border: {
|
|
130
|
+
enabled: false,
|
|
131
|
+
borderWidth: 1,
|
|
132
|
+
color: {
|
|
133
|
+
color: "Auto",
|
|
134
|
+
hover: "Auto",
|
|
135
|
+
active: "Auto",
|
|
136
|
+
background: "#FFFFFF"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
secondary: {
|
|
141
|
+
fontWeight: 600,
|
|
142
|
+
textColor: {
|
|
143
|
+
color: "Auto",
|
|
144
|
+
hover: "Auto",
|
|
145
|
+
active: "Auto",
|
|
146
|
+
background: "#FFFFFF"
|
|
147
|
+
},
|
|
148
|
+
backgroundColor: {
|
|
149
|
+
color: "#FFFFFF",
|
|
150
|
+
hover: "Auto",
|
|
151
|
+
active: "Auto",
|
|
152
|
+
background: "Auto"
|
|
153
|
+
},
|
|
154
|
+
border: {
|
|
155
|
+
enabled: true,
|
|
156
|
+
borderWidth: 1,
|
|
157
|
+
color: {
|
|
158
|
+
color: "Auto",
|
|
159
|
+
hover: "Auto",
|
|
160
|
+
active: "Auto",
|
|
161
|
+
background: "#FFFFFF"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
launcherButtons: {
|
|
167
|
+
height: 32,
|
|
168
|
+
width: 0,
|
|
169
|
+
px: 16,
|
|
170
|
+
borderRadius: 8,
|
|
171
|
+
primary: {
|
|
172
|
+
fontWeight: 600,
|
|
173
|
+
textColor: {
|
|
174
|
+
color: "Auto",
|
|
175
|
+
hover: "Auto",
|
|
176
|
+
active: "Auto",
|
|
177
|
+
background: "#FFFFFF"
|
|
178
|
+
},
|
|
179
|
+
backgroundColor: {
|
|
180
|
+
color: "#FFFFFF",
|
|
181
|
+
hover: "Auto",
|
|
182
|
+
active: "Auto",
|
|
183
|
+
background: "Auto"
|
|
184
|
+
},
|
|
185
|
+
border: {
|
|
186
|
+
enabled: false,
|
|
187
|
+
borderWidth: 1,
|
|
188
|
+
color: {
|
|
189
|
+
color: "Auto",
|
|
190
|
+
hover: "Auto",
|
|
191
|
+
active: "Auto",
|
|
192
|
+
background: "#FFFFFF"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
tooltip: {
|
|
198
|
+
width: 300,
|
|
199
|
+
notchSize: 20
|
|
200
|
+
},
|
|
201
|
+
modal: {
|
|
202
|
+
width: 600,
|
|
203
|
+
padding: 40
|
|
204
|
+
},
|
|
205
|
+
backdrop: {
|
|
206
|
+
color: "#000000",
|
|
207
|
+
opacity: 40,
|
|
208
|
+
highlight: {
|
|
209
|
+
type: "outside",
|
|
210
|
+
radius: 4,
|
|
211
|
+
spread: 0,
|
|
212
|
+
color: "#ffffff",
|
|
213
|
+
opacity: 50
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
describe("mergeThemeDefaultSettings", () => {
|
|
218
|
+
it("should merge with defaultSettings for empty input", () => {
|
|
219
|
+
const result = mergeThemeDefaultSettings({});
|
|
220
|
+
expect(result.mainColor).toBeDefined();
|
|
221
|
+
expect(result.brandColor).toBeDefined();
|
|
222
|
+
expect(result.buttons).toBeDefined();
|
|
223
|
+
expect(result.font).toBeDefined();
|
|
224
|
+
});
|
|
225
|
+
it("should override defaultSettings with provided values", () => {
|
|
226
|
+
const customSettings = {
|
|
227
|
+
mainColor: {
|
|
228
|
+
background: "#000000",
|
|
229
|
+
color: "#ffffff",
|
|
230
|
+
hover: "#333333",
|
|
231
|
+
active: "#666666"
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const result = mergeThemeDefaultSettings(customSettings);
|
|
235
|
+
expect(result.mainColor.background).toBe("#000000");
|
|
236
|
+
expect(result.mainColor.color).toBe("#ffffff");
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
describe("convertSettings - Auto value resolution", () => {
|
|
240
|
+
describe("mainColor Auto values", () => {
|
|
241
|
+
it("should resolve mainColor.hover from autoHover when set to Auto", () => {
|
|
242
|
+
const result = convertSettings(completeSettings);
|
|
243
|
+
expect(result.mainColor.hover).toBe(completeSettings.mainColor.autoHover);
|
|
244
|
+
});
|
|
245
|
+
it("should resolve mainColor.active from autoActive when set to Auto", () => {
|
|
246
|
+
const result = convertSettings(completeSettings);
|
|
247
|
+
expect(result.mainColor.active).toBe(completeSettings.mainColor.autoActive);
|
|
248
|
+
});
|
|
249
|
+
it("should keep custom hover value when not Auto", () => {
|
|
250
|
+
const settings = {
|
|
251
|
+
...completeSettings,
|
|
252
|
+
mainColor: {
|
|
253
|
+
...completeSettings.mainColor,
|
|
254
|
+
hover: "#custom123"
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const result = convertSettings(settings);
|
|
258
|
+
expect(result.mainColor.hover).toBe("#custom123");
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
describe("brandColor Auto values", () => {
|
|
262
|
+
it("should resolve brandColor.hover from autoHover when set to Auto", () => {
|
|
263
|
+
const result = convertSettings(completeSettings);
|
|
264
|
+
expect(result.brandColor.hover).toBe(completeSettings.brandColor.autoHover);
|
|
265
|
+
});
|
|
266
|
+
it("should resolve brandColor.active from autoActive when set to Auto", () => {
|
|
267
|
+
const result = convertSettings(completeSettings);
|
|
268
|
+
expect(result.brandColor.active).toBe(completeSettings.brandColor.autoActive);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
describe("border Auto values", () => {
|
|
272
|
+
it("should resolve border.borderColor from mainColor.color when set to Auto", () => {
|
|
273
|
+
const result = convertSettings(completeSettings);
|
|
274
|
+
expect(result.border.borderColor).toBe(completeSettings.mainColor.color);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
describe("primary button Auto values", () => {
|
|
278
|
+
it("should resolve primary button textColor from brandColor.color when set to Auto", () => {
|
|
279
|
+
const result = convertSettings(completeSettings);
|
|
280
|
+
expect(result.buttons.primary.textColor.color).toBe(completeSettings.brandColor.color);
|
|
281
|
+
expect(result.buttons.primary.textColor.hover).toBe(completeSettings.brandColor.color);
|
|
282
|
+
expect(result.buttons.primary.textColor.active).toBe(completeSettings.brandColor.color);
|
|
283
|
+
});
|
|
284
|
+
it("should resolve primary button backgroundColor from brandColor when set to Auto", () => {
|
|
285
|
+
const result = convertSettings(completeSettings);
|
|
286
|
+
expect(result.buttons.primary.backgroundColor.background).toBe(
|
|
287
|
+
completeSettings.brandColor.background
|
|
288
|
+
);
|
|
289
|
+
expect(result.buttons.primary.backgroundColor.hover).toBe(
|
|
290
|
+
completeSettings.brandColor.autoHover
|
|
291
|
+
);
|
|
292
|
+
expect(result.buttons.primary.backgroundColor.active).toBe(
|
|
293
|
+
completeSettings.brandColor.autoActive
|
|
294
|
+
);
|
|
295
|
+
});
|
|
296
|
+
it("should resolve primary button border.color from brandColor when set to Auto", () => {
|
|
297
|
+
const result = convertSettings(completeSettings);
|
|
298
|
+
expect(result.buttons.primary.border.color.color).toBe(
|
|
299
|
+
completeSettings.brandColor.background
|
|
300
|
+
);
|
|
301
|
+
expect(result.buttons.primary.border.color.hover).toBe(
|
|
302
|
+
completeSettings.brandColor.autoHover
|
|
303
|
+
);
|
|
304
|
+
expect(result.buttons.primary.border.color.active).toBe(
|
|
305
|
+
completeSettings.brandColor.autoActive
|
|
306
|
+
);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
describe("secondary button Auto values", () => {
|
|
310
|
+
it("should resolve secondary button textColor from brandColor.background when set to Auto", () => {
|
|
311
|
+
const result = convertSettings(completeSettings);
|
|
312
|
+
expect(result.buttons.secondary.textColor.color).toBe(
|
|
313
|
+
completeSettings.brandColor.background
|
|
314
|
+
);
|
|
315
|
+
expect(result.buttons.secondary.textColor.hover).toBe(
|
|
316
|
+
completeSettings.brandColor.background
|
|
317
|
+
);
|
|
318
|
+
expect(result.buttons.secondary.textColor.active).toBe(
|
|
319
|
+
completeSettings.brandColor.background
|
|
320
|
+
);
|
|
321
|
+
});
|
|
322
|
+
it("should resolve secondary button backgroundColor from mainColor when set to Auto", () => {
|
|
323
|
+
const result = convertSettings(completeSettings);
|
|
324
|
+
expect(result.buttons.secondary.backgroundColor.background).toBe(
|
|
325
|
+
completeSettings.mainColor.background
|
|
326
|
+
);
|
|
327
|
+
expect(result.buttons.secondary.backgroundColor.hover).toBe(
|
|
328
|
+
completeSettings.mainColor.autoHover
|
|
329
|
+
);
|
|
330
|
+
expect(result.buttons.secondary.backgroundColor.active).toBe(
|
|
331
|
+
completeSettings.mainColor.autoActive
|
|
332
|
+
);
|
|
333
|
+
});
|
|
334
|
+
it("should resolve secondary button border.color from brandColor.background when set to Auto", () => {
|
|
335
|
+
const result = convertSettings(completeSettings);
|
|
336
|
+
expect(result.buttons.secondary.border.color.color).toBe(
|
|
337
|
+
completeSettings.brandColor.background
|
|
338
|
+
);
|
|
339
|
+
expect(result.buttons.secondary.border.color.hover).toBe(
|
|
340
|
+
completeSettings.brandColor.background
|
|
341
|
+
);
|
|
342
|
+
expect(result.buttons.secondary.border.color.active).toBe(
|
|
343
|
+
completeSettings.brandColor.background
|
|
344
|
+
);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
describe("font Auto values", () => {
|
|
348
|
+
it("should resolve font.linkColor from brandColor.background when set to Auto", () => {
|
|
349
|
+
const result = convertSettings(completeSettings);
|
|
350
|
+
expect(result.font.linkColor).toBe(completeSettings.brandColor.background);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
describe("xbutton Auto values", () => {
|
|
354
|
+
it("should resolve xbutton.color from mainColor.color when set to Auto", () => {
|
|
355
|
+
const result = convertSettings(completeSettings);
|
|
356
|
+
expect(result.xbutton.color).toBe(completeSettings.mainColor.color);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
describe("progress Auto values", () => {
|
|
360
|
+
it("should resolve progress.color from brandColor.background when set to Auto", () => {
|
|
361
|
+
const result = convertSettings(completeSettings);
|
|
362
|
+
expect(result.progress.color).toBe(completeSettings.brandColor.background);
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
describe("launcherBeacon Auto values", () => {
|
|
366
|
+
it("should resolve launcherBeacon.color from brandColor.background when set to Auto", () => {
|
|
367
|
+
const settings = {
|
|
368
|
+
...completeSettings,
|
|
369
|
+
launcherBeacon: {
|
|
370
|
+
...completeSettings.launcherBeacon,
|
|
371
|
+
color: "Auto"
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
const result = convertSettings(settings);
|
|
375
|
+
expect(result.launcherBeacon.color).toBe(completeSettings.brandColor.background);
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
describe("launcherIcon Auto values", () => {
|
|
379
|
+
it("should resolve launcherIcon.color values from brandColor when set to Auto", () => {
|
|
380
|
+
const result = convertSettings(completeSettings);
|
|
381
|
+
expect(result.launcherIcon.color.color).toBe(completeSettings.brandColor.background);
|
|
382
|
+
expect(result.launcherIcon.color.hover).toBe(completeSettings.brandColor.autoHover);
|
|
383
|
+
expect(result.launcherIcon.color.active).toBe(completeSettings.brandColor.autoActive);
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
describe("checklistLauncher Auto values", () => {
|
|
387
|
+
it("should resolve checklistLauncher.color values from brandColor when set to Auto", () => {
|
|
388
|
+
const result = convertSettings(completeSettings);
|
|
389
|
+
expect(result.checklistLauncher.color.color).toBe(completeSettings.brandColor.color);
|
|
390
|
+
expect(result.checklistLauncher.color.background).toBe(
|
|
391
|
+
completeSettings.brandColor.background
|
|
392
|
+
);
|
|
393
|
+
expect(result.checklistLauncher.color.hover).toBe(completeSettings.brandColor.autoHover);
|
|
394
|
+
expect(result.checklistLauncher.color.active).toBe(completeSettings.brandColor.autoActive);
|
|
395
|
+
});
|
|
396
|
+
it("should resolve checklistLauncher.counter values from brandColor when set to Auto", () => {
|
|
397
|
+
const result = convertSettings(completeSettings);
|
|
398
|
+
expect(result.checklistLauncher.counter.color).toBe(completeSettings.brandColor.background);
|
|
399
|
+
expect(result.checklistLauncher.counter.background).toBe(completeSettings.brandColor.color);
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
describe("survey Auto values", () => {
|
|
403
|
+
it("should resolve survey.color from brandColor.background when set to Auto", () => {
|
|
404
|
+
const result = convertSettings(completeSettings);
|
|
405
|
+
expect(result.survey.color).toBe(completeSettings.brandColor.background);
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
describe("launcherButtons Auto values", () => {
|
|
409
|
+
it("should resolve launcherButtons primary textColor from brandColor.color when set to Auto", () => {
|
|
410
|
+
const result = convertSettings(completeSettings);
|
|
411
|
+
expect(result.launcherButtons.primary.textColor.color).toBe(
|
|
412
|
+
completeSettings.brandColor.color
|
|
413
|
+
);
|
|
414
|
+
expect(result.launcherButtons.primary.textColor.hover).toBe(
|
|
415
|
+
completeSettings.brandColor.color
|
|
416
|
+
);
|
|
417
|
+
expect(result.launcherButtons.primary.textColor.active).toBe(
|
|
418
|
+
completeSettings.brandColor.color
|
|
419
|
+
);
|
|
420
|
+
});
|
|
421
|
+
it("should resolve launcherButtons primary backgroundColor from brandColor when set to Auto", () => {
|
|
422
|
+
const result = convertSettings(completeSettings);
|
|
423
|
+
expect(result.launcherButtons.primary.backgroundColor.background).toBe(
|
|
424
|
+
completeSettings.brandColor.background
|
|
425
|
+
);
|
|
426
|
+
expect(result.launcherButtons.primary.backgroundColor.hover).toBe(
|
|
427
|
+
completeSettings.brandColor.autoHover
|
|
428
|
+
);
|
|
429
|
+
expect(result.launcherButtons.primary.backgroundColor.active).toBe(
|
|
430
|
+
completeSettings.brandColor.autoActive
|
|
431
|
+
);
|
|
432
|
+
});
|
|
433
|
+
it("should resolve launcherButtons primary border.color from brandColor when set to Auto", () => {
|
|
434
|
+
const result = convertSettings(completeSettings);
|
|
435
|
+
expect(result.launcherButtons.primary.border.color.color).toBe(
|
|
436
|
+
completeSettings.brandColor.background
|
|
437
|
+
);
|
|
438
|
+
expect(result.launcherButtons.primary.border.color.hover).toBe(
|
|
439
|
+
completeSettings.brandColor.autoHover
|
|
440
|
+
);
|
|
441
|
+
expect(result.launcherButtons.primary.border.color.active).toBe(
|
|
442
|
+
completeSettings.brandColor.autoActive
|
|
443
|
+
);
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
describe("font family handling", () => {
|
|
447
|
+
it("should convert System font to full font family string", () => {
|
|
448
|
+
const result = convertSettings(completeSettings);
|
|
449
|
+
expect(result.font.fontFamily).toContain("apple-system");
|
|
450
|
+
expect(result.font.fontFamily).toContain("Segoe UI");
|
|
451
|
+
});
|
|
452
|
+
it("should append sans-serif to custom font family", () => {
|
|
453
|
+
const settings = {
|
|
454
|
+
...completeSettings,
|
|
455
|
+
font: {
|
|
456
|
+
...completeSettings.font,
|
|
457
|
+
fontFamily: "CustomFont"
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
const result = convertSettings(settings);
|
|
461
|
+
expect(result.font.fontFamily).toContain("CustomFont");
|
|
462
|
+
expect(result.font.fontFamily).toContain("sans-serif");
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
describe("convertSettings - Missing data fallback (defaultSettings layer)", () => {
|
|
467
|
+
it("should handle empty settings object with defaultSettings fallback", () => {
|
|
468
|
+
const result = convertSettings({});
|
|
469
|
+
expect(result.mainColor).toBeDefined();
|
|
470
|
+
expect(result.brandColor).toBeDefined();
|
|
471
|
+
expect(result.buttons).toBeDefined();
|
|
472
|
+
expect(result.font).toBeDefined();
|
|
473
|
+
expect(result.border).toBeDefined();
|
|
474
|
+
});
|
|
475
|
+
it("should handle missing mainColor with defaultSettings fallback", () => {
|
|
476
|
+
const settings = { brandColor: completeSettings.brandColor };
|
|
477
|
+
const result = convertSettings(settings);
|
|
478
|
+
expect(result.mainColor.background).toBe(defaultSettings.mainColor.background);
|
|
479
|
+
});
|
|
480
|
+
it("should handle missing buttons with defaultSettings fallback", () => {
|
|
481
|
+
const settings = {
|
|
482
|
+
mainColor: completeSettings.mainColor,
|
|
483
|
+
brandColor: completeSettings.brandColor
|
|
484
|
+
};
|
|
485
|
+
const result = convertSettings(settings);
|
|
486
|
+
expect(result.buttons.height).toBe(defaultSettings.buttons.height);
|
|
487
|
+
expect(result.buttons.primary).toBeDefined();
|
|
488
|
+
expect(result.buttons.secondary).toBeDefined();
|
|
489
|
+
});
|
|
490
|
+
it("should handle missing nested properties with defaultSettings fallback", () => {
|
|
491
|
+
const settings = {
|
|
492
|
+
buttons: {
|
|
493
|
+
height: 40
|
|
494
|
+
// missing primary and secondary
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
const result = convertSettings(settings);
|
|
498
|
+
expect(result.buttons.height).toBe(40);
|
|
499
|
+
expect(result.buttons.primary).toBeDefined();
|
|
500
|
+
expect(result.buttons.secondary).toBeDefined();
|
|
501
|
+
});
|
|
502
|
+
it("should handle missing progress with defaultSettings fallback", () => {
|
|
503
|
+
const settings = {
|
|
504
|
+
mainColor: completeSettings.mainColor,
|
|
505
|
+
brandColor: completeSettings.brandColor
|
|
506
|
+
};
|
|
507
|
+
const result = convertSettings(settings);
|
|
508
|
+
expect(result.progress).toBeDefined();
|
|
509
|
+
expect(result.progress.height).toBe(defaultSettings.progress.height);
|
|
510
|
+
});
|
|
511
|
+
it("should handle missing checklistLauncher with defaultSettings fallback", () => {
|
|
512
|
+
const settings = {
|
|
513
|
+
mainColor: completeSettings.mainColor,
|
|
514
|
+
brandColor: completeSettings.brandColor
|
|
515
|
+
};
|
|
516
|
+
const result = convertSettings(settings);
|
|
517
|
+
expect(result.checklistLauncher).toBeDefined();
|
|
518
|
+
expect(result.checklistLauncher.borderRadius).toBe(
|
|
519
|
+
defaultSettings.checklistLauncher.borderRadius
|
|
520
|
+
);
|
|
521
|
+
});
|
|
522
|
+
it("should handle missing launcherIcon with defaultSettings fallback", () => {
|
|
523
|
+
const settings = {
|
|
524
|
+
mainColor: completeSettings.mainColor,
|
|
525
|
+
brandColor: completeSettings.brandColor
|
|
526
|
+
};
|
|
527
|
+
const result = convertSettings(settings);
|
|
528
|
+
expect(result.launcherIcon).toBeDefined();
|
|
529
|
+
expect(result.launcherIcon.size).toBe(defaultSettings.launcherIcon.size);
|
|
530
|
+
});
|
|
531
|
+
it("should handle missing launcherButtons with defaultSettings fallback", () => {
|
|
532
|
+
const settings = {
|
|
533
|
+
mainColor: completeSettings.mainColor,
|
|
534
|
+
brandColor: completeSettings.brandColor
|
|
535
|
+
};
|
|
536
|
+
const result = convertSettings(settings);
|
|
537
|
+
expect(result.launcherButtons).toBeDefined();
|
|
538
|
+
expect(result.launcherButtons.height).toBe(defaultSettings.launcherButtons.height);
|
|
539
|
+
expect(result.launcherButtons.width).toBe(defaultSettings.launcherButtons.width);
|
|
540
|
+
expect(result.launcherButtons.px).toBe(defaultSettings.launcherButtons.px);
|
|
541
|
+
expect(result.launcherButtons.borderRadius).toBe(
|
|
542
|
+
defaultSettings.launcherButtons.borderRadius
|
|
543
|
+
);
|
|
544
|
+
expect(result.launcherButtons.primary).toBeDefined();
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
describe("convertSettings - Combined fallback (missing data + Auto resolution)", () => {
|
|
548
|
+
it("should apply both defaultSettings fallback and Auto resolution for empty input", () => {
|
|
549
|
+
const result = convertSettings({});
|
|
550
|
+
expect(result.mainColor.background).toBe(defaultSettings.mainColor.background);
|
|
551
|
+
expect(result.mainColor.hover).toBe(defaultSettings.mainColor.autoHover);
|
|
552
|
+
expect(result.mainColor.active).toBe(defaultSettings.mainColor.autoActive);
|
|
553
|
+
expect(result.brandColor.hover).toBe(defaultSettings.brandColor.autoHover);
|
|
554
|
+
expect(result.brandColor.active).toBe(defaultSettings.brandColor.autoActive);
|
|
555
|
+
});
|
|
556
|
+
it("should resolve Auto values using defaultSettings when source settings are missing", () => {
|
|
557
|
+
const result = convertSettings({});
|
|
558
|
+
expect(result.border.borderColor).toBe(defaultSettings.mainColor.color);
|
|
559
|
+
expect(result.xbutton.color).toBe(defaultSettings.mainColor.color);
|
|
560
|
+
expect(result.font.linkColor).toBe(defaultSettings.brandColor.background);
|
|
561
|
+
expect(result.progress.color).toBe(defaultSettings.brandColor.background);
|
|
562
|
+
});
|
|
563
|
+
it("should resolve button Auto values using defaultSettings when settings are missing", () => {
|
|
564
|
+
const result = convertSettings({});
|
|
565
|
+
expect(result.buttons.primary.textColor.color).toBe(defaultSettings.brandColor.color);
|
|
566
|
+
expect(result.buttons.primary.backgroundColor.background).toBe(
|
|
567
|
+
defaultSettings.brandColor.background
|
|
568
|
+
);
|
|
569
|
+
expect(result.buttons.primary.backgroundColor.hover).toBe(
|
|
570
|
+
defaultSettings.brandColor.autoHover
|
|
571
|
+
);
|
|
572
|
+
expect(result.buttons.secondary.textColor.color).toBe(defaultSettings.brandColor.background);
|
|
573
|
+
expect(result.buttons.secondary.backgroundColor.background).toBe(
|
|
574
|
+
defaultSettings.mainColor.background
|
|
575
|
+
);
|
|
576
|
+
expect(result.launcherButtons.primary.textColor.color).toBe(defaultSettings.brandColor.color);
|
|
577
|
+
expect(result.launcherButtons.primary.backgroundColor.background).toBe(
|
|
578
|
+
defaultSettings.brandColor.background
|
|
579
|
+
);
|
|
580
|
+
expect(result.launcherButtons.primary.backgroundColor.hover).toBe(
|
|
581
|
+
defaultSettings.brandColor.autoHover
|
|
582
|
+
);
|
|
583
|
+
});
|
|
584
|
+
it("should handle partial settings with correct fallback chain", () => {
|
|
585
|
+
const partialSettings = {
|
|
586
|
+
mainColor: {
|
|
587
|
+
background: "#FF0000",
|
|
588
|
+
color: "#00FF00",
|
|
589
|
+
hover: "Auto",
|
|
590
|
+
active: "Auto",
|
|
591
|
+
autoHover: "#FF5555",
|
|
592
|
+
autoActive: "#FF9999"
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
const result = convertSettings(partialSettings);
|
|
596
|
+
expect(result.mainColor.background).toBe("#FF0000");
|
|
597
|
+
expect(result.mainColor.hover).toBe("#FF5555");
|
|
598
|
+
expect(result.mainColor.active).toBe("#FF9999");
|
|
599
|
+
expect(result.brandColor.background).toBe(defaultSettings.brandColor.background);
|
|
600
|
+
expect(result.border.borderColor).not.toBe("Auto");
|
|
601
|
+
expect(result.border.borderColor).toMatch(/^#[0-9a-fA-F]{6}$/);
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
describe("convertToCssVars", () => {
|
|
605
|
+
it("should generate CSS variables string for complete settings", () => {
|
|
606
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
607
|
+
const css = convertToCssVars(convertedSettings);
|
|
608
|
+
expect(css).toContain("--usertour-background:");
|
|
609
|
+
expect(css).toContain("--usertour-foreground:");
|
|
610
|
+
expect(css).toContain("--usertour-primary:");
|
|
611
|
+
expect(css).toContain("--usertour-secondary:");
|
|
612
|
+
expect(css).toContain("--usertour-font-family:");
|
|
613
|
+
});
|
|
614
|
+
it("should include button CSS variables", () => {
|
|
615
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
616
|
+
const css = convertToCssVars(convertedSettings);
|
|
617
|
+
expect(css).toContain("--usertour-primary-hover:");
|
|
618
|
+
expect(css).toContain("--usertour-primary-active:");
|
|
619
|
+
expect(css).toContain("--usertour-primary-foreground:");
|
|
620
|
+
expect(css).toContain("--usertour-secondary-hover:");
|
|
621
|
+
expect(css).toContain("--usertour-secondary-active:");
|
|
622
|
+
expect(css).toContain("--usertour-secondary-foreground:");
|
|
623
|
+
});
|
|
624
|
+
it("should include backdrop CSS variables", () => {
|
|
625
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
626
|
+
const css = convertToCssVars(convertedSettings);
|
|
627
|
+
expect(css).toContain("--usertour-backdrop-color-rgb:");
|
|
628
|
+
expect(css).toContain("--usertour-backdrop-opacity:");
|
|
629
|
+
expect(css).toContain("--usertour-backdrop-highlight-opacity:");
|
|
630
|
+
});
|
|
631
|
+
it("should include progress bar CSS variables", () => {
|
|
632
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
633
|
+
const css = convertToCssVars(convertedSettings);
|
|
634
|
+
expect(css).toContain("--usertour-progress-bar-color:");
|
|
635
|
+
expect(css).toContain("--usertour-progress-bar-height:");
|
|
636
|
+
});
|
|
637
|
+
it("should include checklist launcher CSS variables", () => {
|
|
638
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
639
|
+
const css = convertToCssVars(convertedSettings);
|
|
640
|
+
expect(css).toContain("--usertour-checklist-trigger-background-color:");
|
|
641
|
+
expect(css).toContain("--usertour-checklist-trigger-font-color:");
|
|
642
|
+
expect(css).toContain("--usertour-checklist-trigger-counter-background-color:");
|
|
643
|
+
});
|
|
644
|
+
it("should include launcher icon CSS variables", () => {
|
|
645
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
646
|
+
const css = convertToCssVars(convertedSettings);
|
|
647
|
+
expect(css).toContain("--usertour-widget-launcher-icon-color:");
|
|
648
|
+
expect(css).toContain("--usertour-widget-launcher-icon-hover-color:");
|
|
649
|
+
expect(css).toContain("--usertour-widget-beacon-color:");
|
|
650
|
+
});
|
|
651
|
+
it("should include launcher button CSS variables", () => {
|
|
652
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
653
|
+
const css = convertToCssVars(convertedSettings);
|
|
654
|
+
expect(css).toContain("--usertour-launcher-button-height:");
|
|
655
|
+
expect(css).toContain("--usertour-launcher-button-width:");
|
|
656
|
+
expect(css).toContain("--usertour-launcher-button-horizontal-padding:");
|
|
657
|
+
expect(css).toContain("--usertour-launcher-button-border-radius:");
|
|
658
|
+
expect(css).toContain("--usertour-launcher-button-background-color:");
|
|
659
|
+
expect(css).toContain("--usertour-launcher-button-hover-background-color:");
|
|
660
|
+
expect(css).toContain("--usertour-launcher-button-active-background-color:");
|
|
661
|
+
expect(css).toContain("--usertour-launcher-button-font-color:");
|
|
662
|
+
expect(css).toContain("--usertour-launcher-button-hover-font-color:");
|
|
663
|
+
expect(css).toContain("--usertour-launcher-button-active-font-color:");
|
|
664
|
+
expect(css).toContain("--usertour-launcher-button-font-weight:");
|
|
665
|
+
expect(css).toContain("--usertour-launcher-button-border-width:");
|
|
666
|
+
expect(css).toContain("--usertour-launcher-button-border-color:");
|
|
667
|
+
expect(css).toContain("--usertour-launcher-button-hover-border-color:");
|
|
668
|
+
expect(css).toContain("--usertour-launcher-button-active-border-color:");
|
|
669
|
+
});
|
|
670
|
+
it("should set launcher button width to auto when width is 0", () => {
|
|
671
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
672
|
+
const css = convertToCssVars(convertedSettings);
|
|
673
|
+
expect(css).toContain("--usertour-launcher-button-width:auto");
|
|
674
|
+
});
|
|
675
|
+
it("should set launcher button border width to 0px when border is disabled", () => {
|
|
676
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
677
|
+
const css = convertToCssVars(convertedSettings);
|
|
678
|
+
expect(css).toContain("--usertour-launcher-button-border-width:0px");
|
|
679
|
+
});
|
|
680
|
+
it("should add modal padding for modal type", () => {
|
|
681
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
682
|
+
const css = convertToCssVars(convertedSettings, "modal");
|
|
683
|
+
expect(css).toContain("--usertour-widget-popper-padding:");
|
|
684
|
+
expect(css).toContain("40px");
|
|
685
|
+
});
|
|
686
|
+
it("should not add modal padding for tooltip type", () => {
|
|
687
|
+
const convertedSettings = convertSettings(completeSettings);
|
|
688
|
+
const css = convertToCssVars(convertedSettings, "tooltip");
|
|
689
|
+
const modalPaddingMatch = css.match(/--usertour-widget-popper-padding:[^;]+;/);
|
|
690
|
+
expect(modalPaddingMatch).toBeNull();
|
|
691
|
+
});
|
|
692
|
+
it("should add backdrop inset for inside highlight type", () => {
|
|
693
|
+
const settings = {
|
|
694
|
+
...completeSettings,
|
|
695
|
+
backdrop: {
|
|
696
|
+
...completeSettings.backdrop,
|
|
697
|
+
highlight: {
|
|
698
|
+
...completeSettings.backdrop.highlight,
|
|
699
|
+
type: "inside"
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
const convertedSettings = convertSettings(settings);
|
|
704
|
+
const css = convertToCssVars(convertedSettings);
|
|
705
|
+
expect(css).toContain("--usertour-backdrop-highlight-inset:inset");
|
|
706
|
+
});
|
|
707
|
+
it("should work correctly with defaultSettings fallback for empty input", () => {
|
|
708
|
+
const convertedSettings = convertSettings({});
|
|
709
|
+
const css = convertToCssVars(convertedSettings);
|
|
710
|
+
expect(css).toContain("--usertour-background:");
|
|
711
|
+
expect(css).toContain("--usertour-primary:");
|
|
712
|
+
expect(css.length).toBeGreaterThan(0);
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
describe("Edge cases and error handling", () => {
|
|
716
|
+
it("should handle undefined values in nested objects gracefully", () => {
|
|
717
|
+
const settings = {
|
|
718
|
+
mainColor: {
|
|
719
|
+
background: "#FFFFFF",
|
|
720
|
+
color: "#000000"
|
|
721
|
+
// hover, active, autoHover, autoActive are undefined
|
|
722
|
+
},
|
|
723
|
+
brandColor: {
|
|
724
|
+
background: "#2563eb",
|
|
725
|
+
color: "#ffffff"
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
expect(() => convertSettings(settings)).not.toThrow();
|
|
729
|
+
const result = convertSettings(settings);
|
|
730
|
+
expect(result.mainColor).toBeDefined();
|
|
731
|
+
});
|
|
732
|
+
it("should handle partial settings without throwing", () => {
|
|
733
|
+
const settings = {
|
|
734
|
+
mainColor: completeSettings.mainColor,
|
|
735
|
+
brandColor: completeSettings.brandColor
|
|
736
|
+
// progress is missing, not null
|
|
737
|
+
};
|
|
738
|
+
expect(() => convertSettings(settings)).not.toThrow();
|
|
739
|
+
const result = convertSettings(settings);
|
|
740
|
+
expect(result.progress).toBeDefined();
|
|
741
|
+
expect(result.progress.color).toBe(completeSettings.brandColor.background);
|
|
742
|
+
});
|
|
743
|
+
it("should preserve non-Auto values throughout the conversion", () => {
|
|
744
|
+
const settings = {
|
|
745
|
+
...completeSettings,
|
|
746
|
+
mainColor: {
|
|
747
|
+
...completeSettings.mainColor,
|
|
748
|
+
hover: "#custom-hover",
|
|
749
|
+
active: "#custom-active"
|
|
750
|
+
},
|
|
751
|
+
buttons: {
|
|
752
|
+
...completeSettings.buttons,
|
|
753
|
+
primary: {
|
|
754
|
+
...completeSettings.buttons.primary,
|
|
755
|
+
textColor: {
|
|
756
|
+
...completeSettings.buttons.primary.textColor,
|
|
757
|
+
color: "#custom-text"
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
const result = convertSettings(settings);
|
|
763
|
+
expect(result.mainColor.hover).toBe("#custom-hover");
|
|
764
|
+
expect(result.mainColor.active).toBe("#custom-active");
|
|
765
|
+
expect(result.buttons.primary.textColor.color).toBe("#custom-text");
|
|
766
|
+
});
|
|
767
|
+
it("should handle deeply nested missing properties", () => {
|
|
768
|
+
const settings = {
|
|
769
|
+
brandColor: completeSettings.brandColor,
|
|
770
|
+
buttons: {
|
|
771
|
+
primary: {
|
|
772
|
+
textColor: {
|
|
773
|
+
// only color is provided as non-Auto value
|
|
774
|
+
color: "#FF0000",
|
|
775
|
+
hover: "Auto",
|
|
776
|
+
active: "Auto",
|
|
777
|
+
background: "#FFFFFF"
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
const result = convertSettings(settings);
|
|
783
|
+
expect(result.buttons.primary.textColor.color).toBe("#FF0000");
|
|
784
|
+
expect(result.buttons.primary.textColor.hover).toBe(completeSettings.brandColor.color);
|
|
785
|
+
expect(result.buttons.primary.backgroundColor).toBeDefined();
|
|
786
|
+
});
|
|
787
|
+
it("should fallback to defaultSettings when values are explicitly null", () => {
|
|
788
|
+
const settings = {
|
|
789
|
+
mainColor: {
|
|
790
|
+
background: null,
|
|
791
|
+
color: "#00FF00",
|
|
792
|
+
hover: "Auto",
|
|
793
|
+
active: "Auto",
|
|
794
|
+
autoHover: null,
|
|
795
|
+
autoActive: "#FF9999"
|
|
796
|
+
},
|
|
797
|
+
font: {
|
|
798
|
+
fontSize: null,
|
|
799
|
+
linkColor: "Auto"
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
const result = convertSettings(settings);
|
|
803
|
+
expect(result.mainColor.background).toBe(defaultSettings.mainColor.background);
|
|
804
|
+
expect(result.mainColor.autoHover).toBe(defaultSettings.mainColor.autoHover);
|
|
805
|
+
expect(result.font.fontSize).toBe(defaultSettings.font.fontSize);
|
|
806
|
+
expect(result.mainColor.color).toBe("#00FF00");
|
|
807
|
+
expect(result.mainColor.autoActive).toBe("#FF9999");
|
|
808
|
+
});
|
|
809
|
+
it("should fallback to defaultSettings when values are explicitly undefined", () => {
|
|
810
|
+
const settings = {
|
|
811
|
+
mainColor: {
|
|
812
|
+
background: void 0,
|
|
813
|
+
color: "#00FF00",
|
|
814
|
+
hover: "Auto",
|
|
815
|
+
active: "Auto"
|
|
816
|
+
},
|
|
817
|
+
buttons: {
|
|
818
|
+
height: void 0,
|
|
819
|
+
borderRadius: 16
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
const result = convertSettings(settings);
|
|
823
|
+
expect(result.mainColor.background).toBe(defaultSettings.mainColor.background);
|
|
824
|
+
expect(result.buttons.height).toBe(defaultSettings.buttons.height);
|
|
825
|
+
expect(result.mainColor.color).toBe("#00FF00");
|
|
826
|
+
expect(result.buttons.borderRadius).toBe(16);
|
|
827
|
+
});
|
|
828
|
+
it("should handle mixed null, undefined, and valid values correctly", () => {
|
|
829
|
+
const settings = {
|
|
830
|
+
mainColor: {
|
|
831
|
+
background: null,
|
|
832
|
+
color: void 0,
|
|
833
|
+
hover: "Auto",
|
|
834
|
+
active: "#custom-active",
|
|
835
|
+
autoHover: "#custom-auto-hover",
|
|
836
|
+
autoActive: null
|
|
837
|
+
},
|
|
838
|
+
progress: {
|
|
839
|
+
enabled: true,
|
|
840
|
+
color: null,
|
|
841
|
+
height: void 0
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
const result = convertSettings(settings);
|
|
845
|
+
expect(result.mainColor.background).toBe(defaultSettings.mainColor.background);
|
|
846
|
+
expect(result.mainColor.color).toBe(defaultSettings.mainColor.color);
|
|
847
|
+
expect(result.mainColor.autoActive).toBe(defaultSettings.mainColor.autoActive);
|
|
848
|
+
expect(result.progress.height).toBe(defaultSettings.progress.height);
|
|
849
|
+
expect(result.mainColor.active).toBe("#custom-active");
|
|
850
|
+
expect(result.mainColor.autoHover).toBe("#custom-auto-hover");
|
|
851
|
+
expect(result.progress.enabled).toBe(true);
|
|
852
|
+
expect(result.mainColor.hover).toBe("#custom-auto-hover");
|
|
853
|
+
expect(result.progress.color).toBe(defaultSettings.brandColor.background);
|
|
854
|
+
});
|
|
855
|
+
it("should NOT mutate defaultSettings when converting settings", () => {
|
|
856
|
+
convertSettings({});
|
|
857
|
+
convertSettings({});
|
|
858
|
+
convertSettings({});
|
|
859
|
+
expect(defaultSettings.mainColor.hover).toBe(originalDefaultMainColorHover);
|
|
860
|
+
expect(defaultSettings.brandColor.hover).toBe(originalDefaultBrandColorHover);
|
|
861
|
+
expect(defaultSettings.mainColor.hover).toBe("Auto");
|
|
862
|
+
expect(defaultSettings.brandColor.hover).toBe("Auto");
|
|
863
|
+
});
|
|
864
|
+
it("should return independent objects on each call", () => {
|
|
865
|
+
const result1 = convertSettings({});
|
|
866
|
+
const result2 = convertSettings({});
|
|
867
|
+
expect(result1).not.toBe(result2);
|
|
868
|
+
expect(result1.mainColor).not.toBe(result2.mainColor);
|
|
869
|
+
expect(result1.brandColor).not.toBe(result2.brandColor);
|
|
870
|
+
result1.mainColor.color = "#MODIFIED";
|
|
871
|
+
expect(result2.mainColor.color).not.toBe("#MODIFIED");
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
});
|