@eldrajs/theme-cli 0.2.8 → 0.2.9
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/CHANGELOG.md +2 -1
- package/package.json +1 -1
- package/template/.eldra/block-types.d.ts +28 -7
- package/template/.eldra/manifest.json +1034 -355
- package/template/.eldra/previews.json +35 -35
- package/template/README.md +32 -0
- package/template/app/assets/main.css +23 -0
- package/template/app/plugins/eldra-storefront.ts +3 -0
- package/template/app/storefront/demo.ts +75 -24
- package/template/app/storefront/gateway.ts +16 -2
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/preview.json +4 -4
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/Block.vue +48 -19
- package/template/blocks/article-list/__tests__/Block.spec.ts +15 -0
- package/template/blocks/article-list/preview.json +43 -43
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +260 -9
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +202 -0
- package/template/blocks/collection-grid/block.json +3 -3
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +65 -52
- package/template/blocks/collection-header/preview.json +4 -4
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/preview.json +4 -4
- package/template/blocks/cta/preview.png +0 -0
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/Block.vue +73 -4
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +43 -1
- package/template/blocks/feature-grid/block.json +2 -2
- package/template/blocks/feature-grid/preview.json +49 -24
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +186 -71
- package/template/blocks/footer/__tests__/Block.spec.ts +127 -32
- package/template/blocks/footer/block.json +42 -4
- package/template/blocks/footer/mock.json +31 -34
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/form/preview.png +0 -0
- package/template/blocks/gallery/preview.json +24 -24
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +117 -19
- package/template/blocks/hero/__tests__/Block.spec.ts +46 -0
- package/template/blocks/hero/block.json +36 -1
- package/template/blocks/hero/preview.json +33 -25
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/preview.json +4 -4
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +622 -184
- package/template/blocks/navigation/__tests__/Block.spec.ts +406 -68
- package/template/blocks/navigation/__tests__/fixtures/menu.json +182 -0
- package/template/blocks/navigation/block.json +102 -6
- package/template/blocks/navigation/mock.json +279 -52
- package/template/blocks/navigation/preview.json +311 -0
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/newsletter/Block.vue +248 -144
- package/template/blocks/newsletter/__tests__/Block.spec.ts +42 -0
- package/template/blocks/newsletter/block.json +61 -2
- package/template/blocks/newsletter/preview.json +35 -0
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +272 -26
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +90 -0
- package/template/blocks/product-carousel/block.json +61 -0
- package/template/blocks/product-carousel/preview.json +12 -0
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +148 -96
- package/template/blocks/product-detail/__tests__/Block.spec.ts +98 -74
- package/template/blocks/product-detail/block.json +11 -4
- package/template/blocks/product-detail/mock.json +53 -22
- package/template/blocks/product-detail/parts/Gallery.vue +52 -103
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/quote/preview.png +0 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +1 -0
- package/template/blocks/search/TypeSection.vue +1 -0
- package/template/blocks/search/__tests__/Block.spec.ts +23 -0
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/split-content/Block.vue +98 -20
- package/template/blocks/split-content/__tests__/Block.spec.ts +57 -18
- package/template/blocks/split-content/block.json +72 -6
- package/template/blocks/split-content/preview.json +34 -13
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/preview.json +16 -16
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +67 -1
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +30 -1
- package/template/blocks/trust-strip/block.json +4 -4
- package/template/blocks/trust-strip/preview.json +21 -0
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +16 -9
- package/template/i18n/is-IS.json +16 -9
- package/template/pages/article.page.json +19 -18
- package/template/pages/cart.page.json +3 -13
- package/template/pages/category.page.json +15 -7
- package/template/pages/collection.page.json +15 -14
- package/template/pages/home.page.json +217 -182
- package/template/pages/product.page.json +46 -36
- package/template/pages/products.page.json +3 -13
- package/template/pages/search.page.json +3 -13
- package/template/pages/wishlist.page.json +3 -13
- package/template/public/images/CREDITS.md +28 -0
- package/template/public/images/clay-hands.webp +0 -0
- package/template/public/images/coffee-table.webp +0 -0
- package/template/public/images/cup.webp +0 -0
- package/template/public/images/enamel-cups.webp +0 -0
- package/template/public/images/hero.webp +0 -0
- package/template/public/images/kitchen.webp +0 -0
- package/template/public/images/mug.webp +0 -0
- package/template/public/images/northwind-mark.svg +1 -0
- package/template/public/images/planters.webp +0 -0
- package/template/public/images/plates.webp +0 -0
- package/template/public/images/reading.webp +0 -0
- package/template/public/images/sweater.webp +0 -0
- package/template/public/images/terracotta.webp +0 -0
- package/template/public/images/throws.webp +0 -0
- package/template/public/images/vase.webp +0 -0
- package/template/public/images/wheel.webp +0 -0
- package/template/public/images/yarn-tools.webp +0 -0
- package/template/public/images/yarn.webp +0 -0
- package/template/stories/generated/collection-grid.stories.ts +6 -0
- package/template/stories/generated/feature-grid.stories.ts +6 -0
- package/template/stories/generated/footer.stories.ts +4 -4
- package/template/stories/generated/hero.stories.ts +6 -0
- package/template/stories/generated/navigation.stories.ts +14 -1
- package/template/stories/generated/newsletter.stories.ts +2 -1
- package/template/stories/generated/product-carousel.stories.ts +12 -0
- package/template/stories/generated/split-content.stories.ts +12 -0
- package/template/stories/generated/trust-strip.stories.ts +8 -1
- package/template/stories/pages/article.stories.ts +2 -1
- package/template/stories/pages/cart.stories.ts +2 -1
- package/template/stories/pages/category.stories.ts +2 -1
- package/template/stories/pages/collection.stories.ts +2 -1
- package/template/stories/pages/home.stories.ts +2 -1
- package/template/stories/pages/product.stories.ts +2 -1
- package/template/stories/pages/products.stories.ts +2 -1
- package/template/stories/pages/search.stories.ts +2 -1
- package/template/stories/pages/wishlist.stories.ts +2 -1
- package/template/stories/support/demoChrome.ts +32 -0
- package/template/stories/support/pageBlocks.ts +2 -4
- package/template/test/countPill.browser.spec.ts +21 -13
- package/template/test/localePrefix.spec.ts +11 -6
- package/template/test/pages/article.spec.ts +1 -1
- package/template/test/pages/category.spec.ts +34 -11
- package/template/test/pages/collection.spec.ts +182 -148
- package/template/test/pages/home.spec.ts +35 -40
- package/template/test/pages/hydration.spec.ts +4 -4
- package/template/test/pages/product.spec.ts +17 -14
- package/template/test/pages/seededPages.spec.ts +11 -6
- package/template/test/prerenderRefresh.browser.spec.ts +36 -15
- package/template/test/starter.spec.ts +31 -15
- package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
- package/template/tokens.json +13 -13
|
@@ -44,7 +44,11 @@ const TEMPLATES = [
|
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
id: 'rt-product',
|
|
47
|
-
data: {
|
|
47
|
+
data: {
|
|
48
|
+
schemaApiId: 'catalog:product',
|
|
49
|
+
routePattern: '/products/:slug',
|
|
50
|
+
slugField: 'slug',
|
|
51
|
+
},
|
|
48
52
|
},
|
|
49
53
|
];
|
|
50
54
|
|
|
@@ -76,6 +80,15 @@ const resolvedMock = {
|
|
|
76
80
|
};
|
|
77
81
|
const linkContext = { templates: TEMPLATES, targets: linkTargets };
|
|
78
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The design's footer carries no sign-up (a page that wants one places the Newsletter block), so
|
|
85
|
+
* `mock.json` seeds `showNewsletter: false`. The sign-up's own specs turn it on.
|
|
86
|
+
*/
|
|
87
|
+
const withNewsletter = { ...mock, showNewsletter: true };
|
|
88
|
+
|
|
89
|
+
/** `mock.json` has no description (the design has none); the specs that need one bring their own. */
|
|
90
|
+
const DESCRIPTION = 'Goods from small workshops, made to be used every day.';
|
|
91
|
+
|
|
79
92
|
function mountFooter(
|
|
80
93
|
data: Record<string, unknown>,
|
|
81
94
|
options: {
|
|
@@ -123,7 +136,10 @@ function mountFooter(
|
|
|
123
136
|
: options.subscribe
|
|
124
137
|
? (() => {
|
|
125
138
|
const demo = createDemoStorefront();
|
|
126
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
...demo,
|
|
141
|
+
forms: { ...demo.forms, submit: options.subscribe! },
|
|
142
|
+
};
|
|
127
143
|
})()
|
|
128
144
|
: undefined);
|
|
129
145
|
return mount(Block, {
|
|
@@ -188,7 +204,8 @@ describe('footer block', () => {
|
|
|
188
204
|
it('renders the default variant (merged data — no preview.json exists for this block) with no axe violations', async () => {
|
|
189
205
|
const wrapper = mountFooter(mock);
|
|
190
206
|
expect(wrapper.text()).toContain(mock.brandText);
|
|
191
|
-
expect(wrapper.text()).toContain(mock.
|
|
207
|
+
expect(wrapper.text()).toContain(mock.address);
|
|
208
|
+
expect(wrapper.text()).toContain(mock.hours);
|
|
192
209
|
for (const group of mock.groups) expect(wrapper.text()).toContain(group.label);
|
|
193
210
|
expect(wrapper.text()).toContain(mock.legalText);
|
|
194
211
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
@@ -226,7 +243,11 @@ describe('footer block', () => {
|
|
|
226
243
|
...resolvedMock,
|
|
227
244
|
variant: 'minimal',
|
|
228
245
|
links: [
|
|
229
|
-
{
|
|
246
|
+
{
|
|
247
|
+
kind: 'collection',
|
|
248
|
+
target: { _type: 'collection', id: 'id-gone' },
|
|
249
|
+
label: 'Gone',
|
|
250
|
+
},
|
|
230
251
|
],
|
|
231
252
|
});
|
|
232
253
|
expect(wrapper.text()).toContain('Gone');
|
|
@@ -312,7 +333,7 @@ describe('footer block', () => {
|
|
|
312
333
|
});
|
|
313
334
|
|
|
314
335
|
it('the newsletter email input has type="email", autocomplete="email" and a programmatic label', () => {
|
|
315
|
-
const wrapper = mountFooter(
|
|
336
|
+
const wrapper = mountFooter(withNewsletter);
|
|
316
337
|
const input = wrapper.find('input[type="email"]');
|
|
317
338
|
expect(input.exists()).toBe(true);
|
|
318
339
|
expect(input.attributes('autocomplete')).toBe('email');
|
|
@@ -348,7 +369,7 @@ describe('footer block', () => {
|
|
|
348
369
|
},
|
|
349
370
|
},
|
|
350
371
|
};
|
|
351
|
-
const wrapper = mountFooter(
|
|
372
|
+
const wrapper = mountFooter(withNewsletter, { storefront });
|
|
352
373
|
await flushPromises();
|
|
353
374
|
const input = wrapper.get('input[type="email"]');
|
|
354
375
|
expect(wrapper.get(`label[for="${input.attributes('id')}"]`).text()).toBe(
|
|
@@ -357,13 +378,13 @@ describe('footer block', () => {
|
|
|
357
378
|
});
|
|
358
379
|
|
|
359
380
|
it("shows the placeholder the form's email field carries, not its label", async () => {
|
|
360
|
-
const wrapper = mountFooter(
|
|
381
|
+
const wrapper = mountFooter(withNewsletter);
|
|
361
382
|
await flushPromises();
|
|
362
383
|
expect(wrapper.get('input[type="email"]').attributes('placeholder')).toBe('name@example.com');
|
|
363
384
|
});
|
|
364
385
|
|
|
365
386
|
it('keeps the email error in the field cell, directly under the input', async () => {
|
|
366
|
-
const wrapper = mountFooter(
|
|
387
|
+
const wrapper = mountFooter(withNewsletter);
|
|
367
388
|
await flushPromises();
|
|
368
389
|
// The field wrapper is `display: contents` by default, which turns its error into a flex item of
|
|
369
390
|
// its own that lands after the button row; a real block keeps the two together.
|
|
@@ -372,7 +393,7 @@ describe('footer block', () => {
|
|
|
372
393
|
});
|
|
373
394
|
|
|
374
395
|
it('keeps the sign-up button and its consent sentence in one column as wide as the form', async () => {
|
|
375
|
-
const wrapper = mountFooter(
|
|
396
|
+
const wrapper = mountFooter(withNewsletter);
|
|
376
397
|
await flushPromises();
|
|
377
398
|
// The library's actions row is `shrink-0` and the grid's auto column follows the sentence's
|
|
378
399
|
// max-content, so both pushed the button past the footer column; happy-dom has no layout,
|
|
@@ -385,7 +406,7 @@ describe('footer block', () => {
|
|
|
385
406
|
});
|
|
386
407
|
|
|
387
408
|
it('shows the platform consent sentence under the sign-up button, tied to it with aria-describedby', async () => {
|
|
388
|
-
const wrapper = mountFooter(
|
|
409
|
+
const wrapper = mountFooter(withNewsletter);
|
|
389
410
|
await flushPromises();
|
|
390
411
|
const sentence = wrapper.get('[data-part="consent-sentence"]');
|
|
391
412
|
expect(sentence.text()).toBe(
|
|
@@ -397,7 +418,7 @@ describe('footer block', () => {
|
|
|
397
418
|
});
|
|
398
419
|
|
|
399
420
|
it('an invalid (malformed) email submit sets aria-invalid, shows the error linked by aria-describedby, and keeps focus in the field', async () => {
|
|
400
|
-
const wrapper = mountFooter(
|
|
421
|
+
const wrapper = mountFooter(withNewsletter);
|
|
401
422
|
const input = wrapper.find('input[type="email"]');
|
|
402
423
|
await input.setValue('not-an-email');
|
|
403
424
|
await wrapper.find('form').trigger('submit');
|
|
@@ -414,7 +435,7 @@ describe('footer block', () => {
|
|
|
414
435
|
});
|
|
415
436
|
|
|
416
437
|
it('an empty submit is invalid too', async () => {
|
|
417
|
-
const wrapper = mountFooter(
|
|
438
|
+
const wrapper = mountFooter(withNewsletter);
|
|
418
439
|
await wrapper.find('form').trigger('submit');
|
|
419
440
|
await flushPromises();
|
|
420
441
|
|
|
@@ -424,7 +445,7 @@ describe('footer block', () => {
|
|
|
424
445
|
});
|
|
425
446
|
|
|
426
447
|
it('a valid submit calls forms.submit and announces success through role="status"', async () => {
|
|
427
|
-
const wrapper = mountFooter(
|
|
448
|
+
const wrapper = mountFooter(withNewsletter);
|
|
428
449
|
const input = wrapper.find('input[type="email"]');
|
|
429
450
|
await input.setValue('reader@example.com');
|
|
430
451
|
await wrapper.find('form').trigger('submit');
|
|
@@ -440,8 +461,11 @@ describe('footer block', () => {
|
|
|
440
461
|
|
|
441
462
|
it('with Turnstile on, renders the widget and honeypot, refuses to send before the check, then sends the token and honeypot', async () => {
|
|
442
463
|
const turnstile = stubTurnstile();
|
|
443
|
-
const subscribe = vi.fn(async () => ({
|
|
444
|
-
|
|
464
|
+
const subscribe = vi.fn(async () => ({
|
|
465
|
+
ok: true as const,
|
|
466
|
+
pending: false,
|
|
467
|
+
}));
|
|
468
|
+
const wrapper = mountFooter(withNewsletter, { subscribe, turnstile: true });
|
|
445
469
|
await flushPromises();
|
|
446
470
|
expect(turnstile.render).toHaveBeenCalledOnce();
|
|
447
471
|
|
|
@@ -463,7 +487,7 @@ describe('footer block', () => {
|
|
|
463
487
|
});
|
|
464
488
|
|
|
465
489
|
it('a subscribe failure (backend ok:false) shows an error and keeps focus in the field', async () => {
|
|
466
|
-
const wrapper = mountFooter(
|
|
490
|
+
const wrapper = mountFooter(withNewsletter, { failForms: true });
|
|
467
491
|
const input = wrapper.find('input[type="email"]');
|
|
468
492
|
await input.setValue('reader@example.com');
|
|
469
493
|
await wrapper.find('form').trigger('submit');
|
|
@@ -489,7 +513,7 @@ describe('footer block', () => {
|
|
|
489
513
|
{ ok: true, pending: true },
|
|
490
514
|
];
|
|
491
515
|
const subscribe = vi.fn(async () => results.shift() ?? { ok: true as const, pending: true });
|
|
492
|
-
const wrapper = mountFooter(
|
|
516
|
+
const wrapper = mountFooter(withNewsletter, { subscribe });
|
|
493
517
|
const input = wrapper.find('input[type="email"]');
|
|
494
518
|
await input.setValue('reader@example.com');
|
|
495
519
|
await wrapper.find('form').trigger('submit');
|
|
@@ -511,8 +535,13 @@ describe('footer block', () => {
|
|
|
511
535
|
});
|
|
512
536
|
|
|
513
537
|
it('a backend {ok:false, reason:"invalid"} shows the exact same invalid-email message (not the retryable one)', async () => {
|
|
514
|
-
const wrapper = mountFooter(
|
|
515
|
-
subscribe: async () => ({
|
|
538
|
+
const wrapper = mountFooter(withNewsletter, {
|
|
539
|
+
subscribe: async () => ({
|
|
540
|
+
ok: false,
|
|
541
|
+
reason: 'invalid',
|
|
542
|
+
errors: {},
|
|
543
|
+
form: [],
|
|
544
|
+
}),
|
|
516
545
|
});
|
|
517
546
|
const input = wrapper.find('input[type="email"]');
|
|
518
547
|
await input.setValue('reader@example.com');
|
|
@@ -565,7 +594,11 @@ describe('footer block', () => {
|
|
|
565
594
|
*/
|
|
566
595
|
it('renders nothing at all on a single-locale store', async () => {
|
|
567
596
|
const single = mountFooter(mock, {
|
|
568
|
-
locales: {
|
|
597
|
+
locales: {
|
|
598
|
+
active: 'en-US',
|
|
599
|
+
defaultLocale: 'en-US',
|
|
600
|
+
supported: ['en-US'],
|
|
601
|
+
},
|
|
569
602
|
});
|
|
570
603
|
expect(selectTriggers(single)).toHaveLength(0);
|
|
571
604
|
expect(single.findAll('.sr-only').map((el) => el.text())).not.toContain(
|
|
@@ -637,10 +670,14 @@ describe('footer block', () => {
|
|
|
637
670
|
* instead of a `Select`, with the same leading icon and a visually hidden "Currency" label.
|
|
638
671
|
*/
|
|
639
672
|
describe('the currency slot', () => {
|
|
640
|
-
it('renders the single store currency as plain text, not a Select,
|
|
673
|
+
it('renders the single store currency as plain text, not a Select, after a visible "Currency" label', async () => {
|
|
641
674
|
const wrapper = mountFooter(mock, {
|
|
642
675
|
locale: 'is-IS',
|
|
643
|
-
commerce: {
|
|
676
|
+
commerce: {
|
|
677
|
+
currency: 'ISK',
|
|
678
|
+
taxInclusivePricing: true,
|
|
679
|
+
defaultTaxRate: 0.24,
|
|
680
|
+
},
|
|
644
681
|
});
|
|
645
682
|
|
|
646
683
|
// No combobox at all: this store serves one locale (so no language switcher) and one
|
|
@@ -651,12 +688,13 @@ describe('footer block', () => {
|
|
|
651
688
|
expect(label).toBe('ISK kr.');
|
|
652
689
|
const currencyText = wrapper.findAll('p').find((p) => p.text().includes(label));
|
|
653
690
|
expect(currencyText).toBeTruthy();
|
|
654
|
-
expect(currencyText!.find('svg').exists()).toBe(true);
|
|
655
691
|
|
|
656
|
-
// The
|
|
657
|
-
// is `isIS`'s, not `enUS`'s.
|
|
658
|
-
|
|
659
|
-
|
|
692
|
+
// The design's "Currency USD $" line, the label written out. The content locale is
|
|
693
|
+
// Icelandic here (`locale: 'is-IS'`), so the label is `isIS`'s, not `enUS`'s.
|
|
694
|
+
expect(currencyText!.findAll('span').map((span) => span.text())).toEqual([
|
|
695
|
+
isIS.footer.currencyLabel,
|
|
696
|
+
label,
|
|
697
|
+
]);
|
|
660
698
|
|
|
661
699
|
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
662
700
|
});
|
|
@@ -675,7 +713,7 @@ describe('footer block', () => {
|
|
|
675
713
|
|
|
676
714
|
it('keyboard order: a link precedes the email field, which precedes the subscribe button, which precedes the selectors', () => {
|
|
677
715
|
// Two locales, so there is a switcher in the legal row to order the newsletter against.
|
|
678
|
-
const wrapper = mountFooter(
|
|
716
|
+
const wrapper = mountFooter(withNewsletter, { locales: twoLocales() });
|
|
679
717
|
const focusable = Array.from(
|
|
680
718
|
wrapper.element.querySelectorAll('a, input, button, select, [tabindex]')
|
|
681
719
|
);
|
|
@@ -727,7 +765,7 @@ describe('footer block', () => {
|
|
|
727
765
|
const wrapper = mountFooter(
|
|
728
766
|
{
|
|
729
767
|
...empty,
|
|
730
|
-
description:
|
|
768
|
+
description: DESCRIPTION,
|
|
731
769
|
groups: mock.groups,
|
|
732
770
|
showNewsletter: true,
|
|
733
771
|
},
|
|
@@ -735,7 +773,7 @@ describe('footer block', () => {
|
|
|
735
773
|
);
|
|
736
774
|
await flushPromises();
|
|
737
775
|
expect(wrapper.findAllComponents(EditorPlaceholder)).toHaveLength(0);
|
|
738
|
-
expect(wrapper.text()).toContain(
|
|
776
|
+
expect(wrapper.text()).toContain(DESCRIPTION);
|
|
739
777
|
expect(wrapper.find('input[type="email"]').exists()).toBe(true);
|
|
740
778
|
});
|
|
741
779
|
|
|
@@ -758,7 +796,7 @@ describe('footer block', () => {
|
|
|
758
796
|
variant: 'default',
|
|
759
797
|
background: 'surface-strong',
|
|
760
798
|
brandText: mock.brandText,
|
|
761
|
-
description:
|
|
799
|
+
description: DESCRIPTION,
|
|
762
800
|
groups: [],
|
|
763
801
|
links: [],
|
|
764
802
|
showNewsletter: false,
|
|
@@ -772,7 +810,7 @@ describe('footer block', () => {
|
|
|
772
810
|
it('renders brand and description only, with no empty column or link markup, axe-clean', async () => {
|
|
773
811
|
const wrapper = mountFooter(SEEDED);
|
|
774
812
|
expect(wrapper.text()).toContain(mock.brandText);
|
|
775
|
-
expect(wrapper.text()).toContain(
|
|
813
|
+
expect(wrapper.text()).toContain(DESCRIPTION);
|
|
776
814
|
// No link-groups `nav`, no column headings, and no social row: each part is drawn only when
|
|
777
815
|
// it has something in it, so nothing renders a heading or a list over nothing.
|
|
778
816
|
expect(wrapper.find('nav').exists()).toBe(false);
|
|
@@ -808,6 +846,63 @@ describe('footer block', () => {
|
|
|
808
846
|
});
|
|
809
847
|
});
|
|
810
848
|
|
|
849
|
+
describe('the store details', () => {
|
|
850
|
+
it('renders the address, a tel: and a mailto: link inside <address>, and the opening hours', () => {
|
|
851
|
+
const wrapper = mountFooter(mock);
|
|
852
|
+
const address = wrapper.find('address');
|
|
853
|
+
expect(address.text()).toContain(mock.address);
|
|
854
|
+
expect(address.find('a[href="tel:5550142290"]').text()).toBe(mock.phone);
|
|
855
|
+
expect(address.find(`a[href="mailto:${mock.email}"]`).text()).toBe(mock.email);
|
|
856
|
+
expect(wrapper.text()).toContain(mock.hours);
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
it('renders a phone with no digits as text, never an inert tel: link', () => {
|
|
860
|
+
const wrapper = mountFooter({ ...mock, phone: 'Ask in the shop' });
|
|
861
|
+
expect(wrapper.find('a[href^="tel:"]').exists()).toBe(false);
|
|
862
|
+
expect(wrapper.find('address').text()).toContain('Ask in the shop');
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
it('renders no <address> when none of the details is set', () => {
|
|
866
|
+
const wrapper = mountFooter({
|
|
867
|
+
...mock,
|
|
868
|
+
address: '',
|
|
869
|
+
phone: '',
|
|
870
|
+
email: '',
|
|
871
|
+
hours: '',
|
|
872
|
+
});
|
|
873
|
+
expect(wrapper.find('address').exists()).toBe(false);
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
describe('the background', () => {
|
|
878
|
+
it('is the dark primary ground when unset', () => {
|
|
879
|
+
const { background: _unset, ...rest } = mock;
|
|
880
|
+
const footer = mountFooter(rest).find('footer');
|
|
881
|
+
expect(footer.attributes('data-section')).toBe('primary');
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
it.each(['primary', 'surface-strong'])(
|
|
885
|
+
'%s renders both variants, with the newsletter on, with no axe violations',
|
|
886
|
+
async (background) => {
|
|
887
|
+
for (const variant of ['default', 'minimal']) {
|
|
888
|
+
const wrapper = mountFooter(
|
|
889
|
+
{ ...withNewsletter, background, variant },
|
|
890
|
+
{ locales: twoLocales() }
|
|
891
|
+
);
|
|
892
|
+
expect(await axe(wrapper.element)).toHaveNoViolations();
|
|
893
|
+
wrapper.unmount();
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
);
|
|
897
|
+
|
|
898
|
+
it('puts the sign-up on a light card that stops the primary inversions', () => {
|
|
899
|
+
const wrapper = mountFooter({ ...withNewsletter, background: 'primary' });
|
|
900
|
+
const card = wrapper.find('form').element.closest('[data-section="none"]');
|
|
901
|
+
expect(card).not.toBeNull();
|
|
902
|
+
expect(card!.classList.contains('bg-background')).toBe(true);
|
|
903
|
+
});
|
|
904
|
+
});
|
|
905
|
+
|
|
811
906
|
it('social link names include the store name', () => {
|
|
812
907
|
const wrapper = mountFooter(mock);
|
|
813
908
|
const instagramLink = wrapper
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apiId": "footer",
|
|
3
3
|
"name": "Footer",
|
|
4
|
-
"description": "Site footer with brand, link groups,
|
|
4
|
+
"description": "Site footer with brand, store address and hours, link groups, social links, an optional newsletter sign-up, a legal line and locale/currency selectors.",
|
|
5
5
|
"icon": "layout-bottombar",
|
|
6
6
|
"category": "structure",
|
|
7
7
|
"version": 3,
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"fieldId": "background",
|
|
69
69
|
"name": "Background",
|
|
70
70
|
"type": "select",
|
|
71
|
-
"helpText": "Defaults to \"
|
|
71
|
+
"helpText": "Defaults to \"primary\" when unset.",
|
|
72
72
|
"metadata": {
|
|
73
|
-
"options": ["
|
|
73
|
+
"options": ["primary", "surface-strong"]
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
{
|
|
@@ -98,11 +98,49 @@
|
|
|
98
98
|
"name": "Description",
|
|
99
99
|
"type": "text",
|
|
100
100
|
"localized": true,
|
|
101
|
-
"helpText": "
|
|
101
|
+
"helpText": "One short sentence under the brand. Shown on the default variant only.",
|
|
102
102
|
"validators": {
|
|
103
103
|
"maxLength": 300
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"fieldId": "address",
|
|
108
|
+
"name": "Address",
|
|
109
|
+
"type": "string",
|
|
110
|
+
"localized": true,
|
|
111
|
+
"helpText": "One line, e.g. \"14 Harbour Street, Northwind Bay\". Shown on the default variant only.",
|
|
112
|
+
"validators": {
|
|
113
|
+
"maxLength": 120
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"fieldId": "phone",
|
|
118
|
+
"name": "Phone",
|
|
119
|
+
"type": "string",
|
|
120
|
+
"helpText": "Rendered as a tel: link. Shown on the default variant only.",
|
|
121
|
+
"validators": {
|
|
122
|
+
"maxLength": 40
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"fieldId": "email",
|
|
127
|
+
"name": "Email",
|
|
128
|
+
"type": "string",
|
|
129
|
+
"helpText": "Rendered as a mailto: link. Shown on the default variant only.",
|
|
130
|
+
"validators": {
|
|
131
|
+
"maxLength": 120
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"fieldId": "hours",
|
|
136
|
+
"name": "Opening hours",
|
|
137
|
+
"type": "string",
|
|
138
|
+
"localized": true,
|
|
139
|
+
"helpText": "One line, e.g. \"Shop open Mon–Fri 10–18, Sat 10–16\". Shown on the default variant only.",
|
|
140
|
+
"validators": {
|
|
141
|
+
"maxLength": 120
|
|
142
|
+
}
|
|
143
|
+
},
|
|
106
144
|
{
|
|
107
145
|
"fieldId": "groups",
|
|
108
146
|
"name": "Link groups",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"variant": "default",
|
|
3
|
-
"background": "
|
|
3
|
+
"background": "primary",
|
|
4
4
|
"brandText": "Northwind Goods",
|
|
5
|
-
"
|
|
5
|
+
"address": "14 Harbour Street, Northwind Bay",
|
|
6
|
+
"phone": "(555) 014-2290",
|
|
7
|
+
"email": "hello@northwind.example",
|
|
8
|
+
"hours": "Shop open Mon–Fri 10–18, Sat 10–16",
|
|
6
9
|
"groups": [
|
|
7
10
|
{
|
|
8
11
|
"kind": "none",
|
|
@@ -12,17 +15,17 @@
|
|
|
12
15
|
"kind": "collection",
|
|
13
16
|
"target": {
|
|
14
17
|
"_type": "collection",
|
|
15
|
-
"slug": "
|
|
18
|
+
"slug": "ceramics"
|
|
16
19
|
},
|
|
17
|
-
"label": "
|
|
20
|
+
"label": "Ceramics"
|
|
18
21
|
},
|
|
19
22
|
{
|
|
20
23
|
"kind": "collection",
|
|
21
24
|
"target": {
|
|
22
25
|
"_type": "collection",
|
|
23
|
-
"slug": "
|
|
26
|
+
"slug": "knitwear"
|
|
24
27
|
},
|
|
25
|
-
"label": "
|
|
28
|
+
"label": "Knitwear"
|
|
26
29
|
},
|
|
27
30
|
{
|
|
28
31
|
"kind": "collection",
|
|
@@ -32,6 +35,14 @@
|
|
|
32
35
|
},
|
|
33
36
|
"label": "Kitchen"
|
|
34
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"kind": "collection",
|
|
40
|
+
"target": {
|
|
41
|
+
"_type": "collection",
|
|
42
|
+
"slug": "home"
|
|
43
|
+
},
|
|
44
|
+
"label": "Home"
|
|
45
|
+
},
|
|
35
46
|
{
|
|
36
47
|
"kind": "product",
|
|
37
48
|
"target": {
|
|
@@ -48,18 +59,18 @@
|
|
|
48
59
|
"children": [
|
|
49
60
|
{
|
|
50
61
|
"kind": "url",
|
|
51
|
-
"url": "/pages/
|
|
52
|
-
"label": "
|
|
62
|
+
"url": "/pages/delivery",
|
|
63
|
+
"label": "Delivery"
|
|
53
64
|
},
|
|
54
65
|
{
|
|
55
66
|
"kind": "url",
|
|
56
67
|
"url": "/pages/returns",
|
|
57
|
-
"label": "Returns"
|
|
68
|
+
"label": "Returns and exchanges"
|
|
58
69
|
},
|
|
59
70
|
{
|
|
60
71
|
"kind": "url",
|
|
61
|
-
"url": "/
|
|
62
|
-
"label": "
|
|
72
|
+
"url": "/pages/order-status",
|
|
73
|
+
"label": "Order status"
|
|
63
74
|
},
|
|
64
75
|
{
|
|
65
76
|
"kind": "url",
|
|
@@ -70,7 +81,7 @@
|
|
|
70
81
|
},
|
|
71
82
|
{
|
|
72
83
|
"kind": "none",
|
|
73
|
-
"label": "
|
|
84
|
+
"label": "About",
|
|
74
85
|
"children": [
|
|
75
86
|
{
|
|
76
87
|
"kind": "url",
|
|
@@ -80,17 +91,12 @@
|
|
|
80
91
|
{
|
|
81
92
|
"kind": "url",
|
|
82
93
|
"url": "/pages/makers",
|
|
83
|
-
"label": "
|
|
94
|
+
"label": "The makers"
|
|
84
95
|
},
|
|
85
96
|
{
|
|
86
97
|
"kind": "url",
|
|
87
98
|
"url": "/journal",
|
|
88
99
|
"label": "Journal"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"kind": "url",
|
|
92
|
-
"url": "/pages/visit",
|
|
93
|
-
"label": "Visit the studio"
|
|
94
100
|
}
|
|
95
101
|
]
|
|
96
102
|
}
|
|
@@ -98,8 +104,8 @@
|
|
|
98
104
|
"links": [
|
|
99
105
|
{
|
|
100
106
|
"kind": "url",
|
|
101
|
-
"url": "/pages/
|
|
102
|
-
"label": "
|
|
107
|
+
"url": "/pages/delivery",
|
|
108
|
+
"label": "Delivery"
|
|
103
109
|
},
|
|
104
110
|
{
|
|
105
111
|
"kind": "url",
|
|
@@ -117,9 +123,9 @@
|
|
|
117
123
|
"label": "Our story"
|
|
118
124
|
}
|
|
119
125
|
],
|
|
120
|
-
"showNewsletter":
|
|
126
|
+
"showNewsletter": false,
|
|
121
127
|
"newsletterTitle": "Letters from the workshop",
|
|
122
|
-
"newsletterText": "New pieces
|
|
128
|
+
"newsletterText": "New pieces and small-batch restocks, once a month.",
|
|
123
129
|
"social": [
|
|
124
130
|
{
|
|
125
131
|
"network": "instagram",
|
|
@@ -130,12 +136,8 @@
|
|
|
130
136
|
"href": "https://pinterest.com/northwindgoods"
|
|
131
137
|
},
|
|
132
138
|
{
|
|
133
|
-
"network": "
|
|
134
|
-
"href": "https://
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"network": "youtube",
|
|
138
|
-
"href": "https://youtube.com/@northwindgoods"
|
|
139
|
+
"network": "facebook",
|
|
140
|
+
"href": "https://facebook.com/northwindgoods"
|
|
139
141
|
}
|
|
140
142
|
],
|
|
141
143
|
"legalText": "© 2026 Northwind Goods",
|
|
@@ -148,12 +150,7 @@
|
|
|
148
150
|
{
|
|
149
151
|
"kind": "url",
|
|
150
152
|
"url": "/pages/terms",
|
|
151
|
-
"label": "Terms"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"kind": "url",
|
|
155
|
-
"url": "/pages/accessibility",
|
|
156
|
-
"label": "Accessibility"
|
|
153
|
+
"label": "Terms of sale"
|
|
157
154
|
}
|
|
158
155
|
],
|
|
159
156
|
"showLocale": true,
|
|
Binary file
|
|
Binary file
|
|
@@ -4,60 +4,60 @@
|
|
|
4
4
|
"caption": "Bowls drying before their first firing",
|
|
5
5
|
"image": {
|
|
6
6
|
"assetId": "demo-gallery-1",
|
|
7
|
-
"url": "/
|
|
8
|
-
"altText": "
|
|
9
|
-
"width":
|
|
10
|
-
"height":
|
|
7
|
+
"url": "/images/vase.webp",
|
|
8
|
+
"altText": "A slim ceramic vase with a single stem",
|
|
9
|
+
"width": 835,
|
|
10
|
+
"height": 1400
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"caption": "The Fell crew in oatmeal merino",
|
|
15
15
|
"image": {
|
|
16
16
|
"assetId": "demo-gallery-2",
|
|
17
|
-
"url": "/
|
|
18
|
-
"altText": "
|
|
19
|
-
"width":
|
|
20
|
-
"height":
|
|
17
|
+
"url": "/images/mug.webp",
|
|
18
|
+
"altText": "A hand-painted stoneware mug",
|
|
19
|
+
"width": 1400,
|
|
20
|
+
"height": 934
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"caption": "Fjord mug, kiln batch FJ-26-09",
|
|
25
25
|
"image": {
|
|
26
26
|
"assetId": "demo-gallery-3",
|
|
27
|
-
"url": "/
|
|
28
|
-
"altText": "
|
|
29
|
-
"width":
|
|
30
|
-
"height":
|
|
27
|
+
"url": "/images/cup.webp",
|
|
28
|
+
"altText": "A teal mug on a gingham cloth",
|
|
29
|
+
"width": 1400,
|
|
30
|
+
"height": 952
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"caption": "Sage linen napkins, woven in Porto",
|
|
35
35
|
"image": {
|
|
36
36
|
"assetId": "demo-gallery-4",
|
|
37
|
-
"url": "/
|
|
38
|
-
"altText": "
|
|
39
|
-
"width":
|
|
40
|
-
"height":
|
|
37
|
+
"url": "/images/coffee-table.webp",
|
|
38
|
+
"altText": "A polka-dot mug of coffee with biscuits",
|
|
39
|
+
"width": 1400,
|
|
40
|
+
"height": 933
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"caption": "Glaze buckets, mixed by hand each Monday",
|
|
45
45
|
"image": {
|
|
46
46
|
"assetId": "demo-gallery-5",
|
|
47
|
-
"url": "/
|
|
48
|
-
"altText": "
|
|
49
|
-
"width":
|
|
50
|
-
"height":
|
|
47
|
+
"url": "/images/terracotta.webp",
|
|
48
|
+
"altText": "Handmade terracotta bowls and jugs",
|
|
49
|
+
"width": 1400,
|
|
50
|
+
"height": 933
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"caption": "Slate plates on a winter table",
|
|
55
55
|
"image": {
|
|
56
56
|
"assetId": "demo-gallery-6",
|
|
57
|
-
"url": "/
|
|
58
|
-
"altText": "
|
|
59
|
-
"width":
|
|
60
|
-
"height":
|
|
57
|
+
"url": "/images/planters.webp",
|
|
58
|
+
"altText": "Ceramic planters with green plants",
|
|
59
|
+
"width": 932,
|
|
60
|
+
"height": 1400
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
]
|
|
Binary file
|