@syntrologie/adapt-nav 2.5.1 → 2.6.0-canary.2

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.
Files changed (76) hide show
  1. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +1 -1
  2. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +22 -153
  3. package/node_modules/@syntrologie/shared-editor-ui/package.json +2 -2
  4. package/package.json +1 -1
  5. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/AnchorPicker.test.d.ts +0 -2
  6. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/AnchorPicker.test.d.ts.map +0 -1
  7. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/AnchorPicker.test.js +0 -224
  8. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.d.ts +0 -2
  9. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.d.ts.map +0 -1
  10. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.js +0 -29
  11. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.d.ts +0 -2
  12. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.d.ts.map +0 -1
  13. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.js +0 -260
  14. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.d.ts +0 -2
  15. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.d.ts.map +0 -1
  16. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DetectionBadge.test.js +0 -70
  17. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.d.ts +0 -2
  18. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.d.ts.map +0 -1
  19. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.js +0 -46
  20. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.d.ts +0 -2
  21. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.d.ts.map +0 -1
  22. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditBackButton.test.js +0 -20
  23. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.d.ts +0 -2
  24. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.d.ts.map +0 -1
  25. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorBody.test.js +0 -12
  26. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.d.ts +0 -2
  27. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.d.ts.map +0 -1
  28. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.js +0 -84
  29. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.d.ts +0 -2
  30. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.d.ts.map +0 -1
  31. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorFooter.test.js +0 -23
  32. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.d.ts +0 -2
  33. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.d.ts.map +0 -1
  34. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.js +0 -23
  35. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.d.ts +0 -2
  36. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.d.ts.map +0 -1
  37. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorInput.test.js +0 -26
  38. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.d.ts +0 -2
  39. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.d.ts.map +0 -1
  40. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorLayout.test.js +0 -13
  41. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.d.ts +0 -2
  42. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.d.ts.map +0 -1
  43. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.js +0 -496
  44. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.d.ts +0 -2
  45. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.d.ts.map +0 -1
  46. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorSelect.test.js +0 -22
  47. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.d.ts +0 -2
  48. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.d.ts.map +0 -1
  49. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorTextarea.test.js +0 -20
  50. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.d.ts +0 -2
  51. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.d.ts.map +0 -1
  52. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.js +0 -176
  53. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.d.ts +0 -2
  54. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.d.ts.map +0 -1
  55. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EmptyState.test.js +0 -10
  56. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.d.ts +0 -2
  57. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.d.ts.map +0 -1
  58. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/GroupHeader.test.js +0 -14
  59. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.d.ts +0 -2
  60. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.d.ts.map +0 -1
  61. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.js +0 -189
  62. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.d.ts +0 -2
  63. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.d.ts.map +0 -1
  64. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/cn.test.js +0 -16
  65. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.d.ts +0 -2
  66. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.d.ts.map +0 -1
  67. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.js +0 -329
  68. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/selectorGenerator.test.d.ts +0 -2
  69. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/selectorGenerator.test.d.ts.map +0 -1
  70. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/selectorGenerator.test.js +0 -257
  71. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.d.ts +0 -2
  72. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.d.ts.map +0 -1
  73. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useElementRect.test.js +0 -112
  74. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts +0 -2
  75. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.d.ts.map +0 -1
  76. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/useTriggerWhenStatus.test.js +0 -1015
