@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.
- package/CHANGELOG.md +3 -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 +82 -58
- package/template/blocks/collection-header/__tests__/Block.spec.ts +77 -1
- 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 +623 -184
- package/template/blocks/navigation/__tests__/Block.spec.ts +416 -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/previewParity.browser.spec.ts +36 -2
- package/template/test/starter.spec.ts +31 -15
- package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
- 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
|
|
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
|
-
*
|
|
116
|
-
*
|
|
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
|
|
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(
|
|
126
|
+
expect(box.height).toBeLessThanOrEqual(18);
|
|
128
127
|
} finally {
|
|
129
128
|
await page.close();
|
|
130
129
|
}
|
|
131
130
|
});
|
|
132
131
|
|
|
133
132
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
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
|
|
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(
|
|
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
|
|
154
|
-
// prefixed exactly once by the two rules together.
|
|
155
|
-
expect(internal).toContain('/is-IS/collections/
|
|
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"`.
|
|
221
|
-
// Icelandic here, which is itself part of the rule under test one layer
|
|
222
|
-
|
|
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', '
|
|
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(
|
|
48
|
-
|
|
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
|
-
'
|
|
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
|
-
|
|
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, {
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
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, {
|
|
187
|
+
const wrapper = await mountPageWithSkipLink(page, {
|
|
188
|
+
storefront: categoryStorefront(),
|
|
189
|
+
});
|
|
167
190
|
await flushPromises();
|
|
168
191
|
wrappers.push(wrapper);
|
|
169
192
|
expectPageLandmarks(wrapper);
|