@eldrajs/theme-cli 0.2.8 → 0.2.10

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 (165) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/package.json +1 -1
  3. package/template/.eldra/block-types.d.ts +28 -7
  4. package/template/.eldra/manifest.json +1034 -355
  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 +82 -58
  25. package/template/blocks/collection-header/__tests__/Block.spec.ts +77 -1
  26. package/template/blocks/collection-header/preview.json +4 -4
  27. package/template/blocks/collection-header/preview.png +0 -0
  28. package/template/blocks/contact/preview.png +0 -0
  29. package/template/blocks/cta/preview.json +4 -4
  30. package/template/blocks/cta/preview.png +0 -0
  31. package/template/blocks/faq/preview.png +0 -0
  32. package/template/blocks/feature-grid/Block.vue +73 -4
  33. package/template/blocks/feature-grid/__tests__/Block.spec.ts +43 -1
  34. package/template/blocks/feature-grid/block.json +2 -2
  35. package/template/blocks/feature-grid/preview.json +49 -24
  36. package/template/blocks/feature-grid/preview.png +0 -0
  37. package/template/blocks/footer/Block.vue +186 -71
  38. package/template/blocks/footer/__tests__/Block.spec.ts +127 -32
  39. package/template/blocks/footer/block.json +42 -4
  40. package/template/blocks/footer/mock.json +31 -34
  41. package/template/blocks/footer/preview.png +0 -0
  42. package/template/blocks/form/preview.png +0 -0
  43. package/template/blocks/gallery/preview.json +24 -24
  44. package/template/blocks/gallery/preview.png +0 -0
  45. package/template/blocks/hero/Block.vue +117 -19
  46. package/template/blocks/hero/__tests__/Block.spec.ts +46 -0
  47. package/template/blocks/hero/block.json +36 -1
  48. package/template/blocks/hero/preview.json +33 -25
  49. package/template/blocks/hero/preview.png +0 -0
  50. package/template/blocks/image/preview.json +4 -4
  51. package/template/blocks/image/preview.png +0 -0
  52. package/template/blocks/logo-cloud/preview.png +0 -0
  53. package/template/blocks/navigation/Block.vue +623 -184
  54. package/template/blocks/navigation/__tests__/Block.spec.ts +416 -68
  55. package/template/blocks/navigation/__tests__/fixtures/menu.json +182 -0
  56. package/template/blocks/navigation/block.json +102 -6
  57. package/template/blocks/navigation/mock.json +279 -52
  58. package/template/blocks/navigation/preview.json +311 -0
  59. package/template/blocks/navigation/preview.png +0 -0
  60. package/template/blocks/newsletter/Block.vue +248 -144
  61. package/template/blocks/newsletter/__tests__/Block.spec.ts +42 -0
  62. package/template/blocks/newsletter/block.json +61 -2
  63. package/template/blocks/newsletter/preview.json +35 -0
  64. package/template/blocks/newsletter/preview.png +0 -0
  65. package/template/blocks/order-status/preview.png +0 -0
  66. package/template/blocks/pricing-table/preview.png +0 -0
  67. package/template/blocks/product-carousel/Block.vue +272 -26
  68. package/template/blocks/product-carousel/__tests__/Block.spec.ts +90 -0
  69. package/template/blocks/product-carousel/block.json +61 -0
  70. package/template/blocks/product-carousel/preview.json +12 -0
  71. package/template/blocks/product-carousel/preview.png +0 -0
  72. package/template/blocks/product-detail/Block.vue +148 -96
  73. package/template/blocks/product-detail/__tests__/Block.spec.ts +98 -74
  74. package/template/blocks/product-detail/block.json +11 -4
  75. package/template/blocks/product-detail/mock.json +53 -22
  76. package/template/blocks/product-detail/parts/Gallery.vue +52 -103
  77. package/template/blocks/product-detail/preview.png +0 -0
  78. package/template/blocks/quote/preview.png +0 -0
  79. package/template/blocks/rich-text/preview.png +0 -0
  80. package/template/blocks/search/Block.vue +1 -0
  81. package/template/blocks/search/TypeSection.vue +1 -0
  82. package/template/blocks/search/__tests__/Block.spec.ts +23 -0
  83. package/template/blocks/search/preview.png +0 -0
  84. package/template/blocks/split-content/Block.vue +98 -20
  85. package/template/blocks/split-content/__tests__/Block.spec.ts +57 -18
  86. package/template/blocks/split-content/block.json +72 -6
  87. package/template/blocks/split-content/preview.json +34 -13
  88. package/template/blocks/split-content/preview.png +0 -0
  89. package/template/blocks/stats/preview.png +0 -0
  90. package/template/blocks/tabs/preview.json +16 -16
  91. package/template/blocks/tabs/preview.png +0 -0
  92. package/template/blocks/team/preview.png +0 -0
  93. package/template/blocks/testimonials/preview.png +0 -0
  94. package/template/blocks/timeline/preview.png +0 -0
  95. package/template/blocks/trust-strip/Block.vue +67 -1
  96. package/template/blocks/trust-strip/__tests__/Block.spec.ts +30 -1
  97. package/template/blocks/trust-strip/block.json +4 -4
  98. package/template/blocks/trust-strip/preview.json +21 -0
  99. package/template/blocks/trust-strip/preview.png +0 -0
  100. package/template/blocks/video-embed/preview.png +0 -0
  101. package/template/blocks/wishlist/preview.png +0 -0
  102. package/template/i18n/en-US.json +16 -9
  103. package/template/i18n/is-IS.json +16 -9
  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/clay-hands.webp +0 -0
  115. package/template/public/images/coffee-table.webp +0 -0
  116. package/template/public/images/cup.webp +0 -0
  117. package/template/public/images/enamel-cups.webp +0 -0
  118. package/template/public/images/hero.webp +0 -0
  119. package/template/public/images/kitchen.webp +0 -0
  120. package/template/public/images/mug.webp +0 -0
  121. package/template/public/images/northwind-mark.svg +1 -0
  122. package/template/public/images/planters.webp +0 -0
  123. package/template/public/images/plates.webp +0 -0
  124. package/template/public/images/reading.webp +0 -0
  125. package/template/public/images/sweater.webp +0 -0
  126. package/template/public/images/terracotta.webp +0 -0
  127. package/template/public/images/throws.webp +0 -0
  128. package/template/public/images/vase.webp +0 -0
  129. package/template/public/images/wheel.webp +0 -0
  130. package/template/public/images/yarn-tools.webp +0 -0
  131. package/template/public/images/yarn.webp +0 -0
  132. package/template/stories/generated/collection-grid.stories.ts +6 -0
  133. package/template/stories/generated/feature-grid.stories.ts +6 -0
  134. package/template/stories/generated/footer.stories.ts +4 -4
  135. package/template/stories/generated/hero.stories.ts +6 -0
  136. package/template/stories/generated/navigation.stories.ts +14 -1
  137. package/template/stories/generated/newsletter.stories.ts +2 -1
  138. package/template/stories/generated/product-carousel.stories.ts +12 -0
  139. package/template/stories/generated/split-content.stories.ts +12 -0
  140. package/template/stories/generated/trust-strip.stories.ts +8 -1
  141. package/template/stories/pages/article.stories.ts +2 -1
  142. package/template/stories/pages/cart.stories.ts +2 -1
  143. package/template/stories/pages/category.stories.ts +2 -1
  144. package/template/stories/pages/collection.stories.ts +2 -1
  145. package/template/stories/pages/home.stories.ts +2 -1
  146. package/template/stories/pages/product.stories.ts +2 -1
  147. package/template/stories/pages/products.stories.ts +2 -1
  148. package/template/stories/pages/search.stories.ts +2 -1
  149. package/template/stories/pages/wishlist.stories.ts +2 -1
  150. package/template/stories/support/demoChrome.ts +32 -0
  151. package/template/stories/support/pageBlocks.ts +2 -4
  152. package/template/test/countPill.browser.spec.ts +21 -13
  153. package/template/test/localePrefix.spec.ts +11 -6
  154. package/template/test/pages/article.spec.ts +1 -1
  155. package/template/test/pages/category.spec.ts +34 -11
  156. package/template/test/pages/collection.spec.ts +182 -148
  157. package/template/test/pages/home.spec.ts +35 -40
  158. package/template/test/pages/hydration.spec.ts +4 -4
  159. package/template/test/pages/product.spec.ts +17 -14
  160. package/template/test/pages/seededPages.spec.ts +11 -6
  161. package/template/test/prerenderRefresh.browser.spec.ts +36 -15
  162. package/template/test/previewParity.browser.spec.ts +36 -2
  163. package/template/test/starter.spec.ts +31 -15
  164. package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
  165. package/template/tokens.json +13 -13
