@weni/unnnic-system 3.28.2-alpha.2 → 3.29.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.
- package/dist/index.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +3005 -3001
- package/dist/unnnic.umd.js +22 -22
- package/package.json +2 -2
- package/src/components/Button/__tests__/Button.spec.js +81 -0
- package/src/components/Button/__tests__/ButtonIcon.spec.js +56 -0
- package/src/components/Carousel/TagCarousel.vue +8 -2
- package/src/components/Carousel/__tests__/TagCarousel.spec.js +258 -0
- package/src/components/ChartLine/__tests__/ChartLine.spec.js +170 -0
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +14 -0
- package/src/components/CheckboxGroup/__tests__/CheckboxGroup.spec.js +62 -0
- package/src/components/DatePicker/DatePicker.vue +1 -0
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +364 -0
- package/src/components/Disclaimer/__tests__/Disclaimer.spec.js +16 -0
- package/src/components/DropArea/DropArea.vue +1 -2
- package/src/components/DropArea/__tests__/DropArea.spec.js +333 -0
- package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +109 -2
- package/src/components/MultiSelect/index.vue +1 -1
- package/src/components/PageHeader/__tests__/PageHeader.spec.js +97 -0
- package/src/components/Pagination/__tests__/Pagination.spec.js +99 -0
- package/src/components/Radio/__test__/Radio.spec.js +67 -0
- package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +100 -0
- package/src/components/Slider/__tests__/Slider.spec.js +321 -0
- package/src/components/Tag/DefaultTag.vue +4 -3
- package/src/components/Tag/__tests__/DefaultTag.spec.js +51 -0
- package/src/components/Tag/__tests__/Tag.spec.js +82 -0
- package/src/components/TextArea/__test__/TextArea.spec.js +19 -0
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +82 -1
|
@@ -9,7 +9,7 @@ globalThis.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
|
9
9
|
disconnect: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
const createWrapper = (props = {}, slots = {}) => {
|
|
12
|
+
const createWrapper = (props = {}, slots = {}, options = {}) => {
|
|
13
13
|
return mount(ToolTip, {
|
|
14
14
|
props,
|
|
15
15
|
slots: {
|
|
@@ -20,11 +20,41 @@ const createWrapper = (props = {}, slots = {}) => {
|
|
|
20
20
|
global: {
|
|
21
21
|
stubs: {
|
|
22
22
|
teleport: true,
|
|
23
|
+
...options.stubs,
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
const createOpenWrapper = (props = {}, slots = {}) =>
|
|
30
|
+
mount(ToolTip, {
|
|
31
|
+
props: {
|
|
32
|
+
forceOpen: true,
|
|
33
|
+
enabled: true,
|
|
34
|
+
...props,
|
|
35
|
+
},
|
|
36
|
+
slots: {
|
|
37
|
+
default: '<button data-testid="trigger-button">Hover me</button>',
|
|
38
|
+
...slots,
|
|
39
|
+
},
|
|
40
|
+
attachTo: document.body,
|
|
41
|
+
global: {
|
|
42
|
+
stubs: {
|
|
43
|
+
Tooltip: {
|
|
44
|
+
template: '<div data-testid="tooltip-wrapper"><slot /></div>',
|
|
45
|
+
},
|
|
46
|
+
TooltipTrigger: {
|
|
47
|
+
template: '<div data-testid="tooltip-trigger"><slot /></div>',
|
|
48
|
+
},
|
|
49
|
+
TooltipContent: {
|
|
50
|
+
props: ['side', 'style', 'class'],
|
|
51
|
+
template:
|
|
52
|
+
'<div data-testid="tooltip-content" :style="style"><slot /></div>',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
28
58
|
describe('ToolTip', () => {
|
|
29
59
|
let wrapper;
|
|
30
60
|
|
|
@@ -367,4 +397,55 @@ describe('ToolTip', () => {
|
|
|
367
397
|
forceOpenWrapper.unmount();
|
|
368
398
|
});
|
|
369
399
|
});
|
|
400
|
+
|
|
401
|
+
describe('Close button', () => {
|
|
402
|
+
it('emits click:close when close icon is clicked', async () => {
|
|
403
|
+
const closeWrapper = createOpenWrapper({
|
|
404
|
+
text: 'Text',
|
|
405
|
+
showClose: true,
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
await closeWrapper.find('.unnnic-tooltip__close').trigger('click');
|
|
409
|
+
|
|
410
|
+
expect(closeWrapper.emitted('click:close')).toBeTruthy();
|
|
411
|
+
closeWrapper.unmount();
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
describe('Content rendering with forceOpen', () => {
|
|
416
|
+
it('renders multiline text content', async () => {
|
|
417
|
+
const multilineWrapper = createOpenWrapper({
|
|
418
|
+
text: 'Line one\nLine two',
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
const content = multilineWrapper.find('[data-testid="tooltip-content"]');
|
|
422
|
+
expect(content.text()).toContain('Line one');
|
|
423
|
+
expect(content.text()).toContain('Line two');
|
|
424
|
+
multilineWrapper.unmount();
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('renders HTML content when enableHtml is true', async () => {
|
|
428
|
+
const htmlWrapper = createOpenWrapper({
|
|
429
|
+
text: '<strong>Bold</strong>',
|
|
430
|
+
enableHtml: true,
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
expect(
|
|
434
|
+
htmlWrapper.find('[data-testid="tooltip-html-content"]').exists(),
|
|
435
|
+
).toBe(true);
|
|
436
|
+
htmlWrapper.unmount();
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('applies default maxWidth of 320px when not provided', async () => {
|
|
440
|
+
const defaultWidthWrapper = createOpenWrapper({
|
|
441
|
+
text: 'Text',
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
const content = defaultWidthWrapper.find(
|
|
445
|
+
'[data-testid="tooltip-content"]',
|
|
446
|
+
);
|
|
447
|
+
expect(content.attributes('style')).toContain('max-width: 320px');
|
|
448
|
+
defaultWidthWrapper.unmount();
|
|
449
|
+
});
|
|
450
|
+
});
|
|
370
451
|
});
|