@jsonresume/core 0.1.0 → 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014-2026 JSON Resume contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@jsonresume/core",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Framework-agnostic resume component core - design tokens, primitives, and validators",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
9
+ "./ssr": "./src/ssr/index.js",
10
+ "./helpers": "./src/helpers/index.js",
9
11
  "./tokens": "./src/tokens/index.js",
10
12
  "./primitives": "./src/primitives/index.js",
11
13
  "./styles": "./src/styles/tokens.css",
@@ -15,32 +17,27 @@
15
17
  "src",
16
18
  "dist"
17
19
  ],
18
- "scripts": {
19
- "test": "vitest run",
20
- "test:watch": "vitest",
21
- "lint": "eslint src || exit 0",
22
- "typecheck": "tsc --noEmit",
23
- "storybook": "storybook dev -p 6007"
24
- },
25
20
  "devDependencies": {
26
- "@repo/eslint-config-custom": "workspace:^",
27
- "@storybook/addon-docs": "8.6.14",
28
- "@storybook/blocks": "8.6.14",
29
- "@storybook/react": "8.6.14",
30
- "@storybook/react-vite": "8.6.14",
21
+ "@storybook/addon-docs": "8.6.15",
22
+ "@storybook/blocks": "8.6.15",
23
+ "@storybook/react": "8.6.15",
24
+ "@storybook/react-vite": "8.6.15",
31
25
  "react": "^19.2.0",
32
26
  "react-dom": "^19.2.0",
33
- "storybook": "8.6.14",
27
+ "storybook": "8.6.15",
34
28
  "typescript": "^5.9.3",
35
29
  "vite": "5.4.21",
36
- "vitest": "^2"
30
+ "vitest": "^2",
31
+ "@repo/eslint-config-custom": "^0.0.0"
37
32
  },
38
33
  "peerDependencies": {
39
34
  "react": "^18.0.0 || ^19.0.0",
40
35
  "react-dom": "^18.0.0 || ^19.0.0"
41
36
  },
42
37
  "dependencies": {
43
- "styled-components": "^6.1.19"
38
+ "styled-components": "^6.1.19",
39
+ "@jsonresume/types": "0.2.1",
40
+ "@jsonresume/utils": "0.2.1"
44
41
  },