@@ -5,6 +5,7 @@ import EldraRouterLink from '../../app/components/EldraRouterLink.vue';
5
5
  import { useI18n } from 'vue-i18n';
6
6
  import page from '../../pages/products.page.json';
7
7
  import { renderPageFixtureRegions, type PageFixture } from '../support/pageBlocks';
8
+ import { withDemoChrome } from '../support/demoChrome';
8
9
 
9
10
  const fixture = page as unknown as PageFixture;
10
11
 
@@ -41,7 +42,7 @@ const ProductsPage = defineComponent({
41
42
  },
42
43
  () => t('nav.skipToContent')
43
44
  ),
44
- ...renderPageFixtureRegions(fixture, 'Pages/Products story'),
45
+ ...renderPageFixtureRegions(withDemoChrome(fixture), 'Pages/Products story'),
45
46
  ];
46
47
  },
47
48
  });
@@ -5,6 +5,7 @@ import EldraRouterLink from '../../app/components/EldraRouterLink.vue';
5
5
  import { useI18n } from 'vue-i18n';
6
6
  import page from '../../pages/search.page.json';
7
7
  import { renderPageFixtureRegions, type PageFixture } from '../support/pageBlocks';
8
+ import { withDemoChrome } from '../support/demoChrome';
8
9
 
