@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
@@ -1,9 +1,9 @@
1
1
  // @vitest-environment jsdom
2
2
  //
3
- // The product sample page (`pages/product.page.json`): announcement bar, header, breadcrumbs,
4
- // the product-detail buy box for "Merino crew sweater", a related-products carousel, an FAQ and
5
- // the footer, rendered together through `mountPage` exactly as `app/pages/[...slug].vue` renders
6
- // a real page: the leading structure blocks (announcement bar + header) before `<main id="main">`,
3
+ // The product sample page (`pages/product.page.json`): header, breadcrumbs, the product-detail
4
+ // buy box for "Merino crew sweater", a related-products carousel, an FAQ and the footer, rendered
5
+ // together through `mountPage` exactly as `app/pages/[...slug].vue` renders a real page: the
6
+ // leading structure block (the header, which carries its own info strip) before `<main id="main">`,
7
7
  // everything else inside it, the footer after it — see `app/utils/pageStructure.ts`.
8
8
  //
9
9
  // Carousel counts are read off the real demo storefront (`app/storefront/demo.ts`), not assumed:
@@ -45,13 +45,14 @@ async function mountProductPage() {
45
45
  * drawer — the seeded header has nothing to put in one, so it draws neither the Menu button nor the
46
46
  * drawer (see `withAuthoredHeaderLink`). */
47
47
  async function mountProductPageWithHeaderLink() {
48
- return mountPage(withAuthoredHeaderLink(fixture), { attachTo: document.body });
48
+ return mountPage(withAuthoredHeaderLink(fixture), {
49
+ attachTo: document.body,
50
+ });
49
51
  }
50
52
 
51
53
  describe('product sample page', () => {
52
54
  it('is composed of exactly the fixture blocks, in the documented order', () => {
53
55
  expect(fixture.blocks.map((b) => b.apiId)).toEqual([
54
- 'announcement-bar',
55
56
  'navigation',
56
57
  'breadcrumbs',
57
58
  'product-detail',
@@ -70,7 +71,6 @@ describe('product sample page', () => {
70
71
  // `test/support/mountPage.spec.ts`'s own html.indexOf pattern).
71
72
  const html = wrapper.html();
72
73
  const markers = [
73
- 'Free shipping on orders over $80', // announcement-bar
74
74
  'data-eldra-header-focus', // navigation
75
75
  'aria-label="Breadcrumb"', // breadcrumbs
76
76
  'aria-label="Product images"', // product-detail (gallery)
@@ -173,11 +173,11 @@ describe('product sample page', () => {
173
173
 
174
174
  it('shares the same ground across product-detail, the carousel and the FAQ, with only the footer changing it', async () => {
175
175
  const wrapper = await mountProductPage();
176
- const [, , , productDetail, carousel, faq, footer] = pageBlockRoots(wrapper);
176
+ const [, , productDetail, carousel, faq, footer] = pageBlockRoots(wrapper);
177
177
  expect(productDetail!.getAttribute('data-section-bg')).toBe('none');
178
178
  expect(carousel!.getAttribute('data-section-bg')).toBe('none');
179
179
  expect(faq!.getAttribute('data-section-bg')).toBe('none');
180
- expect(footer!.getAttribute('data-section-bg')).toBe('surface-strong');
180
+ expect(footer!.getAttribute('data-section-bg')).toBe('primary');
181
181
  // Adjacency (not just value) is what the package's CSS rule keys off:
182
182
  expect(productDetail!.nextElementSibling).toBe(carousel);
183
183
  expect(carousel!.nextElementSibling).toBe(faq);
@@ -217,7 +217,7 @@ describe('product sample page', () => {
217
217
  describe('modals', () => {
218
218
  it('menu drawer: opens as a dialog and Esc returns focus to the menu button', async () => {
219
219
  const wrapper = await mountProductPageWithHeaderLink();
220
- const menuButton = wrapper.get('button[aria-label="Open menu"]');
220
+ const menuButton = wrapper.get('button[aria-label="Menu"]');
221
221
  menuButton.element.focus();
222
222
  await menuButton.trigger('click');
223
223
  const dialog = wrapper.get('dialog[open]');
@@ -234,7 +234,10 @@ describe('product sample page', () => {
234
234
 
235
235
  it('search: opens as a dialog and Esc returns focus to the search button', async () => {
236
236
  const wrapper = await mountProductPage();
237
- const searchButton = wrapper.get('button[aria-label="Search"]');
237
+ // The labelled Search tool, named by its visible label.
238
+ const searchButton = wrapper
239
+ .findAll('button')
240
+ .find((button) => button.text().trim() === 'Search')!;
238
241
  searchButton.element.focus();
239
242
  await searchButton.trigger('click');
240
243
  expect(wrapper.findAll('dialog[open]').length).toBeGreaterThan(0);
@@ -248,9 +251,9 @@ describe('product sample page', () => {
248
251
  wrapper.unmount();
249
252
  });
250
253
 
251
- it('lightbox: opens from zoom and Esc returns focus to the zoom button', async () => {
254
+ it('lightbox: opens from a mosaic tile and Esc returns focus to that tile', async () => {
252
255
  const wrapper = await mountProductPage();
253
- const zoomButton = wrapper.get('button[aria-haspopup="dialog"][aria-label^="Zoom image"]');
256
+ const zoomButton = wrapper.get('button[aria-haspopup="dialog"][aria-label^="Open image"]');
254
257
  zoomButton.element.focus();
255
258
  await zoomButton.trigger('click');
256
259
  const dialog = wrapper.get('dialog[aria-label="Merino crew sweater, images"]');
@@ -312,7 +315,7 @@ describe('product sample page', () => {
312
315
  });
313
316
 
314
317
  it('exposes exactly one banner, one main and one contentinfo landmark', async () => {
315
- // The announcement bar and header render before `<main id="main">` and the footer after it
318
+ // The header renders before `<main id="main">` and the footer after it
316
319
  // (`app/utils/pageStructure.ts`), which is the only way `<header>`/`<footer>` map to the
317
320
  // `banner`/`contentinfo` roles at all.
318
321
  const wrapper = await mountProductPage();
@@ -5,7 +5,7 @@
5
5
  // (`pages/{cart,wishlist,search,products}.page.json`, `app/templates.ts`'s `starterPages()`).
6
6
  //
7
7
  // One spec for all three rather than three near-identical files: they are the same page by design —
8
- // announcement bar, the shared header, breadcrumbs, the one block the page exists for, a
8
+ // the shared header (which carries its own info strip), breadcrumbs, the one block the page exists for, a
9
9
  // recently-viewed carousel, the shared footer — and what each of them is *for* is the block in the
10
10
  // middle. The per-page table below is the whole difference.
11
11
  //
@@ -86,7 +86,6 @@ const PAGES: SeededPage[] = [
86
86
 
87
87
  function expectedApiIds(page: SeededPage): string[] {
88
88
  return [
89
- 'announcement-bar',
90
89
  'navigation',
91
90
  'breadcrumbs',
92
91
  ...(page.above === undefined ? [] : [page.above]),
@@ -111,10 +110,13 @@ describe.each(PAGES)('the seeded $slug page', (page) => {
111
110
 
112
111
  const roots = pageBlockRoots(wrapper);
113
112
  expect(roots).toHaveLength(expectedApiIds(page).length);
114
- expect(roots[1]!.tagName).toBe('HEADER');
113
+ // Indexed off the expected order rather than literal positions, so a block added or removed
114
+ // ahead of them cannot silently point these at the wrong root.
115
+ const ids = expectedApiIds(page);
116
+ expect(roots[ids.indexOf('navigation')]!.tagName).toBe('HEADER');
115
117
  expect(roots.at(-1)!.tagName).toBe('FOOTER');
116
118
  // Breadcrumbs stays inside `<main>`: it renders a `<nav>`, a landmark wherever it sits.
117
- expect(roots[2]!.querySelector('nav[aria-label]')).not.toBeNull();
119
+ expect(roots[ids.indexOf('breadcrumbs')]!.querySelector('nav[aria-label]')).not.toBeNull();
118
120
  });
119
121
 
120
122
  it('has exactly one h1, and it is the block that owns the page’s title', async () => {
@@ -153,7 +155,7 @@ describe('the page seeds built from those fixtures', () => {
153
155
  for (const [index, seed] of seeds.entries()) {
154
156
  const page = PAGES[index]!;
155
157
  expect(seed.title).toBe(page.title);
156
- // The announcement bar precedes the header, exactly as the fixture has it: a region is a
158
+ // The header leads, exactly as the fixture has it: a region is a
157
159
  // placement in the page's own order, not a frame around it.
158
160
  expect(
159
161
  seed.blocks.map((entry) => ('role' in entry ? `@${entry.role}` : entry.apiId))
@@ -171,7 +173,10 @@ describe('the page seeds built from those fixtures', () => {
171
173
  (entry) => 'required' in entry && entry.required === true
172
174
  );
173
175
  expect(required).toHaveLength(1);
174
- expect(required[0]).toMatchObject({ apiId: PAGES[index]!.fixed, required: true });
176
+ expect(required[0]).toMatchObject({
177
+ apiId: PAGES[index]!.fixed,
178
+ required: true,
179
+ });
175
180
  }
176
181
  });
177
182
 
@@ -111,10 +111,11 @@ describe('a prerendered route whose resolution failed', () => {
111
111
  it('fails the build over it, rather than exiting 0 with the page missing', () => {
112
112
  // `nitro.prerender.failOnError` (`nuxt.config.ts`) is the half that makes the *absence* loud:
113
113
  // without it the generate still exits 0 and an artifact with a hole in its catalogue is
114
- // deployable. The route itself is named in the prerender list Nitro prints, which is on the
115
- // build's console rather than in what `nuxi generate` hands back here.
114
+ // deployable. Nitro 2.14 (Nuxt 4.7) names each failed route in the output, with its status.
116
115
  expect(generated.exitCode).not.toBe(0);
117
- expect(`${generated.stdout}\n${generated.stderr}`).toContain('prerender errors');
116
+ const printed = `${generated.stdout}\n${generated.stderr}`;
117
+ expect(printed).toMatch(/Failed to prerender \d+ routes?/);
118
+ expect(printed).toContain('/collections/the-winter-edit (500 Eldra route resolution failed)');
118
119
  });
119
120
 
120
121
  it('still writes every route the gateway could answer', () => {
@@ -314,7 +314,7 @@ interface GridState {
314
314
  const GRID_SECTION = 'section[aria-label="The winter edit products"]';
315
315
 
316
316
  function readGrid(page: Page): Promise<GridState> {
317
- return page.evaluate((selector) => {
317
+ return page.evaluate(async (selector) => {
318
318
  const section = document.querySelector(selector);
319
319
  // `aria-labelledby`, not any `ul`: that is the grid's own card list. The active-filter chips
320
320
  // are a `ul[aria-label]` in the same section, and they only exist once something is filtered.
@@ -324,9 +324,24 @@ function readGrid(page: Page): Promise<GridState> {
324
324
  const status = [...(section?.querySelectorAll('p[role="status"]') ?? [])]
325
325
  .map((node) => (node as HTMLElement).textContent?.trim() ?? '')
326
326
  .filter((text) => text !== '');
327
- const price = [...(section?.querySelectorAll('aside [role="slider"]') ?? [])].map(
328
- (thumb) => thumb.getAttribute('aria-valuenow') ?? ''
329
- );
327
+ const thumbs = (root: ParentNode | null): string[] =>
328
+ [...(root?.querySelectorAll('[role="slider"]') ?? [])].map(
329
+ (thumb) => thumb.getAttribute('aria-valuenow') ?? ''
330
+ );
331
+ // The sidebar shows its price thumbs all the time. The filter bar (the collection page's
332
+ // variant) keeps them in the Price chip's popover, which only renders while it is open, so the
333
+ // chip is opened to read them and closed again.
334
+ let price = thumbs(section?.querySelector('aside') ?? null);
335
+ const priceChip = [
336
+ ...(section?.querySelectorAll('[role="group"] button[aria-controls]') ?? []),
337
+ ].find((button) => (button.textContent ?? '').trim().startsWith('Price'));
338
+ if (price.length === 0 && priceChip instanceof HTMLElement) {
339
+ priceChip.click();
340
+ await new Promise((resolve) => setTimeout(resolve, 300));
341
+ price = thumbs(document.getElementById(priceChip.getAttribute('aria-controls') ?? ''));
342
+ priceChip.click();
343
+ await new Promise((resolve) => setTimeout(resolve, 100));
344
+ }
330
345
  return { titles, count: status[0] ?? '', price };
331
346
  }, GRID_SECTION);
332
347
  }
@@ -674,8 +689,8 @@ describe('prerendered commerce data on the generated static site', () => {
674
689
  // case would keep passing while quietly testing nothing.
675
690
  expect(visited.url).toBe(`${statics.origin}${productPage}/`);
676
691
  const instances = blockInstances(visited);
677
- // The page's own seven, plus the shell's hosted cart drawer (see the control above).
678
- expect(Object.keys(instances.created).length).toBe(8);
692
+ // The page's own six, plus the shell's hosted cart drawer (see the control above).
693
+ expect(Object.keys(instances.created).length).toBe(7);
679
694
  // The page is served at `/products/ash-glaze-mug/` and prerendered at
680
695
  // `/products/ash-glaze-mug` (`startStaticServer`'s 308 is the deployed host's). Nuxt therefore
681
696
  // re-navigates between the two while the page hydrates, and unless the route key and the page
@@ -731,11 +746,12 @@ describe('prerendered commerce data on the generated static site', () => {
731
746
  }
732
747
  });
733
748
 
734
- it("opens a mega-menu that spans the header's container, whichever item opened it", async () => {
749
+ it("opens a mega-menu that spans the header, its columns in the bar's container, whichever item opened it", async () => {
735
750
  // Geometry only a real browser can answer. The panel used to be pinned to the item that
736
751
  // opened it at a width of its own, so where it started and stopped depended on which word in
737
- // the bar the visitor happened to hover. It now spans the bar's own container: its left edge
738
- // on the brand's, its right edge on the actions', and its top on the bar's bottom edge.
752
+ // the bar the visitor happened to hover. It is now a full-bleed sheet: its edges on the
753
+ // header's, its top on the bar's bottom edge, and its content inside the bar's own container —
754
+ // the first column on the brand's left edge, the "View all" on the actions' right edge.
739
755
  const page = await browser.newPage({ viewport: { width: 1280, height: 900 } });
740
756
  try {
741
757
  await page.goto(`${statics.origin}${HOME_PAGE_PATH}`, { waitUntil: 'domcontentloaded' });
@@ -782,17 +798,17 @@ describe('prerendered commerce data on the generated static site', () => {
782
798
  };
783
799
  }, panelId ?? '');
784
800
 
785
- expect(Math.round(edges.panel.left)).toBe(Math.round(edges.brand.left));
786
- expect(Math.round(edges.panel.right)).toBe(Math.round(edges.actions.right));
801
+ expect(Math.round(edges.panel.left)).toBe(Math.round(edges.bar.left));
802
+ expect(Math.round(edges.panel.right)).toBe(Math.round(edges.bar.right));
803
+ expect(Math.abs(edges.firstColumn.left - edges.brand.left)).toBeLessThanOrEqual(1);
804
+ expect(Math.abs(edges.viewAll.right - edges.actions.right)).toBeLessThanOrEqual(1);
787
805
  // Directly below the bar — within the bar's own 1px bottom border.
788
806
  expect(Math.abs(edges.panel.top - edges.bar.bottom)).toBeLessThanOrEqual(2);
789
807
  // And the premise: the trigger is nowhere near either edge, so "spans the container" is a
790
808
  // real claim rather than a coincidence of where this item sits.
791
809
  expect(edges.trigger.left).toBeGreaterThan(edges.panel.left + 1);
792
810
  expect(edges.trigger.right).toBeLessThan(edges.panel.right - 1);
793
- // And the inset the operator asked for: nothing inside the panel sits flush against its
794
- // edges. 24px is the narrow-container figure; the wide container's own 32px clears it too,
795
- // so one bound holds at every width this page is measured at.
811
+ // And nothing inside the panel sits flush against its edges: the page's own gutters at least.
796
812
  expect(edges.firstColumn.left).toBeGreaterThanOrEqual(edges.panel.left + 24);
797
813
  expect(edges.viewAll.right).toBeLessThanOrEqual(edges.panel.right - 24);
798
814
  } finally {
@@ -952,8 +968,10 @@ describe('prerendered commerce data on the generated static site', () => {
952
968
  // The height the spacer's *classes* alone reserve — all the first paint of a prerendered
953
969
  // page has, before the bar has been measured at all — against the bar's own box for those
954
970
  // same classes. A difference here is a page that jumps on hydration.
971
+ // The bar's box is the spacer's last child; an info strip, when the header has one,
972
+ // reserves its own box before it.
955
973
  reserved:
956
- spacer === null ? null : spacer.firstElementChild!.getBoundingClientRect().height,
974
+ spacer === null ? null : spacer.lastElementChild!.getBoundingClientRect().height,
957
975
  nav: element.querySelector('[data-eldra-header-bar]')!.getBoundingClientRect().height,
958
976
  wrapper: wrapper === null ? null : wrapper.getBoundingClientRect().height,
959
977
  };
@@ -1011,6 +1029,9 @@ describe('prerendered commerce data on the generated static site', () => {
1011
1029
  'storefront:catalog.category:[null]',
1012
1030
  'storefront:catalog.collectionProducts:[null,{"page":1,"pageSize":8}]',
1013
1031
  'storefront:catalog.product:["ash-glaze-mug"]',
1032
+ // `product-carousel`'s quick-add read, keyed `null` until a shopper presses Quick add: no
1033
+ // request and no data, in the payload because it exists, like the category read above.
1034
+ 'storefront:catalog.product:[null]',
1014
1035
  'storefront:catalog.related:["ash-glaze-mug",8]',
1015
1036
  // The footer's sign-up spam guard (`useFormSpam`): a footer with no newsletter zone names no
1016
1037
  // form, so the read is keyed `""`, resolves `null` without a request and is in the payload