@@ -1,176 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { fireEvent, render } from '@testing-library/react';
3
- import { beforeEach, describe, expect, it, vi } from 'vitest';
4
- import { ElementHighlight } from '../components/ElementHighlight';
5
- // Mock ResizeObserver for jsdom
6
- class MockResizeObserver {
7
- observe() { }
8
- unobserve() { }
9
- disconnect() { }
10
- }
11
- vi.stubGlobal('ResizeObserver', MockResizeObserver);
12
- vi.stubGlobal('requestAnimationFrame', (cb) => {
13
- cb(0);
14
- return 0;
15
- });
16
- vi.stubGlobal('cancelAnimationFrame', () => { });
17
- describe('ElementHighlight', () => {
18
- let mockElement;
19
- let mockRect;
20
- beforeEach(() => {
21
- mockRect = {
22
- top: 100,
23
- left: 200,
24
- width: 300,
25
- height: 150,
26
- bottom: 250,
27
- right: 500,
28
- x: 200,
29
- y: 100,
30
- toJSON: () => ({}),
31
- };
32
- mockElement = document.createElement('div');
33
- vi.spyOn(mockElement, 'getBoundingClientRect').mockReturnValue(mockRect);
34
- });
35
- it('renders portal to document.body', () => {
36
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6" }));
37
- // The highlight is portaled to document.body — check body has the overlay
38
- const overlay = document.body.querySelector('[data-syntro-highlight]');
39
- expect(overlay).toBeTruthy();
40
- });
41
- it('positions at element bounding rect', () => {
42
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", padding: 2 }));
43
- const overlay = document.body.querySelector('[data-syntro-highlight]');
44
- expect(overlay).toBeTruthy();
45
- // Fixed positioning with padding
46
- expect(overlay.style.top).toBe('98px'); // 100 - 2
47
- expect(overlay.style.left).toBe('198px'); // 200 - 2
48
- expect(overlay.style.width).toBe('304px'); // 300 + 2*2
49
- expect(overlay.style.height).toBe('154px'); // 150 + 2*2
50
- });
51
- it('shows label text and icon', () => {
52
- const icon = _jsx("span", { "data-testid": "icon", children: "I" });
53
- render(_jsx(ElementHighlight, { element: mockElement, color: "#ef4444", label: "Sensitive", labelIcon: icon }));
54
- const label = document.body.querySelector('[data-syntro-highlight-label]');
55
- expect(label).toBeTruthy();
56
- expect(label.textContent).toContain('Sensitive');
57
- expect(document.body.querySelector('[data-testid="icon"]')).toBeTruthy();
58
- });
59
- it('shows remove button when showRemove is true', () => {
60
- const onRemove = vi.fn();
61
- render(_jsx(ElementHighlight, { element: mockElement, color: "#ef4444", label: "Test", showRemove: true, onRemove: onRemove }));
62
- const removeBtn = document.body.querySelector('[data-syntro-highlight-remove]');
63
- expect(removeBtn).toBeTruthy();
64
- });
65
- it('calls onClick when clicked', () => {
66
- const onClick = vi.fn();
67
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: onClick }));
68
- const overlay = document.body.querySelector('[data-syntro-highlight]');
69
- fireEvent.click(overlay);
70
- expect(onClick).toHaveBeenCalledTimes(1);
71
- });
72
- it('calls onRemove when remove button is clicked', () => {
73
- const onRemove = vi.fn();
74
- const onClick = vi.fn();
75
- render(_jsx(ElementHighlight, { element: mockElement, color: "#ef4444", label: "Test", showRemove: true, onRemove: onRemove, onClick: onClick }));
76
- const removeBtn = document.body.querySelector('[data-syntro-highlight-remove]');
77
- fireEvent.click(removeBtn);
78
- expect(onRemove).toHaveBeenCalledTimes(1);
79
- // onClick should not fire when clicking remove
80
- expect(onClick).not.toHaveBeenCalled();
81
- });
82
- it('shows dimensions when showDimensions is true', () => {
83
- mockElement = document.createElement('section');
84
- mockElement.id = 'hero';
85
- vi.spyOn(mockElement, 'getBoundingClientRect').mockReturnValue(mockRect);
86
- render(_jsx(ElementHighlight, { element: mockElement, color: "rgba(99,102,241,0.6)", showDimensions: true }));
87
- const label = document.body.querySelector('[data-syntro-highlight-label]');
88
- expect(label).toBeTruthy();
89
- // Should contain tag name and dimensions
90
- expect(label.textContent).toContain('section');
91
- expect(label.textContent).toContain('#hero');
92
- expect(label.textContent).toContain('300');
93
- expect(label.textContent).toContain('150');
94
- });
95
- it('uses at least 11px font for highlight labels', () => {
96
- render(_jsx(ElementHighlight, { element: mockElement, color: "rgba(99,102,241,0.6)", showDimensions: true }));
97
- const label = document.body.querySelector('[data-syntro-highlight-label]');
98
- expect(label).toBeTruthy();
99
- // showDimensions uses the smaller size (11px); non-dimensions uses 12px
100
- expect(label.style.fontSize).toBe('11px');
101
- });
102
- it('uses 12px font for non-dimensions labels', () => {
103
- render(_jsx(ElementHighlight, { element: mockElement, color: "#ef4444", label: "Test Label" }));
104
- const label = document.body.querySelector('[data-syntro-highlight-label]');
105
- expect(label).toBeTruthy();
106
- expect(label.style.fontSize).toBe('12px');
107
- });
108
- it('uses 12px font for remove button', () => {
109
- const onRemove = vi.fn();
110
- render(_jsx(ElementHighlight, { element: mockElement, color: "#ef4444", label: "Test", showRemove: true, onRemove: onRemove }));
111
- const removeBtn = document.body.querySelector('[data-syntro-highlight-remove]');
112
- expect(removeBtn).toBeTruthy();
113
- expect(removeBtn.style.fontSize).toBe('12px');
114
- expect(removeBtn.style.width).toBe('16px');
115
- expect(removeBtn.style.height).toBe('16px');
116
- });
117
- it('does not show remove button when showRemove is false', () => {
118
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", label: "Test" }));
119
- const removeBtn = document.body.querySelector('[data-syntro-highlight-remove]');
120
- expect(removeBtn).toBeNull();
121
- });
122
- it('calls onClick when Enter key is pressed', () => {
123
- const onClick = vi.fn();
124
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: onClick }));
125
- const overlay = document.body.querySelector('[data-syntro-highlight]');
126
- fireEvent.keyDown(overlay, { key: 'Enter' });
127
- expect(onClick).toHaveBeenCalledTimes(1);
128
- });
129
- it('calls onClick when Space key is pressed', () => {
130
- const onClick = vi.fn();
131
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: onClick }));
132
- const overlay = document.body.querySelector('[data-syntro-highlight]');
133
- fireEvent.keyDown(overlay, { key: ' ' });
134
- expect(onClick).toHaveBeenCalledTimes(1);
135
- });
136
- it('does not fire onClick on other key presses', () => {
137
- const onClick = vi.fn();
138
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: onClick }));
139
- const overlay = document.body.querySelector('[data-syntro-highlight]');
140
- fireEvent.keyDown(overlay, { key: 'Tab' });
141
- expect(onClick).not.toHaveBeenCalled();
142
- });
143
- it('does not attach onKeyDown when onClick is not provided', () => {
144
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6" }));
145
- const overlay = document.body.querySelector('[data-syntro-highlight]');
146
- // Should not throw and should have no role/tabIndex
147
- expect(overlay.getAttribute('role')).toBeNull();
148
- expect(overlay.getAttribute('tabindex')).toBeNull();
149
- });
150
- it('has role="button" and tabIndex when onClick is provided', () => {
151
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: () => { } }));
152
- const overlay = document.body.querySelector('[data-syntro-highlight]');
153
- expect(overlay.getAttribute('role')).toBe('button');
154
- expect(overlay.getAttribute('tabindex')).toBe('0');
155
- });
156
- it('sets pointer cursor when onClick is provided', () => {
157
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: () => { } }));
158
- const overlay = document.body.querySelector('[data-syntro-highlight]');
159
- expect(overlay.style.cursor).toBe('pointer');
160
- });
161
- it('sets default cursor when onClick is not provided', () => {
162
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6" }));
163
- const overlay = document.body.querySelector('[data-syntro-highlight]');
164
- expect(overlay.style.cursor).toBe('default');
165
- });
166
- it('sets pointerEvents to auto when onClick is provided', () => {
167
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6", onClick: () => { } }));
168
- const overlay = document.body.querySelector('[data-syntro-highlight]');
169
- expect(overlay.style.pointerEvents).toBe('auto');
170
- });
171
- it('sets pointerEvents to none when no onClick or onRemove', () => {
172
- render(_jsx(ElementHighlight, { element: mockElement, color: "#3b82f6" }));
173
- const overlay = document.body.querySelector('[data-syntro-highlight]');
174
- expect(overlay.style.pointerEvents).toBe('none');
175
- });
176
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=EmptyState.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmptyState.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/EmptyState.test.tsx"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render } from '@testing-library/react';
3
- import { describe, expect, it } from 'vitest';
4
- import { EmptyState } from '../components/EmptyState';
5
- describe('EmptyState', () => {
6
- it('renders the message text', () => {
7
- const { getByText } = render(_jsx(EmptyState, { message: "No items found" }));
8
- expect(getByText('No items found')).toBeTruthy();
9
- });
10
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=GroupHeader.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GroupHeader.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/GroupHeader.test.tsx"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render } from '@testing-library/react';
3
- import { describe, expect, it } from 'vitest';
4
- import { GroupHeader } from '../components/GroupHeader';
5
- describe('GroupHeader', () => {
6
- it('renders the label', () => {
7
- const { getByText } = render(_jsx(GroupHeader, { label: "Active", count: 5 }));
8
- expect(getByText('Active')).toBeTruthy();
9
- });
10
- it('renders the count badge', () => {
11
- const { getByText } = render(_jsx(GroupHeader, { label: "Items", count: 12 }));
12
- expect(getByText('12')).toBeTruthy();
13
- });
14
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=TriggerJourney.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TriggerJourney.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/TriggerJourney.test.tsx"],"names":[],"mappings":""}
@@ -1,189 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
3
- import { describe, expect, it } from 'vitest';
4
- import { TriggerJourney } from '../components/TriggerJourney';
5
- describe('TriggerJourney', () => {
6
- it('renders "Always Present" when status is null', () => {
7
- render(_jsx(TriggerJourney, { status: null }));
8
- expect(screen.getByText('Always Present')).toBeTruthy();
9
- });
10
- it('renders "Always Present" when conditions array is empty', () => {
11
- const status = { visible: true, isFallback: true, conditions: [] };
12
- render(_jsx(TriggerJourney, { status: status }));
13
- expect(screen.getByText('Always Present')).toBeTruthy();
14
- });
15
- it('renders a single node for one condition', () => {
16
- const status = {
17
- visible: true,
18
- isFallback: false,
19
- conditions: [
20
- {
21
- type: 'page_url',
22
- passed: true,
23
- formatted: { label: '/pricing', instruction: 'Visit /pricing', shortLabel: '/pricing' },
24
- },
25
- ],
26
- };
27
- render(_jsx(TriggerJourney, { status: status }));
28
- expect(screen.getByText('/pricing')).toBeTruthy();
29
- });
30
- it('renders multiple connected nodes', () => {
31
- const status = {
32
- visible: false,
33
- isFallback: false,
34
- conditions: [
35
- {
36
- type: 'page_url',
37
- passed: true,
38
- formatted: {
39
- label: '/fine-arts/',
40
- instruction: 'Visit a /fine-arts/ page',
41
- shortLabel: '/fine-arts/',
42
- },
43
- },
44
- {
45
- type: 'event_count',
46
- passed: false,
47
- formatted: {
48
- label: 'views >= 2',
49
- instruction: 'View pages 2+ times',
50
- shortLabel: 'View 2+ times',
51
- progress: { current: 1, target: 2, operator: 'gte' },
52
- },
53
- },
54
- ],
55
- };
56
- const { container } = render(_jsx(TriggerJourney, { status: status }));
57
- expect(screen.getByText('/fine-arts/')).toBeTruthy();
58
- expect(screen.getByText('View 2+ times')).toBeTruthy();
59
- const lines = container.querySelectorAll('[data-journey-line]');
60
- expect(lines.length).toBe(1);
61
- });
62
- it('shows progress bar for event_count conditions', () => {
63
- const status = {
64
- visible: false,
65
- isFallback: false,
66
- conditions: [
67
- {
68
- type: 'event_count',
69
- passed: false,
70
- formatted: {
71
- label: 'clicks >= 3',
72
- instruction: 'Reach 3+ click events',
73
- shortLabel: '3+ clicks',
74
- progress: { current: 1, target: 3, operator: 'gte' },
75
- },
76
- },
77
- ],
78
- };
79
- render(_jsx(TriggerJourney, { status: status }));
80
- expect(screen.getByText('1/3')).toBeTruthy();
81
- });
82
- it('marks passed nodes with data-passed attribute', () => {
83
- const status = {
84
- visible: false,
85
- isFallback: false,
86
- conditions: [
87
- { type: 'a', passed: true, formatted: { label: 'a', instruction: 'A', shortLabel: 'A' } },
88
- { type: 'b', passed: false, formatted: { label: 'b', instruction: 'B', shortLabel: 'B' } },
89
- ],
90
- };
91
- const { container } = render(_jsx(TriggerJourney, { status: status }));
92
- const nodes = container.querySelectorAll('[data-journey-node]');
93
- expect(nodes.length).toBe(2);
94
- expect(nodes[0].getAttribute('data-passed')).toBe('true');
95
- expect(nodes[1].getAttribute('data-passed')).toBe('false');
96
- });
97
- it('shows "All conditions met" when all passed and multiple conditions', () => {
98
- const status = {
99
- visible: true,
100
- isFallback: false,
101
- conditions: [
102
- { type: 'a', passed: true, formatted: { label: 'a', instruction: 'A', shortLabel: 'A' } },
103
- { type: 'b', passed: true, formatted: { label: 'b', instruction: 'B', shortLabel: 'B' } },
104
- ],
105
- };
106
- render(_jsx(TriggerJourney, { status: status }));
107
- expect(screen.getByText('All conditions met')).toBeTruthy();
108
- });
109
- it('does NOT show "All conditions met" for single condition', () => {
110
- const status = {
111
- visible: true,
112
- isFallback: false,
113
- conditions: [
114
- { type: 'a', passed: true, formatted: { label: 'a', instruction: 'A', shortLabel: 'A' } },
115
- ],
116
- };
117
- render(_jsx(TriggerJourney, { status: status }));
118
- expect(screen.queryByText('All conditions met')).toBeNull();
119
- });
120
- it('uses secondary text color and medium weight for node labels', () => {
121
- const status = {
122
- visible: false,
123
- isFallback: false,
124
- conditions: [
125
- {
126
- type: 'page_url',
127
- passed: false,
128
- formatted: { label: '/p', instruction: 'Visit pricing', shortLabel: '/pricing' },
129
- },
130
- ],
131
- };
132
- render(_jsx(TriggerJourney, { status: status }));
133
- const label = screen.getByText('/pricing');
134
- expect(label.className).toContain('se-text-text-secondary');
135
- expect(label.className).not.toContain('se-text-text-tertiary');
136
- expect(label.className).toContain('se-font-medium');
137
- });
138
- it('uses at least 11px font size for node labels', () => {
139
- const status = {
140
- visible: false,
141
- isFallback: false,
142
- conditions: [
143
- {
144
- type: 'page_url',
145
- passed: false,
146
- formatted: { label: '/p', instruction: 'Visit pricing', shortLabel: '/pricing' },
147
- },
148
- ],
149
- };
150
- render(_jsx(TriggerJourney, { status: status }));
151
- const label = screen.getByText('/pricing');
152
- expect(label.className).toContain('se-text-[11px]');
153
- });
154
- it('uses secondary text color for "Always Present" label', () => {
155
- render(_jsx(TriggerJourney, { status: null }));
156
- const label = screen.getByText('Always Present');
157
- expect(label.className).toContain('se-text-text-secondary');
158
- expect(label.className).not.toContain('se-text-text-tertiary');
159
- });
160
- it('uses at least 12px for "All conditions met" text', () => {
161
- const status = {
162
- visible: true,
163
- isFallback: false,
164
- conditions: [
165
- { type: 'a', passed: true, formatted: { label: 'a', instruction: 'A', shortLabel: 'A' } },
166
- { type: 'b', passed: true, formatted: { label: 'b', instruction: 'B', shortLabel: 'B' } },
167
- ],
168
- };
169
- const { container } = render(_jsx(TriggerJourney, { status: status }));
170
- const badge = screen.getByText('All conditions met').closest('div');
171
- expect(badge.className).toContain('se-text-[12px]');
172
- });
173
- it('uses instruction as title attribute for tooltip', () => {
174
- const status = {
175
- visible: false,
176
- isFallback: false,
177
- conditions: [
178
- {
179
- type: 'page_url',
180
- passed: false,
181
- formatted: { label: '/p', instruction: 'Visit /pricing page', shortLabel: '/pricing' },
182
- },
183
- ],
184
- };
185
- render(_jsx(TriggerJourney, { status: status }));
186
- const label = screen.getByText('/pricing');
187
- expect(label.getAttribute('title')).toBe('Visit /pricing page');
188
- });
189
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=cn.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/cn.test.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { cn } from '../cn';
3
- describe('cn', () => {
4
- it('joins multiple classes', () => {
5
- expect(cn('a', 'b', 'c')).toBe('a b c');
6
- });
7
- it('filters out false, null, and undefined values', () => {
8
- expect(cn('a', false, null, undefined, 'b')).toBe('a b');
9
- });
10
- it('returns empty string for no args', () => {
11
- expect(cn()).toBe('');
12
- });
13
- it('handles a single class', () => {
14
- expect(cn('only')).toBe('only');
15
- });
16
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=formatConditionLabel.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatConditionLabel.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/formatConditionLabel.test.ts"],"names":[],"mappings":""}