9
10
  const fixture = page as unknown as PageFixture;
10
11
 
@@ -37,7 +38,7 @@ const SearchPage = defineComponent({
37
38
  },
38
39
  () => t('nav.skipToContent')
39
40
  ),
40
- ...renderPageFixtureRegions(fixture, 'Pages/Search story'),
41
+ ...renderPageFixtureRegions(withDemoChrome(fixture), 'Pages/Search story'),
41
42
  ];
42
43
  },
43
44
  });
@@ -5,6 +5,7 @@ import EldraRouterLink from '../../app/components/EldraRouterLink.vue';
5
5
  import { useI18n } from 'vue-i18n';
6
6
  import page from '../../pages/wishlist.page.json';
7
7
  import { renderPageFixtureRegions, type PageFixture } from '../support/pageBlocks';
8
+ import { withDemoChrome } from '../support/demoChrome';
8
9
 
9
10
  const fixture = page as unknown as PageFixture;
10
11
 
@@ -36,7 +37,7 @@ const WishlistPage = defineComponent({
36
37
  },
37
38
  () => t('nav.skipToContent')
38
39
  ),
39
- ...renderPageFixtureRegions(fixture, 'Pages/Wishlist story'),
40
+ ...renderPageFixtureRegions(withDemoChrome(fixture), 'Pages/Wishlist story'),
40
41
  ];
41
42
  },
42
43
  });
@@ -0,0 +1,32 @@
1
+ import navigationMock from '../../blocks/navigation/mock.json';
2
+ import navigationPreview from '../../blocks/navigation/preview.json';
3
+ import footerMock from '../../blocks/footer/mock.json';
4
+ import type { PageFixture } from './pageBlocks';
5
+
6
+ /**
7
+ * A page fixture with the header and footer filled in from their blocks' own demo data, for the
8
+ * page **stories** only.
9
+ *
10
+ * The fixtures in `pages/*.page.json` are what a deploy seeds, so their header and footer carry no
11
+ * destinations and nothing about a particular store (no menu, no footer link groups, no opening
12
+ * hours or phone number): a fresh organisation would otherwise start with links to pages it does
13
+ * not have and promises it never made (`test/starter.spec.ts`, "seeds a header and footer with no
14
+ * destinations at all"). A page story is a picture of the theme, not of a fresh organisation, so it
15
+ * shows the menu, info strip and store details an author fills in Studio — taken from each block's
16
+ * `mock.json` and `preview.json`, the same data its own block story shows. The page specs mount the
17
+ * fixture as it is.
18
+ */
19
+ const DEMO_CHROME: Record<string, Record<string, unknown>> = {
20
+ navigation: { ...navigationMock, ...navigationPreview },
21
+ footer: { ...footerMock },
22
+ };
23
+
24
+ export function withDemoChrome(fixture: PageFixture): PageFixture {
25
+ return {
26
+ ...fixture,
27
+ blocks: fixture.blocks.map((block) => {
28
+ const demo = DEMO_CHROME[block.apiId];
29
+ return demo === undefined ? block : { ...block, data: { ...block.data, ...demo } };
30
+ }),
31
+ };
32
+ }
@@ -23,7 +23,6 @@ import { partitionPageBlocks } from '../../app/utils/pageStructure';
23
23
  // Extend it by adding one import + one entry per block a new page fixture introduces, and drop
