@eldrajs/theme-cli 0.2.7 → 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.
Files changed (169) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/package.json +3 -3
  3. package/template/.eldra/block-types.d.ts +28 -7
  4. package/template/.eldra/manifest.json +1152 -445
  5. package/template/.eldra/previews.json +35 -35
  6. package/template/README.md +32 -0
  7. package/template/app/assets/main.css +23 -0
  8. package/template/app/plugins/eldra-storefront.ts +3 -0
  9. package/template/app/storefront/demo.ts +75 -24
  10. package/template/app/storefront/gateway.ts +16 -2
  11. package/template/blocks/announcement-bar/preview.png +0 -0
  12. package/template/blocks/article/preview.json +4 -4
  13. package/template/blocks/article/preview.png +0 -0
  14. package/template/blocks/article-list/Block.vue +48 -19
  15. package/template/blocks/article-list/__tests__/Block.spec.ts +15 -0
  16. package/template/blocks/article-list/preview.json +43 -43
  17. package/template/blocks/article-list/preview.png +0 -0
  18. package/template/blocks/breadcrumbs/preview.png +0 -0
  19. package/template/blocks/cart/preview.png +0 -0
  20. package/template/blocks/collection-grid/Block.vue +260 -9
  21. package/template/blocks/collection-grid/__tests__/Block.spec.ts +202 -0
  22. package/template/blocks/collection-grid/block.json +3 -3
  23. package/template/blocks/collection-grid/preview.png +0 -0
  24. package/template/blocks/collection-header/Block.vue +65 -52
  25. package/template/blocks/collection-header/preview.json +4 -4
  26. package/template/blocks/collection-header/preview.png +0 -0
  27. package/template/blocks/contact/preview.png +0 -0
  28. package/template/blocks/cta/preview.json +4 -4
  29. package/template/blocks/cta/preview.png +0 -0
  30. package/template/blocks/faq/preview.png +0 -0
  31. package/template/blocks/feature-grid/Block.vue +73 -4
  32. package/template/blocks/feature-grid/__tests__/Block.spec.ts +43 -1
  33. package/template/blocks/feature-grid/block.json +2 -2
  34. package/template/blocks/feature-grid/preview.json +49 -24
  35. package/template/blocks/feature-grid/preview.png +0 -0
  36. package/template/blocks/footer/Block.vue +186 -71
  37. package/template/blocks/footer/__tests__/Block.spec.ts +127 -32
  38. package/template/blocks/footer/block.json +42 -4
  39. package/template/blocks/footer/mock.json +31 -34
  40. package/template/blocks/footer/preview.png +0 -0
  41. package/template/blocks/form/preview.png +0 -0
  42. package/template/blocks/gallery/preview.json +24 -24
  43. package/template/blocks/gallery/preview.png +0 -0
  44. package/template/blocks/hero/Block.vue +117 -19
  45. package/template/blocks/hero/__tests__/Block.spec.ts +46 -0
  46. package/template/blocks/hero/block.json +36 -1
  47. package/template/blocks/hero/preview.json +33 -25
  48. package/template/blocks/hero/preview.png +0 -0
  49. package/template/blocks/image/preview.json +4 -4
  50. package/template/blocks/image/preview.png +0 -0
  51. package/template/blocks/logo-cloud/preview.png +0 -0
  52. package/template/blocks/navigation/Block.vue +665 -184
  53. package/template/blocks/navigation/__tests__/Block.spec.ts +496 -75
  54. package/template/blocks/navigation/__tests__/fixtures/menu.json +182 -0
  55. package/template/blocks/navigation/block.json +110 -6
  56. package/template/blocks/navigation/mock.json +372 -140
  57. package/template/blocks/navigation/preview.json +311 -0
  58. package/template/blocks/navigation/preview.png +0 -0
  59. package/template/blocks/newsletter/Block.vue +248 -144
  60. package/template/blocks/newsletter/__tests__/Block.spec.ts +42 -0
  61. package/template/blocks/newsletter/block.json +61 -2
  62. package/template/blocks/newsletter/preview.json +35 -0
  63. package/template/blocks/newsletter/preview.png +0 -0
  64. package/template/blocks/order-status/preview.png +0 -0
  65. package/template/blocks/pricing-table/preview.png +0 -0
  66. package/template/blocks/product-carousel/Block.vue +272 -26
  67. package/template/blocks/product-carousel/__tests__/Block.spec.ts +90 -0
  68. package/template/blocks/product-carousel/block.json +61 -0
  69. package/template/blocks/product-carousel/preview.json +12 -0
  70. package/template/blocks/product-carousel/preview.png +0 -0
  71. package/template/blocks/product-detail/Block.vue +148 -96
  72. package/template/blocks/product-detail/__tests__/Block.spec.ts +98 -74
  73. package/template/blocks/product-detail/block.json +11 -4
  74. package/template/blocks/product-detail/mock.json +53 -22
  75. package/template/blocks/product-detail/parts/Gallery.vue +52 -103
  76. package/template/blocks/product-detail/preview.png +0 -0
  77. package/template/blocks/quote/preview.png +0 -0
  78. package/template/blocks/rich-text/preview.png +0 -0
  79. package/template/blocks/search/Block.vue +1 -0
  80. package/template/blocks/search/TypeSection.vue +1 -0
  81. package/template/blocks/search/__tests__/Block.spec.ts +23 -0
  82. package/template/blocks/search/preview.png +0 -0
  83. package/template/blocks/split-content/Block.vue +98 -20
  84. package/template/blocks/split-content/__tests__/Block.spec.ts +57 -18
  85. package/template/blocks/split-content/block.json +72 -6
  86. package/template/blocks/split-content/preview.json +34 -13
  87. package/template/blocks/split-content/preview.png +0 -0
  88. package/template/blocks/stats/preview.png +0 -0
  89. package/template/blocks/tabs/preview.json +16 -16
  90. package/template/blocks/tabs/preview.png +0 -0
  91. package/template/blocks/team/preview.png +0 -0
  92. package/template/blocks/testimonials/preview.png +0 -0
  93. package/template/blocks/timeline/preview.png +0 -0
  94. package/template/blocks/trust-strip/Block.vue +67 -1
  95. package/template/blocks/trust-strip/__tests__/Block.spec.ts +30 -1
  96. package/template/blocks/trust-strip/block.json +4 -4
  97. package/template/blocks/trust-strip/preview.json +21 -0
  98. package/template/blocks/trust-strip/preview.png +0 -0
  99. package/template/blocks/video-embed/preview.png +0 -0
  100. package/template/blocks/wishlist/preview.png +0 -0
  101. package/template/i18n/en-US.json +16 -9
  102. package/template/i18n/is-IS.json +16 -9
  103. package/template/package.json +1 -1
  104. package/template/pages/article.page.json +19 -18
  105. package/template/pages/cart.page.json +3 -13
  106. package/template/pages/category.page.json +15 -7
  107. package/template/pages/collection.page.json +15 -14
  108. package/template/pages/home.page.json +217 -182
  109. package/template/pages/product.page.json +46 -36
  110. package/template/pages/products.page.json +3 -13
  111. package/template/pages/search.page.json +3 -13
  112. package/template/pages/wishlist.page.json +3 -13
  113. package/template/public/images/CREDITS.md +28 -0
  114. package/template/public/images/bowl.webp +0 -0
  115. package/template/public/images/clay-hands.webp +0 -0
  116. package/template/public/images/coffee-table.webp +0 -0
  117. package/template/public/images/cup.webp +0 -0
  118. package/template/public/images/enamel-cups.webp +0 -0
  119. package/template/public/images/hero.webp +0 -0
  120. package/template/public/images/kitchen.webp +0 -0
  121. package/template/public/images/mug.webp +0 -0
  122. package/template/public/images/northwind-mark.svg +1 -0
  123. package/template/public/images/planters.webp +0 -0
  124. package/template/public/images/plates.webp +0 -0
  125. package/template/public/images/reading.webp +0 -0
  126. package/template/public/images/sweater.webp +0 -0
  127. package/template/public/images/terracotta.webp +0 -0
  128. package/template/public/images/throws.webp +0 -0
  129. package/template/public/images/vase.webp +0 -0
  130. package/template/public/images/wheel.webp +0 -0
  131. package/template/public/images/yarn-tools.webp +0 -0
  132. package/template/public/images/yarn.webp +0 -0
  133. package/template/stories/generated/collection-grid.stories.ts +6 -0
  134. package/template/stories/generated/feature-grid.stories.ts +6 -0
  135. package/template/stories/generated/footer.stories.ts +4 -4
  136. package/template/stories/generated/hero.stories.ts +6 -0
  137. package/template/stories/generated/navigation.stories.ts +14 -1
  138. package/template/stories/generated/newsletter.stories.ts +2 -1
  139. package/template/stories/generated/product-carousel.stories.ts +12 -0
  140. package/template/stories/generated/split-content.stories.ts +12 -0
  141. package/template/stories/generated/trust-strip.stories.ts +8 -1
  142. package/template/stories/pages/article.stories.ts +2 -1
  143. package/template/stories/pages/cart.stories.ts +2 -1
  144. package/template/stories/pages/category.stories.ts +2 -1
  145. package/template/stories/pages/collection.stories.ts +2 -1
  146. package/template/stories/pages/home.stories.ts +2 -1
  147. package/template/stories/pages/product.stories.ts +2 -1
  148. package/template/stories/pages/products.stories.ts +2 -1
  149. package/template/stories/pages/search.stories.ts +2 -1
  150. package/template/stories/pages/wishlist.stories.ts +2 -1
  151. package/template/stories/support/demoChrome.ts +32 -0
  152. package/template/stories/support/pageBlocks.ts +2 -4
  153. package/template/test/countPill.browser.spec.ts +21 -13
  154. package/template/test/localePrefix.spec.ts +11 -6
  155. package/template/test/pages/article.spec.ts +1 -1
  156. package/template/test/pages/category.spec.ts +34 -11
  157. package/template/test/pages/collection.spec.ts +182 -148
  158. package/template/test/pages/home.spec.ts +35 -40
  159. package/template/test/pages/hydration.spec.ts +4 -4
  160. package/template/test/pages/product.spec.ts +17 -14
  161. package/template/test/pages/seededPages.spec.ts +11 -6
  162. package/template/test/prerenderFailure.spec.ts +4 -3
  163. package/template/test/prerenderRefresh.browser.spec.ts +36 -15
  164. package/template/test/previewParity.browser.spec.ts +1152 -0
  165. package/template/test/starter.spec.ts +37 -16
  166. package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
  167. package/template/test/support/previewParity.ts +302 -0
  168. package/template/test/support/previewParityContent.ts +726 -0
  169. package/template/tokens.json +13 -13