45
42
  "keywords": [
46
43
  "resume",
@@ -62,5 +59,12 @@
62
59
  "publishConfig": {
63
60
  "access": "public"
64
61
  },
65
- "license": "MIT"
66
- }
62
+ "license": "MIT",
63
+ "scripts": {
64
+ "build": "node ./scripts/build-css.mjs",
65
+ "test": "vitest run",
66
+ "test:watch": "vitest",
67
+ "lint": "eslint src --cache --cache-location node_modules/.cache/.eslintcache || exit 0",
68
+ "storybook": "storybook dev -p 6007"
69
+ }
70
+ }
@@ -0,0 +1,96 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import React from 'react';
3
+ import { renderHtml } from './renderHtml.jsx';
4
+ import { ContactInfo } from '../../index.js';
5
+
6
+ describe('ContactInfo', () => {
7
+ it('renders nothing when basics is omitted entirely (default {})', () => {
8
+ // The gotcha: ContactInfo takes a single `basics` prop, not loose fields.
9
+ const { html } = renderHtml(<ContactInfo />);
10
+ expect(html).toBe('');
11
+ });
12
+
13
+ it('renders nothing for an empty basics object', () => {
14
+ const { html } = renderHtml(<ContactInfo basics={{}} />);
15
+ expect(html).toBe('');
16
+ });
17
+
18
+ it('renders an email as a mailto link', () => {
19
+ const { html } = renderHtml(
20
+ <ContactInfo basics={{ email: 'jane@example.com' }} />
21
+ );
22
+ expect(html).toContain('jane@example.com');
23
+ expect(html).toContain('mailto:jane@example.com');
24
+ expect(html).toContain('aria-label="Email"');
25
+ });
26
+
27
+ it('renders a phone as a tel link', () => {
28
+ const { html } = renderHtml(
29
+ <ContactInfo basics={{ phone: '+1 555 0100' }} />
30
+ );
31
+ expect(html).toContain('tel:');
32
+ expect(html).toContain('aria-label="Phone"');
33
+ });
34
+
35
+ it('renders a website with protocol stripped from display text', () => {
36
+ const { html } = renderHtml(
37
+ <ContactInfo basics={{ url: 'https://jane.dev/' }} />
38
+ );
39
+ expect(html).toContain('href="https://jane.dev/"');
40
+ expect(html).toContain('>jane.dev<');
41
+ expect(html).toContain('rel="noopener noreferrer"');
42
+ });
43
+
44
+ it('joins location parts and skips falsy fields', () => {
45
+ const { html } = renderHtml(
46
+ <ContactInfo
47
+ basics={{
48
+ location: { city: 'Berlin', region: '', countryCode: 'DE' },
49
+ }}
50
+ />
51
+ );
52
+ expect(html).toContain('Berlin, DE');
53
+ });
54
+
55
+ it('does not render a location item when all location fields are empty', () => {
56
+ const { html } = renderHtml(
57
+ <ContactInfo basics={{ location: { city: '', region: '' } }} />
58
+ );
59
+ expect(html).toBe('');
60
+ });
61
+
62
+ it('renders social profiles with the network as the label', () => {
63
+ const { html } = renderHtml(
64
+ <ContactInfo
65
+ basics={{
66
+ profiles: [
67
+ { network: 'GitHub', url: 'https://github.com/jane' },
68
+ { network: 'LinkedIn', url: 'https://linkedin.com/in/jane' },
69
+ ],
70
+ }}
71
+ />
72
+ );
73
+ expect(html).toContain('GitHub');
74
+ expect(html).toContain('LinkedIn');
75
+ expect(html).toContain('https://github.com/jane');
76
+ });
77
+
78
+ it('skips profiles that have no url', () => {
79
+ const { html } = renderHtml(
80
+ <ContactInfo basics={{ profiles: [{ network: 'Empty' }] }} />
81
+ );
82
+ expect(html).toBe('');
83
+ });
84
+
85
+ it('inserts the separator between multiple items', () => {
86
+ const { html } = renderHtml(
87
+ <ContactInfo basics={{ email: 'a@b.com', phone: '123' }} separator="|" />
88
+ );
89
+ expect(html).toContain('|');
90
+ });
91
+
92
+ it('does not throw if profiles is missing (defaults to [])', () => {
93
+ const { html } = renderHtml(<ContactInfo basics={{ email: 'a@b.com' }} />);
94
+ expect(html).toContain('a@b.com');
95
+ });
96
+ });
@@ -0,0 +1,119 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import React from 'react';
3
+ import { renderHtml } from './renderHtml.jsx';
4
+ import { DateRange, formatDateRange } from '../../index.js';
5
+
6
+ describe('formatDateRange (pure)', () => {
7
+ it('returns empty string when startDate is missing', () => {
8
+ expect(formatDateRange({ startDate: '' })).toBe('');
9
+ expect(formatDateRange({ startDate: null })).toBe('');
10
+ expect(formatDateRange({ startDate: undefined })).toBe('');
11
+ });
12
+
13
+ it('renders a single date (no "Present") when endDate is undefined', () => {
14
+ // An omitted endDate is a point in time (award/certificate/publication
15
+ // date), not an ongoing range: render just the start, no separator.
16
+ const out = formatDateRange({ startDate: '2020-01-15' });
17
+ expect(out).toContain('2020');
18
+ expect(out).not.toContain(' - ');
19
+ expect(out).not.toContain('Present');
20
+ });
21
+
22
+ it('shows "Present" for an ongoing role when endDate is null', () => {
23
+ const out = formatDateRange({ startDate: '2020-01-15', endDate: null });
24
+ expect(out).toContain('2020');
25
+ expect(out).toContain('Present');
26
+ expect(out).toContain(' - ');
27
+ });
28
+
29
+ it('formats a closed range with start and end', () => {
30
+ const out = formatDateRange({
31
+ startDate: '2018-06-01',
32
+ endDate: '2020-03-01',
33
+ });
34
+ expect(out).toContain('2018');
35
+ expect(out).toContain('2020');
36
+ expect(out).toContain(' - ');
37
+ });
38
+
39
+ it('supports long month format', () => {
40
+ const out = formatDateRange({ startDate: '2020-01-15', format: 'long' });
41
+ expect(out).toContain('January');
42
+ });
43
+
44
+ it('supports numeric month format', () => {
45
+ const out = formatDateRange({ startDate: '2020-01-15', format: 'numeric' });
46
+ expect(out).toMatch(/01\/2020|01\s*2020/);
47
+ });
48
+
49
+ it('localizes the present label (fr-FR => Présent)', () => {
50
+ const out = formatDateRange({
51
+ startDate: '2020-01-15',
52
+ endDate: null,
53
+ locale: 'fr-FR',
54
+ });
55
+ expect(out).toContain('Présent');
56
+ });
57
+
58
+ it('falls back to the base-language present label (de => Heute)', () => {
59
+ const out = formatDateRange({
60
+ startDate: '2020-01-15',
61
+ endDate: null,
62
+ locale: 'de',
63
+ });
64
+ expect(out).toContain('Heute');
65
+ });
66
+
67
+ it('honours an explicit presentLabel override', () => {
68
+ const out = formatDateRange({
69
+ startDate: '2020-01-15',
70
+ endDate: null,
71
+ presentLabel: 'Now',
72
+ });
73
+ expect(out).toContain('Now');
74
+ });
75
+
76
+ it('returns an invalid date string as-is rather than NaN', () => {
77
+ // A missing endDate renders a single date; the invalid start is passed
78
+ // through verbatim with no separator.
79
+ const out = formatDateRange({ startDate: 'not-a-date' });
80
+ expect(out).toBe('not-a-date');
81
+ });
82
+
83
+ it('accepts Date objects as well as strings', () => {
84
+ const out = formatDateRange({ startDate: new Date('2021-05-01') });
85
+ expect(out).toContain('2021');
86
+ });
87
+ });
88
+
89
+ describe('DateRange (component)', () => {
90
+ it('renders formatted output in a span', () => {
91
+ const { html } = renderHtml(
92
+ <DateRange startDate="2020-01-15" endDate={null} />
93
+ );
94
+ expect(html).toContain('<span');
95
+ expect(html).toContain('Present');
96
+ expect(html).toContain('resume-date-range');
97
+ });
98
+
99
+ it('renders nothing when startDate is missing', () => {
100
+ const { html } = renderHtml(<DateRange startDate="" />);
101
+ expect(html).toBe('');
102
+ });
103
+
104
+ it('renders a closed range', () => {
105
+ const { html } = renderHtml(
106
+ <DateRange startDate="2018-06" endDate="2020-03" />
107
+ );
108
+ expect(html).toContain('2018');
109
+ expect(html).toContain('2020');
110
+ });
111
+
112
+ it('merges a custom className', () => {
113
+ const { html } = renderHtml(
114
+ <DateRange startDate="2020-01" className="dates" />
115
+ );
116
+ expect(html).toContain('resume-date-range');
117
+ expect(html).toContain('dates');
118
+ });
119
+ });
@@ -0,0 +1,115 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import React from 'react';
3
+ import { renderHtml } from './renderHtml.jsx';
4
+ import { Link, safeUrl, isExternalUrl, getLinkRel } from '../../index.js';
5
+
6
+ describe('Link (component)', () => {
7
+ it('renders a safe https anchor with the resume-link class', () => {
8
+ const { html } = renderHtml(<Link href="https://example.com">Visit</Link>);
9
+ expect(html).toContain('<a');
10
+ expect(html).toContain('href="https://example.com"');
11
+ expect(html).toContain('Visit');
12
+ expect(html).toContain('resume-link');
13
+ });
14
+
15
+ it('marks external links with target=_blank and rel', () => {
16
+ const { html } = renderHtml(
17
+ <Link href="https://external.example.com">Out</Link>
18
+ );
19
+ expect(html).toContain('target="_blank"');
20
+ expect(html).toContain('rel="noopener noreferrer"');
21
+ });
22
+
23
+ it('downgrades a dangerous javascript: URL to a plain span', () => {
24
+ const { html } = renderHtml(<Link href="javascript:alert(1)">click</Link>);
25
+ expect(html).not.toContain('javascript:');
26
+ expect(html).not.toContain('<a');
27
+ expect(html).toContain('<span');
28
+ expect(html).toContain('click');
29
+ });
30
+
31
+ it('renders a span (no anchor) when href is missing', () => {
32
+ const { html } = renderHtml(<Link>no href</Link>);
33
+ expect(html).toContain('<span');
34
+ expect(html).not.toContain('<a');
35
+ expect(html).toContain('no href');
36
+ });
37
+
38
+ it('preserves the className on the fallback span', () => {
39
+ const { html } = renderHtml(
40
+ <Link href="" className="fallback">
41
+ x
42
+ </Link>
43
+ );
44
+ expect(html).toContain('<span');
45
+ expect(html).toContain('fallback');
46
+ });
47
+
48
+ it('does not add target/rel for relative (internal) links', () => {
49
+ const { html } = renderHtml(<Link href="/about">About</Link>);
50
+ expect(html).toContain('href="/about"');
51
+ expect(html).not.toContain('target="_blank"');
52
+ });
53
+ });
54
+
55
+ describe('safeUrl', () => {
56
+ it('passes through http(s), mailto, and tel', () => {
57
+ expect(safeUrl('https://x.com')).toBe('https://x.com');
58
+ expect(safeUrl('mailto:a@b.com')).toBe('mailto:a@b.com');
59
+ expect(safeUrl('tel:123')).toBe('tel:123');
60
+ });
61
+
62
+ it.each([
63
+ 'javascript:alert(1)',
64
+ 'data:text/html,<script>',
65
+ 'vbscript:msgbox',
66
+ 'file:///etc/passwd',
67
+ 'about:blank',
68
+ ])('blocks dangerous scheme %s', (url) => {
69
+ expect(safeUrl(url)).toBeNull();
70
+ });
71
+
72
+ it('returns null for non-string / empty input', () => {
73
+ expect(safeUrl(null)).toBeNull();
74
+ expect(safeUrl(undefined)).toBeNull();
75
+ expect(safeUrl(123)).toBeNull();
76
+ expect(safeUrl('')).toBeNull();
77
+ });
78
+
79
+ it('keeps relative URLs', () => {
80
+ expect(safeUrl('/about')).toBe('/about');
81
+ expect(safeUrl('./rel')).toBe('./rel');
82
+ });
83
+
84
+ it('upgrades bare www. and bare domains to https', () => {
85
+ expect(safeUrl('www.example.com')).toBe('https://www.example.com');
86
+ expect(safeUrl('example.com')).toBe('https://example.com');
87
+ });
88
+ });
89
+
90
+ describe('isExternalUrl', () => {
91
+ it('treats relative, hash, mailto, tel as internal', () => {
92
+ expect(isExternalUrl('/about')).toBe(false);
93
+ expect(isExternalUrl('#section')).toBe(false);
94
+ expect(isExternalUrl('mailto:a@b.com')).toBe(false);
95
+ expect(isExternalUrl('tel:123')).toBe(false);
96
+ });
97
+
98
+ it('compares origin when one is provided', () => {
99
+ expect(isExternalUrl('https://other.com/x', 'https://site.com')).toBe(true);
100
+ expect(isExternalUrl('https://site.com/x', 'https://site.com')).toBe(false);
101
+ });
102
+
103
+ it('returns false for non-string input', () => {
104
+ expect(isExternalUrl(null)).toBe(false);
105
+ });
106
+ });
107
+
108
+ describe('getLinkRel', () => {
109
+ it('adds rel only for http(s) links opening in a new tab', () => {
110
+ expect(getLinkRel('https://x.com', true)).toBe('noopener noreferrer');
111
+ expect(getLinkRel('https://x.com', false)).toBe('');
112
+ expect(getLinkRel('mailto:a@b.com', true)).toBe('');
113
+ expect(getLinkRel(null, true)).toBe('');
114
+ });
115
+ });
@@ -0,0 +1,199 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import React from 'react';
3
+ import { renderHtml } from './renderHtml.jsx';
4
+ import {
5
+ Section,
6
+ SectionTitle,
7
+ ListItem,
8
+ Badge,
9
+ BadgeList,
10
+ InlineSeparatorPipe,
11
+ } from '../../index.js';
12
+
13
+ describe('Section', () => {
14
+ it('renders children inside a <section> with resume-section class', () => {
15
+ const { html } = renderHtml(<Section>Work</Section>);
16
+ expect(html).toContain('<section');
17
+ expect(html).toContain('Work');
18
+ expect(html).toContain('resume-section');
19
+ });
20
+
21
+ it('applies id and merges custom className', () => {
22
+ const { html } = renderHtml(
23
+ <Section id="work-experience" className="extra">
24
+ x
25
+ </Section>
26
+ );
27
+ expect(html).toContain('id="work-experience"');
28
+ expect(html).toContain('resume-section');
29
+ expect(html).toContain('extra');
30
+ });
31
+
32
+ it('renders without children (empty section, no crash)', () => {
33
+ const { html } = renderHtml(<Section />);
34
+ expect(html).toContain('<section');
35
+ });
36
+
37
+ it('forwards arbitrary props (e.g. data-attributes)', () => {
38
+ const { html } = renderHtml(<Section data-testid="sec">x</Section>);
39
+ expect(html).toContain('data-testid="sec"');
40
+ });
41
+ });
42
+
43
+ describe('SectionTitle', () => {
44
+ it('renders an <h2> by default with the title text', () => {
45
+ const { html } = renderHtml(<SectionTitle>Experience</SectionTitle>);
46
+ expect(html).toMatch(/<h2[^>]*>/);
47
+ expect(html).toContain('Experience');
48
+ expect(html).toContain('resume-section-title');
49
+ });
50
+
51
+ it('renders a dynamic heading level via the level prop', () => {
52
+ const { html } = renderHtml(
53
+ <SectionTitle level={3}>Projects</SectionTitle>
54
+ );
55
+ expect(html).toMatch(/<h3[^>]*>/);
56
+ });
57
+
58
+ it('renders an icon when provided, marked aria-hidden', () => {
59
+ const { html } = renderHtml(<SectionTitle icon="*">Skills</SectionTitle>);
60
+ expect(html).toContain('resume-icon');
61
+ expect(html).toContain('aria-hidden="true"');
62
+ });
63
+
64
+ it('omits the icon span when no icon is given', () => {
65
+ const { html } = renderHtml(<SectionTitle>Skills</SectionTitle>);
66
+ expect(html).not.toContain('resume-icon');
67
+ });
68
+ });
69
+
70
+ describe('ListItem', () => {
71
+ const full = {
72
+ title: 'Senior Engineer',
73
+ subtitle: 'Acme Corp',
74
+ dateRange: 'Jan 2020 - Present',
75
+ location: 'San Francisco, CA',
76
+ description: 'Built things',
77
+ highlights: ['Led team of 5', 'Increased perf 40%'],
78
+ };
79
+
80
+ it('renders all fields when fully populated', () => {
81
+ const { html } = renderHtml(<ListItem {...full} />);
82
+ expect(html).toContain('Senior Engineer');
83
+ expect(html).toContain('Acme Corp');
84
+ expect(html).toContain('Jan 2020 - Present');
85
+ expect(html).toContain('San Francisco, CA');
86
+ expect(html).toContain('Built things');
87
+ expect(html).toContain('Led team of 5');
88
+ expect(html).toContain('Increased perf 40%');
89
+ });
90
+
91
+ it('renders nothing when title is missing (guard against crash)', () => {
92
+ const { html } = renderHtml(<ListItem subtitle="Acme" />);
93
+ expect(html).toBe('');
94
+ });
95
+
96
+ it('renders title-only item without optional fields', () => {
97
+ const { html } = renderHtml(<ListItem title="Just a title" />);
98
+ expect(html).toContain('Just a title');
99
+ expect(html).not.toContain('resume-item-subtitle');
100
+ expect(html).not.toContain('resume-highlights');
101
+ });
102
+
103
+ it('omits the meta separator dot when only dateRange is present', () => {
104
+ const { html } = renderHtml(<ListItem title="t" dateRange="2020" />);
105
+ expect(html).toContain('resume-item-meta');
106
+ expect(html).toContain('2020');
107
+ });
108
+
109
+ it('handles an empty highlights array without rendering a list', () => {
110
+ const { html } = renderHtml(<ListItem title="t" highlights={[]} />);
111
+ expect(html).not.toContain('resume-highlights');
112
+ });
113
+
114
+ it('renders every highlight as a list item', () => {
115
+ const { html } = renderHtml(
116
+ <ListItem title="t" highlights={['a', 'b', 'c']} />
117
+ );
118
+ const liCount = (html.match(/<li>/g) || []).length;
119
+ expect(liCount).toBe(3);
120
+ });
121
+ });
122
+
123
+ describe('Badge', () => {
124
+ it('renders its children and default class', () => {
125
+ const { html } = renderHtml(<Badge>JavaScript</Badge>);
126
+ expect(html).toContain('JavaScript');
127
+ expect(html).toContain('resume-badge');
128
+ expect(html).toContain('resume-badge-default');
129
+ });
130
+
131
+ it.each(['default', 'accent', 'secondary'])(
132
+ 'renders variant "%s" with the matching class',
133
+ (variant) => {
134
+ const { html } = renderHtml(<Badge variant={variant}>x</Badge>);
135
+ expect(html).toContain(`resume-badge-${variant}`);
136
+ }
137
+ );
138
+
139
+ it.each(['sm', 'md', 'lg'])('renders size "%s" without crashing', (size) => {
140
+ const { html } = renderHtml(<Badge size={size}>x</Badge>);
141
+ expect(html).toContain('resume-badge');
142
+ });
143
+
144
+ it('renders empty children without crashing', () => {
145
+ const { html } = renderHtml(<Badge />);
146
+ expect(html).toContain('resume-badge');
147
+ });
148
+ });
149
+
150
+ describe('BadgeList', () => {
151
+ it('renders an items array as individual badges', () => {
152
+ const { html } = renderHtml(
153
+ <BadgeList items={['React', 'TypeScript', 'Node']} />
154
+ );
155
+ expect(html).toContain('React');
156
+ expect(html).toContain('TypeScript');
157
+ expect(html).toContain('Node');
158
+ const badges = (html.match(/resume-badge-default/g) || []).length;
159
+ expect(badges).toBe(3);
160
+ });
161
+
162
+ it('renders children when no items array is given', () => {
163
+ const { html } = renderHtml(
164
+ <BadgeList>
165
+ <Badge>Composed</Badge>
166
+ </BadgeList>
167
+ );
168
+ expect(html).toContain('Composed');
169
+ expect(html).toContain('resume-badge-list');
170
+ });
171
+
172
+ it('renders an empty list (empty items array) without crashing', () => {
173
+ const { html } = renderHtml(<BadgeList items={[]} />);
174
+ expect(html).toContain('resume-badge-list');
175
+ expect(html).not.toContain('resume-badge-default');
176
+ });
177
+
178
+ it('propagates variant to all generated badges', () => {
179
+ const { html } = renderHtml(
180
+ <BadgeList items={['a', 'b']} variant="accent" />
181
+ );
182
+ const accent = (html.match(/resume-badge-accent/g) || []).length;
183
+ expect(accent).toBe(2);
184
+ });
185
+ });
186
+
187
+ describe('InlineSeparatorPipe', () => {
188
+ it('renders a presentation span hidden from assistive tech', () => {
189
+ const { html } = renderHtml(<InlineSeparatorPipe />);
190
+ expect(html).toContain('aria-hidden="true"');
191
+ expect(html).toContain('role="presentation"');
192
+ expect(html).toContain('resume-inline-separator-pipe');
193
+ });
194
+
195
+ it('renders as a custom element via the as prop', () => {
196
+ const { html } = renderHtml(<InlineSeparatorPipe as="li" />);
197
+ expect(html).toMatch(/<li[^>]*role="presentation"/);
198
+ });
199
+ });