24
24
  // an entry when the last fixture that named it stops doing so: an entry no fixture uses still
25
25
  // pulls that block into every page spec's and page story's bundle.
26
- import Announcement from '../../blocks/announcement-bar/Block.vue';
27
26
  import Article from '../../blocks/article/Block.vue';
28
27
  import ArticleList from '../../blocks/article-list/Block.vue';
29
28
  import Breadcrumbs from '../../blocks/breadcrumbs/Block.vue';
@@ -32,6 +31,7 @@ import CollectionGrid from '../../blocks/collection-grid/Block.vue';
32
31
  import CollectionHeader from '../../blocks/collection-header/Block.vue';
33
32
  import Cta from '../../blocks/cta/Block.vue';
34
33
  import Faq from '../../blocks/faq/Block.vue';
34
+ import FeatureGrid from '../../blocks/feature-grid/Block.vue';
35
35
  import Footer from '../../blocks/footer/Block.vue';
36
36
  import Hero from '../../blocks/hero/Block.vue';
37
37
  import Navigation from '../../blocks/navigation/Block.vue';
@@ -40,12 +40,10 @@ import ProductCarousel from '../../blocks/product-carousel/Block.vue';
40
40
  import ProductDetail from '../../blocks/product-detail/Block.vue';
41
41
  import Search from '../../blocks/search/Block.vue';
42
42
  import SplitContent from '../../blocks/split-content/Block.vue';
43
- import Testimonials from '../../blocks/testimonials/Block.vue';
44
43
  import TrustStrip from '../../blocks/trust-strip/Block.vue';
45
44
  import Wishlist from '../../blocks/wishlist/Block.vue';
46
45
 