@@ -44,7 +44,11 @@ const TEMPLATES = [
44
44
  },
45
45
  {
46
46
  id: 'rt-product',
47
- data: { schemaApiId: 'catalog:product', routePattern: '/products/:slug', slugField: 'slug' },
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 { ...demo, forms: { ...demo.forms, submit: options.subscribe! } };
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.description);
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
- { kind: 'collection', target: { _type: 'collection', id: 'id-gone' }, label: 'Gone' },
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(mock);
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(mock, { storefront });
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(mock);
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(mock);
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(mock);
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(mock);
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(mock);
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(mock);
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(mock);
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 () => ({ ok: true as const, pending: false }));
444
- const wrapper = mountFooter(mock, { subscribe, turnstile: true });
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(mock, { failForms: true });
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(mock, { subscribe });
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(mock, {
515
- subscribe: async () => ({ ok: false, reason: 'invalid', errors: {}, form: [] }),
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: { active: 'en-US', defaultLocale: 'en-US', supported: ['en-US'] },
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, with its leading icon and a visually hidden label', async () => {
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: { currency: 'ISK', taxInclusivePricing: true, defaultTaxRate: 0.24 },
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 content locale is Icelandic here (`locale: 'is-IS'`), so the visually hidden label
657
- // is `isIS`'s, not `enUS`'s.
658
- const hiddenLabels = wrapper.findAll('.eldra\\:sr-only').map((el) => el.text());
659
- expect(hiddenLabels).toContain(isIS.footer.currencyLabel);
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(mock, { locales: twoLocales() });
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: mock.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(mock.description);
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: mock.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(mock.description);
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, a newsletter sign-up, social links, a legal line and locale/currency selectors.",
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 \"surface-strong\" when unset.",
71
+ "helpText": "Defaults to \"primary\" when unset.",
72
72
  "metadata": {
73
- "options": ["surface-strong", "primary"]
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": "1–3 sentences. Shown on the default variant only.",
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": "surface-strong",
3
+ "background": "primary",
4
4
  "brandText": "Northwind Goods",
5
- "description": "Knitwear, ceramics and kitchen goods from small workshops, made to be used every day. Studio and shop in Portland, Oregon.",
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": "knitwear"
18
+ "slug": "ceramics"
16
19
  },
17
- "label": "Knitwear"
20
+ "label": "Ceramics"
18
21
  },
19
22
  {
20
23
  "kind": "collection",
21
24
  "target": {
22
25
  "_type": "collection",
23
- "slug": "ceramics"
26
+ "slug": "knitwear"
24
27
  },
25
- "label": "Ceramics"
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/shipping",
52
- "label": "Shipping"
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": "/journal/care",
62
- "label": "Care guides"
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": "Company",
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": "Makers"
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/shipping",
102
- "label": "Shipping"
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": true,
126
+ "showNewsletter": false,
121
127
  "newsletterTitle": "Letters from the workshop",
122
- "newsletterText": "New pieces, maker stories and the occasional early sale. Once a month.",
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": "tiktok",
134
- "href": "https://tiktok.com/@northwindgoods"
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": "/demo/gallery-1.svg",
8
- "altText": "Wheel-thrown bowls drying on a wooden studio shelf",
9
- "width": 1600,
10
- "height": 1000
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": "/demo/gallery-2.svg",
18
- "altText": "Oatmeal merino crew sweater folded on a linen throw",
19
- "width": 1600,
20
- "height": 1000
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": "/demo/gallery-3.svg",
28
- "altText": "Blue-grey Fjord mug of coffee on a windowsill",
29
- "width": 1600,
30
- "height": 1000
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": "/demo/gallery-4.svg",
38
- "altText": "Stack of sage linen napkins with a wooden spoon",
39
- "width": 1600,
40
- "height": 1000
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": "/demo/gallery-5.svg",
48
- "altText": "Buckets of mixed glaze lined up on the studio floor",
49
- "width": 1600,
50
- "height": 1000
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": "/demo/gallery-6.svg",
58
- "altText": "Evening table set with dark Slate plates and candles",
59
- "width": 1600,
60
- "height": 1000
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