47
46
  export const pageBlockComponents: Record<string, Component> = {
48
- 'announcement-bar': Announcement,
49
47
  article: Article,
50
48
  'article-list': ArticleList,
51
49
  breadcrumbs: Breadcrumbs,
@@ -54,6 +52,7 @@ export const pageBlockComponents: Record<string, Component> = {
54
52
  'collection-header': CollectionHeader,
55
53
  cta: Cta,
56
54
  faq: Faq,
55
+ 'feature-grid': FeatureGrid,
57
56
  footer: Footer,
58
57
  hero: Hero,
59
58
  navigation: Navigation,
@@ -62,7 +61,6 @@ export const pageBlockComponents: Record<string, Component> = {
62
61
  'product-detail': ProductDetail,
63
62
  search: Search,
64
63
  'split-content': SplitContent,
65
- testimonials: Testimonials,
66
64
  'trust-strip': TrustStrip,
67
65
  wishlist: Wishlist,
68
66
  };
@@ -18,7 +18,7 @@ import { createDemoStorefront } from '../app/storefront/demo';
18
18
  * `blocks/navigation/__tests__/Block.spec.ts` proves the pill carries the operator's corner-badge
19
19
  * classes (`COUNT_PILL_CLASSES` in `Block.vue`) — `min-h-3.5`/`min-w-3.5`/`h-3.5`, `-top-0.5
20
20
  * -right-0.5`, no ring. That is a class-name assertion, in jsdom, which computes no layout at all —
21
- * it cannot see whether those classes actually resolve to a 14px-tall box sitting on the icon's own
21
+ * it cannot see whether those classes actually resolve to an 18px-tall box sitting on the icon's own
22
22
  * corner once the theme's real Tailwind build and a real browser's box model are both in the loop,
23
23
  * which is exactly the gap two reported defects in a row lived in: first a pill that read as too
24
24
  * large next to the icon (fixed by shrinking it to spec), then — worse — a pill that, once moved onto
@@ -112,11 +112,10 @@ describe('the header cart count pill, in a real browser at 1440px', () => {
112
112
  });
113
113
 
114
114
  /**
115
- * A corner badge is at most 14px tall — that is the
116
- * whole point of shrinking it off the spec's 1.25rem minimum. The width floor comes along for
117
- * free from `min-w-3.5`.
115
+ * The Northwind design's corner badge is 1.125rem (18px) tall — never `Badge`'s own 1.5rem
116
+ * minimum. The width floor comes along for free from `min-w-[1.125rem]`.
118
117
  */
119
- it('comes out at most 14px tall with one item', async () => {
118
+ it('comes out at most 18px tall with one item', async () => {
120
119
  const html = await renderHeaderWithCartCount(1);
121
120
  const page = await pageFor(html);
122
121
  try {
@@ -124,18 +123,17 @@ describe('the header cart count pill, in a real browser at 1440px', () => {
124
123
  expect((await pill.textContent())?.trim()).toBe('1');
125
124
  const box = await pill.boundingBox();
126
125
  if (box === null) throw new Error('the pill never laid out');
127
- expect(box.height).toBeLessThanOrEqual(14);
126
+ expect(box.height).toBeLessThanOrEqual(18);
128
127
  } finally {
129
128
  await page.close();
130
129
  }
131
130
  });
132
131
 
133
132
  /**
134
- * The defect this change actually fixes: a pill moved onto the icon's own corner that then
135
- * covered almost the whole glyph. Measured against the real `<svg>` the bag icon renders (not an
136
- * assumed box), the pill's footprint must land mostly on the button's own padding — at most a
137
- * quarter of the icon's area — so the icon stays recognisable with a badge sitting on its
138
- * corner, not a badge sitting on top of it.
133
+ * A pill moved onto the icon's own corner must not cover the glyph. Measured against the real
134
+ * `<svg>` the bag tool renders (not an assumed box), the pill's footprint must land mostly beside
135
+ * the icon — at most a quarter of its area — so the icon stays recognisable with a badge sitting
136
+ * on its corner, not a badge sitting on top of it.
139
137
  */
140
138
  it('overlaps the bag icon by at most a quarter of its area, with no ring left behind', async () => {
141
139
  const html = await renderHeaderWithCartCount(1);
@@ -146,7 +144,7 @@ describe('the header cart count pill, in a real browser at 1440px', () => {
146
144
  if (pillBox === null) throw new Error('the pill never laid out');
147
145
 
148
146
  // The bag's own icon: the leading-icon slot's `<svg>` inside the same wrapper the pill is a
149
- // sibling of (`<span class="relative inline-flex"><Button>…<svg/></Button><Badge/></span>`).
147
+ // sibling of (`<span class="relative inline-flex"><Button>…<svg/>Cart</Button><Badge/></span>`).
150
148
  const iconBox = await pill.evaluate((el): Rect | null => {
151
149
  const svg = el.parentElement?.querySelector('[data-part="leadingIcon"] svg');
152
150
  if (svg === null || svg === undefined) return null;
@@ -159,6 +157,16 @@ describe('the header cart count pill, in a real browser at 1440px', () => {
159
157
  const iconArea = iconBox.width * iconBox.height;
160
158
  expect(overlap / iconArea).toBeLessThanOrEqual(0.25);
161
159
 
160
+ // And the tool's printed label ("Cart") under the icon stays clear of it.
161
+ const labelBox = await pill.evaluate((el): Rect | null => {
162
+ const label = el.parentElement?.querySelector('[data-part="label"]');
163
+ if (label === null || label === undefined) return null;
164
+ const rect = label.getBoundingClientRect();
165
+ return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
166
+ });
167
+ if (labelBox === null) throw new Error('the bag tool has no visible label');
168
+ expect(intersectionArea(pillBox, labelBox)).toBe(0);
169
+
162
170
  // The ring the earlier version carried (`ring-2 ring-background`) painted as a box-shadow;
163
171
  // a corner badge sitting on the icon must carry none, since a ring's job is separating a
164
172
  // pill from what sits beside it, and this pill sits deliberately on top of the icon.
@@ -188,7 +196,7 @@ describe('the header cart count pill, in a real browser at 1440px', () => {
188
196
  expect(overflow.scrollHeight).toBeLessThanOrEqual(overflow.clientHeight);
189
197
  const box = await pill.boundingBox();
190
198
  if (box === null) throw new Error('the pill never laid out');
191
- expect(box.height).toBeLessThanOrEqual(14);
199
+ expect(box.height).toBeLessThanOrEqual(18);
192
200
  } finally {
193
201
  await page.close();
194
202
  }
@@ -150,9 +150,10 @@ describe('the header’s own destinations', () => {
150
150
  // the shell claims the drawer — which is exactly the prerendered state a static host serves.
151
151
  expect(internal).toContain('/is-IS/wishlist');
152
152
  expect(internal).toContain('/is-IS/cart');
153
- // And the author's own navigation row, resolved through `useEldraLink()` and then routed —
154
- // prefixed exactly once by the two rules together.
155
- expect(internal).toContain('/is-IS/collections/knitwear');
153
+ // And the author's own navigation rows, resolved through `useEldraLink()` and then routed —
154
+ // prefixed exactly once by the two rules together: a catalog row and a path row.
155
+ expect(internal).toContain('/is-IS/collections/mugs-cups');
156
+ expect(internal).toContain('/is-IS/categories/knitwear');
156
157
  for (const href of internal) {
157
158
  expect(href, href).toMatch(/^\/is-IS(\/|$|\?)/);
158
159
  }
@@ -217,9 +218,13 @@ describe('the header’s search', () => {
217
218
  it('submits the overlay’s form into the active locale, and offers its rows there', async () => {
218
219
  const wrapper = mountHeader(navigationMock as Record<string, unknown>);
219
220
  try {
220
- // The search trigger, not the menu drawer's: both are `aria-haspopup="dialog"`. Its label is
221
- // Icelandic here, which is itself part of the rule under test one layer up.
222
- await wrapper.get(`button[aria-label="${isIS.header.search}"]`).trigger('click');
221
+ // The search trigger, not the menu drawer's: both are `aria-haspopup="dialog"`. It is named
222
+ // by its visible label, Icelandic here, which is itself part of the rule under test one layer
223
+ // up. (The seed's `field` style also draws the "search the shop" pill, from 80rem.)
224
+ const trigger = wrapper
225
+ .findAll('button')
226
+ .find((button) => button.text().trim() === isIS.header.search);
227
+ await trigger!.trigger('click');
223
228
  await nextTick();
224
229
 
225
230
  // 1. The native submit path.
@@ -44,7 +44,7 @@ describe('article sample page', () => {
44
44
  // adjacent-background collapse rule, so the block after each one keeps its own top padding),
45
45
  // so both carry no attribute at all.
46
46
  const grounds = children.map((el) => el.getAttribute('data-section-bg'));
47
- expect(grounds).toEqual([null, null, 'none', 'none', 'surface', 'surface-strong']);
47
+ expect(grounds).toEqual([null, null, 'none', 'none', 'surface', 'primary']);
48
48
  });
49
49
 
50
50
  it("keeps the article's full top padding after breadcrumbs (breadcrumbs takes no part in the adjacent-background collapse rule)", async () => {
@@ -44,8 +44,14 @@ function categoryStorefront(categoryPath: string | undefined = CATEGORY_PATH) {
44
44
  return createDemoStorefront({ categoryPath });
45
45
  }
46
46
 
47
- async function mountCategoryPage(categoryPath?: string): Promise<VueWrapper> {
48
- const wrapper = await mountPage(page, { storefront: categoryStorefront(categoryPath) });
47
+ async function mountCategoryPage(
48
+ categoryPath?: string,
49
+ options: { attachTo?: Element } = {}
50
+ ): Promise<VueWrapper> {
51
+ const wrapper = await mountPage(page, {
52
+ storefront: categoryStorefront(categoryPath),
53
+ attachTo: options.attachTo,
54
+ });
49
55
  await flushPromises();
50
56
  wrappers.push(wrapper);
51
57
  return wrapper;
@@ -72,7 +78,7 @@ describe('category sample page', () => {
72
78
  null,
73
79
  'none',
74
80
  'none',
75
- 'surface-strong',
81
+ 'primary',
76
82
  ]);
77
83
  });
78
84
 
@@ -127,7 +133,10 @@ describe('category sample page', () => {
127
133
  * already in the category.
128
134
  */
129
135
  it('lists the category’s own products and offers its children as the category filter', async () => {
130
- const wrapper = await mountCategoryPage('home');
136
+ // Attached: the filter bar's group popover teleports its panel to `document.body`.
137
+ const wrapper = await mountCategoryPage('home', {
138
+ attachTo: document.body,
139
+ });
131
140
  const grid = pageBlockRoots(wrapper)[3]!;
132
141
  const cards = grid.querySelectorAll('[data-eldra-product-card], article');
133
142
  expect(cards.length).toBeGreaterThan(0);
@@ -137,7 +146,9 @@ describe('category sample page', () => {
137
146
  // count the grid quotes is the subtree's rather than the store's.
138
147
  const gridText = grid.textContent ?? '';
139
148
  expect(gridText).not.toContain('Merino crew sweater');
140
- const wholeStore = await mountPage(page, { storefront: createDemoStorefront({}) });
149
+ const wholeStore = await mountPage(page, {
150
+ storefront: createDemoStorefront({}),
151
+ });
141
152
  await flushPromises();
142
153
  wrappers.push(wholeStore);
143
154
  const unscopedText = pageBlockRoots(wholeStore)[3]!.textContent ?? '';
@@ -147,11 +158,21 @@ describe('category sample page', () => {
147
158
  // the catalogue — the editor hint's own state. Either way it must not quote the subtree's count.
148
159
  expect(countOf(unscopedText)).not.toBe(countOf(gridText));
149
160
 
150
- const legends = Array.from(grid.querySelectorAll('legend')).map((el) => el.textContent);
151
- expect(legends).toContain('Category');
152
- const categoryPanel = Array.from(grid.querySelectorAll('fieldset')).find(
153
- (set) => set.querySelector('legend')?.textContent === 'Category'
154
- )!;
161
+ // `filter-bar`: the group is a chip in the bar that opens its panel in a popover (teleported,
162
+ // rendered only while open), so it is found by its trigger rather than by a legend in the grid.
163
+ const bar = grid.querySelector('[role="group"][aria-label="Filter and sort"]')!;
164
+ expect(bar).not.toBeNull();
165
+ const triggers = Array.from(
166
+ bar.querySelectorAll<HTMLButtonElement>('button[aria-haspopup="dialog"]')
167
+ );
168
+ expect(triggers.map((button) => button.textContent?.trim())).toContain('Category');
169
+ const categoryTrigger = triggers.find((button) => button.textContent?.trim() === 'Category')!;
170
+ categoryTrigger.click();
171
+ await flushPromises();
172
+ await new Promise((resolve) => setTimeout(resolve, 0));
173
+ const categoryPanel = document.getElementById(categoryTrigger.getAttribute('aria-controls')!)!;
174
+ expect(categoryPanel).not.toBeNull();
175
+ expect(categoryPanel.getAttribute('aria-label')).toBe('Category');
155
176
  const labels = Array.from(categoryPanel.querySelectorAll('label')).map((el) =>
156
177
  (el.textContent ?? '').trim()
157
178
  );
@@ -163,7 +184,9 @@ describe('category sample page', () => {
163
184
  });
164
185
 
165
186
  it('declares the three landmark regions and lands the skip link after the header', async () => {
166
- const wrapper = await mountPageWithSkipLink(page, { storefront: categoryStorefront() });
187
+ const wrapper = await mountPageWithSkipLink(page, {
188
+ storefront: categoryStorefront(),
189
+ });
167
190
  await flushPromises();
168
191
  wrappers.push(wrapper);
169
192
  expectPageLandmarks(wrapper);