@eldrajs/theme-cli 0.2.9 → 0.2.11
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 +12 -1
- package/package.json +3 -3
- package/template/.eldra/block-types.d.ts +4 -6
- package/template/.eldra/manifest.json +228 -246
- package/template/.eldra/previews.json +35 -35
- package/template/.storybook/eldra.ts +7 -2
- package/template/app/assets/main.css +5 -0
- package/template/app/composables/useBlockData.ts +9 -2
- package/template/app/composables/usePriceTokens.ts +150 -0
- package/template/app/composables/useQuickAdd.ts +95 -0
- package/template/app/composables/useRegionalFormat.ts +94 -0
- package/template/app/icons.ts +4 -0
- package/template/app/plugins/eldra-storefront.ts +2 -0
- package/template/app/plugins/eldra-ui-messages.ts +22 -8
- package/template/app/storefront/demo.ts +188 -16
- package/template/app/storefront/gateway.ts +19 -0
- package/template/app/storefront/productCardLook.ts +76 -0
- package/template/app/storefront/productReference.ts +17 -0
- package/template/app/storefront/toProductCard.ts +12 -8
- package/template/app/storefront/types.ts +17 -0
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +19 -7
- package/template/blocks/announcement-bar/block.json +2 -1
- package/template/blocks/announcement-bar/mock.json +1 -1
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/Block.vue +8 -18
- package/template/blocks/article/block.json +3 -1
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/block.json +10 -1
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/Block.vue +15 -3
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +13 -0
- package/template/blocks/breadcrumbs/block.json +1 -0
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/Block.vue +15 -5
- package/template/blocks/cart/__tests__/Block.spec.ts +53 -10
- package/template/blocks/cart/__tests__/ShippingBar.spec.ts +10 -8
- package/template/blocks/cart/block.json +8 -5
- package/template/blocks/cart/mock.json +2 -2
- package/template/blocks/cart/parts/ShippingBar.vue +24 -30
- package/template/blocks/cart/parts/notSold.ts +4 -3
- package/template/blocks/collection-grid/Block.vue +168 -85
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +101 -23
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +51 -17
- package/template/blocks/collection-header/__tests__/Block.spec.ts +80 -4
- package/template/blocks/collection-header/block.json +2 -0
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/block.json +4 -0
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/block.json +2 -0
- package/template/blocks/faq/Block.vue +5 -10
- package/template/blocks/faq/block.json +2 -1
- package/template/blocks/faq/mock.json +12 -1
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +30 -7
- package/template/blocks/feature-grid/block.json +3 -2
- package/template/blocks/feature-grid/mock.json +1 -1
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +64 -21
- package/template/blocks/footer/__tests__/Block.spec.ts +97 -1
- package/template/blocks/footer/block.json +5 -2
- package/template/blocks/footer/mock.json +1 -1
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/form/block.json +1 -0
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +38 -9
- package/template/blocks/hero/__tests__/Block.spec.ts +71 -19
- package/template/blocks/hero/block.json +16 -22
- package/template/blocks/hero/preview.json +1 -3
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/block.json +2 -1
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/block.json +1 -0
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +405 -159
- package/template/blocks/navigation/__tests__/Block.spec.ts +816 -172
- package/template/blocks/navigation/__tests__/currentItem.spec.ts +90 -0
- package/template/blocks/navigation/block.json +2 -11
- package/template/blocks/navigation/mock.json +3 -3
- package/template/blocks/navigation/parts/LocalePicker.vue +103 -0
- package/template/blocks/navigation/parts/currentItem.ts +82 -0
- package/template/blocks/navigation/preview.json +7 -1
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/newsletter/Block.vue +6 -2
- package/template/blocks/newsletter/block.json +2 -0
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/Block.vue +8 -17
- package/template/blocks/order-status/block.json +3 -0
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +12 -4
- package/template/blocks/pricing-table/block.json +2 -0
- package/template/blocks/pricing-table/mock.json +6 -6
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +36 -126
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +88 -0
- package/template/blocks/product-carousel/block.json +1 -0
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +84 -31
- package/template/blocks/product-detail/__tests__/Block.spec.ts +86 -0
- package/template/blocks/product-detail/__tests__/specs.spec.ts +79 -0
- package/template/blocks/product-detail/block.json +3 -1
- package/template/blocks/product-detail/mock.json +54 -4
- package/template/blocks/product-detail/parts/Gallery.vue +8 -2
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/product-detail/specs.ts +75 -0
- package/template/blocks/quote/block.json +1 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +6 -1
- package/template/blocks/search/TypeSection.vue +8 -1
- package/template/blocks/search/__tests__/Block.spec.ts +24 -1
- package/template/blocks/search/block.json +1 -0
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/split-content/Block.vue +12 -5
- package/template/blocks/split-content/__tests__/Block.spec.ts +13 -0
- package/template/blocks/split-content/block.json +4 -2
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/Block.vue +3 -4
- package/template/blocks/tabs/block.json +1 -1
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/block.json +3 -1
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/block.json +2 -0
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/block.json +2 -1
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +2 -2
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +38 -9
- package/template/blocks/trust-strip/block.json +1 -1
- package/template/blocks/trust-strip/mock.json +1 -1
- package/template/blocks/trust-strip/preview.json +1 -1
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/block.json +2 -0
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/Block.vue +2 -2
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +13 -5
- package/template/i18n/is-IS.json +12 -4
- package/template/pages/article.page.json +1 -3
- package/template/pages/cart.page.json +1 -3
- package/template/pages/category.page.json +2 -4
- package/template/pages/collection.page.json +1 -3
- package/template/pages/home.page.json +7 -18
- package/template/pages/product.page.json +62 -131
- package/template/pages/products.page.json +1 -3
- package/template/pages/search.page.json +1 -3
- package/template/pages/wishlist.page.json +1 -3
- package/template/stories/generated/footer.stories.ts +6 -0
- package/template/stories/generated/navigation.stories.ts +0 -18
- package/template/test/inlineEditable.spec.ts +10 -2
- package/template/test/localePrefix.spec.ts +2 -19
- package/template/test/pages/article.spec.ts +0 -2
- package/template/test/pages/category.spec.ts +35 -13
- package/template/test/pages/home.spec.ts +33 -17
- package/template/test/pages/product.spec.ts +64 -44
- package/template/test/pages/ssr.spec.ts +3 -1
- package/template/test/prerenderRefresh.browser.spec.ts +30 -25
- package/template/test/previewParity.browser.spec.ts +36 -2
- package/template/test/priceTokens.spec.ts +309 -0
- package/template/test/regionalFormat.spec.ts +80 -0
- package/template/test/starter.spec.ts +23 -7
- package/template/test/storefront/demo.spec.ts +19 -18
- package/template/test/storefront/toProductCard.spec.ts +17 -2
- package/template/test/structuredData.generate.spec.ts +4 -2
- package/template/test/support/mockGateway.ts +21 -1
- package/template/test/support/mountBlock.ts +25 -4
- package/template/test/support/priceTokens.ts +20 -0
- package/template/test/uiMessagesPlugin.spec.ts +34 -1
- package/template/tokens.json +8 -8
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"links": [],
|
|
12
12
|
"drawerLayout": "accordion",
|
|
13
13
|
"showSearch": true,
|
|
14
|
-
"searchStyle": "field",
|
|
15
14
|
"sticky": true,
|
|
16
15
|
"transparentOverHero": false
|
|
17
16
|
}
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
"data": {
|
|
36
35
|
"productHandle": "merino-crew-sweater",
|
|
37
36
|
"variant": "gallery-left",
|
|
38
|
-
"showRating":
|
|
37
|
+
"showRating": false,
|
|
39
38
|
"showQuantity": true,
|
|
40
39
|
"showWishlist": true,
|
|
41
40
|
"lowStockThreshold": "3",
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
{
|
|
44
43
|
"icon": "truck",
|
|
45
44
|
"title": "Free delivery",
|
|
46
|
-
"text": "on orders over
|
|
45
|
+
"text": "on orders over ⟦store freeShippingThreshold⟧"
|
|
47
46
|
},
|
|
48
47
|
{
|
|
49
48
|
"icon": "building-store",
|
|
@@ -73,7 +72,39 @@
|
|
|
73
72
|
"content": [
|
|
74
73
|
{
|
|
75
74
|
"type": "text",
|
|
76
|
-
"
|
|
75
|
+
"marks": [
|
|
76
|
+
{
|
|
77
|
+
"type": "bold"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"text": "Material"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "text",
|
|
84
|
+
"text": " 100% extra-fine Merino wool, 17.5 micron"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "listItem",
|
|
92
|
+
"content": [
|
|
93
|
+
{
|
|
94
|
+
"type": "paragraph",
|
|
95
|
+
"content": [
|
|
96
|
+
{
|
|
97
|
+
"type": "text",
|
|
98
|
+
"marks": [
|
|
99
|
+
{
|
|
100
|
+
"type": "bold"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"text": "Fit"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "text",
|
|
107
|
+
"text": " Relaxed; the model is 180 cm and wears M"
|
|
77
108
|
}
|
|
78
109
|
]
|
|
79
110
|
}
|
|
@@ -87,7 +118,16 @@
|
|
|
87
118
|
"content": [
|
|
88
119
|
{
|
|
89
120
|
"type": "text",
|
|
90
|
-
"
|
|
121
|
+
"marks": [
|
|
122
|
+
{
|
|
123
|
+
"type": "bold"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"text": "Weight"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "text",
|
|
130
|
+
"text": " Midweight, 12-gauge knit"
|
|
91
131
|
}
|
|
92
132
|
]
|
|
93
133
|
}
|
|
@@ -101,7 +141,16 @@
|
|
|
101
141
|
"content": [
|
|
102
142
|
{
|
|
103
143
|
"type": "text",
|
|
104
|
-
"
|
|
144
|
+
"marks": [
|
|
145
|
+
{
|
|
146
|
+
"type": "bold"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"text": "Made in"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "text",
|
|
153
|
+
"text": " Biella, Italy, in a family mill"
|
|
105
154
|
}
|
|
106
155
|
]
|
|
107
156
|
}
|
|
@@ -181,132 +230,15 @@
|
|
|
181
230
|
"apiId": "product-carousel",
|
|
182
231
|
"id": "product-related",
|
|
183
232
|
"data": {
|
|
184
|
-
"heading": "
|
|
233
|
+
"heading": "Goes well with",
|
|
185
234
|
"variant": "related",
|
|
186
|
-
"limit": "
|
|
187
|
-
"viewAllLabel": "
|
|
235
|
+
"limit": "4",
|
|
236
|
+
"viewAllLabel": "Shop all knitwear",
|
|
188
237
|
"viewAllHref": "/collections/knitwear",
|
|
189
238
|
"showSwatches": true,
|
|
190
|
-
"background": "
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
{
|
|
194
|
-
"apiId": "faq",
|
|
195
|
-
"id": "product-faq",
|
|
196
|
-
"data": {
|
|
197
|
-
"variant": "one-column",
|
|
198
|
-
"heading": "Shipping & care",
|
|
199
|
-
"intro": "Delivery, returns and looking after the things you buy from us.",
|
|
200
|
-
"exclusive": true,
|
|
201
|
-
"items": [
|
|
202
|
-
{
|
|
203
|
-
"question": "How long does delivery take?",
|
|
204
|
-
"open": true,
|
|
205
|
-
"answer": {
|
|
206
|
-
"type": "doc",
|
|
207
|
-
"content": [
|
|
208
|
-
{
|
|
209
|
-
"type": "paragraph",
|
|
210
|
-
"content": [
|
|
211
|
-
{
|
|
212
|
-
"type": "text",
|
|
213
|
-
"text": "US orders leave our Portland studio within 2 business days and arrive 2 to 4 days later. Canadian and EU orders take 5 to 9 business days. Made-to-order knitwear ships in about 3 weeks, and the product page always says so."
|
|
214
|
-
}
|
|
215
|
-
]
|
|
216
|
-
}
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
"question": "Can I return something that isn't right?",
|
|
222
|
-
"answer": {
|
|
223
|
-
"type": "doc",
|
|
224
|
-
"content": [
|
|
225
|
-
{
|
|
226
|
-
"type": "paragraph",
|
|
227
|
-
"content": [
|
|
228
|
-
{
|
|
229
|
-
"type": "text",
|
|
230
|
-
"text": "Yes. You have 30 days to send back anything unused, in its original packaging. US returns are free with the prepaid label in your parcel. Seconds and personalised pieces can't be returned unless they arrive damaged."
|
|
231
|
-
}
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
"question": "Why does my mug look different from the photo?",
|
|
239
|
-
"answer": {
|
|
240
|
-
"type": "doc",
|
|
241
|
-
"content": [
|
|
242
|
-
{
|
|
243
|
-
"type": "paragraph",
|
|
244
|
-
"content": [
|
|
245
|
-
{
|
|
246
|
-
"type": "text",
|
|
247
|
-
"text": "Every piece is glazed by hand and fired in small batches, so colour and speckle vary from kiln to kiln. We photograph a typical piece, and the card in your box tells you which batch yours came from."
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
"question": "How should I wash wool and lambswool?",
|
|
256
|
-
"answer": {
|
|
257
|
-
"type": "doc",
|
|
258
|
-
"content": [
|
|
259
|
-
{
|
|
260
|
-
"type": "paragraph",
|
|
261
|
-
"content": [
|
|
262
|
-
{
|
|
263
|
-
"type": "text",
|
|
264
|
-
"text": "Air it more, wash it less. When it does need a wash, hand wash cool with a wool detergent, press out the water in a towel and dry flat away from the radiator."
|
|
265
|
-
}
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"question": "Are your ceramics dishwasher and microwave safe?",
|
|
273
|
-
"answer": {
|
|
274
|
-
"type": "doc",
|
|
275
|
-
"content": [
|
|
276
|
-
{
|
|
277
|
-
"type": "paragraph",
|
|
278
|
-
"content": [
|
|
279
|
-
{
|
|
280
|
-
"type": "text",
|
|
281
|
-
"text": "Our stoneware is dishwasher, microwave and oven safe up to 400°F. Pieces with a gold rim or raw clay base are hand wash only, which is noted on the product page."
|
|
282
|
-
}
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
]
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"question": "Do you offer gift wrapping?",
|
|
290
|
-
"answer": {
|
|
291
|
-
"type": "doc",
|
|
292
|
-
"content": [
|
|
293
|
-
{
|
|
294
|
-
"type": "paragraph",
|
|
295
|
-
"content": [
|
|
296
|
-
{
|
|
297
|
-
"type": "text",
|
|
298
|
-
"text": "Every order ships in recycled tissue and a plain kraft box. Add a handwritten card at checkout for $4, and we leave prices off the packing slip."
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
|
-
}
|
|
302
|
-
]
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
],
|
|
306
|
-
"contactText": "Still wondering about something?",
|
|
307
|
-
"contactLinkLabel": "Ask our customer care team",
|
|
308
|
-
"contactLinkHref": "/pages/contact",
|
|
309
|
-
"sectionBackground": "none"
|
|
239
|
+
"background": "surface",
|
|
240
|
+
"layout": "grid",
|
|
241
|
+
"quickAdd": true
|
|
310
242
|
}
|
|
311
243
|
},
|
|
312
244
|
{
|
|
@@ -314,9 +246,8 @@
|
|
|
314
246
|
"id": "product-footer",
|
|
315
247
|
"data": {
|
|
316
248
|
"variant": "default",
|
|
317
|
-
"background": "
|
|
249
|
+
"background": "dark",
|
|
318
250
|
"brandText": "Northwind Goods",
|
|
319
|
-
"description": "Knitwear, ceramics and kitchen goods from small workshops, made to be used every day. Studio and shop in Portland, Oregon.",
|
|
320
251
|
"groups": [],
|
|
321
252
|
"links": [],
|
|
322
253
|
"showNewsletter": false,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"links": [],
|
|
14
14
|
"drawerLayout": "accordion",
|
|
15
15
|
"showSearch": true,
|
|
16
|
-
"searchStyle": "field",
|
|
17
16
|
"sticky": true,
|
|
18
17
|
"transparentOverHero": false
|
|
19
18
|
}
|
|
@@ -115,9 +114,8 @@
|
|
|
115
114
|
"id": "products-footer",
|
|
116
115
|
"data": {
|
|
117
116
|
"variant": "default",
|
|
118
|
-
"background": "
|
|
117
|
+
"background": "dark",
|
|
119
118
|
"brandText": "Northwind Goods",
|
|
120
|
-
"description": "Knitwear, ceramics and kitchen goods from small workshops, made to be used every day. Studio and shop in Portland, Oregon.",
|
|
121
119
|
"groups": [],
|
|
122
120
|
"links": [],
|
|
123
121
|
"showNewsletter": false,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"links": [],
|
|
14
14
|
"drawerLayout": "accordion",
|
|
15
15
|
"showSearch": true,
|
|
16
|
-
"searchStyle": "field",
|
|
17
16
|
"sticky": true,
|
|
18
17
|
"transparentOverHero": false
|
|
19
18
|
}
|
|
@@ -54,9 +53,8 @@
|
|
|
54
53
|
"id": "search-footer",
|
|
55
54
|
"data": {
|
|
56
55
|
"variant": "default",
|
|
57
|
-
"background": "
|
|
56
|
+
"background": "dark",
|
|
58
57
|
"brandText": "Northwind Goods",
|
|
59
|
-
"description": "Knitwear, ceramics and kitchen goods from small workshops, made to be used every day. Studio and shop in Portland, Oregon.",
|
|
60
58
|
"groups": [],
|
|
61
59
|
"links": [],
|
|
62
60
|
"showNewsletter": false,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"links": [],
|
|
14
14
|
"drawerLayout": "accordion",
|
|
15
15
|
"showSearch": true,
|
|
16
|
-
"searchStyle": "field",
|
|
17
16
|
"sticky": true,
|
|
18
17
|
"transparentOverHero": false
|
|
19
18
|
}
|
|
@@ -59,9 +58,8 @@
|
|
|
59
58
|
"id": "wishlist-footer",
|
|
60
59
|
"data": {
|
|
61
60
|
"variant": "default",
|
|
62
|
-
"background": "
|
|
61
|
+
"background": "dark",
|
|
63
62
|
"brandText": "Northwind Goods",
|
|
64
|
-
"description": "Knitwear, ceramics and kitchen goods from small workshops, made to be used every day. Studio and shop in Portland, Oregon.",
|
|
65
63
|
"groups": [],
|
|
66
64
|
"links": [],
|
|
67
65
|
"showNewsletter": false,
|
|
@@ -37,6 +37,12 @@ export const VariantMinimal: Story = {
|
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
export const BackgroundDark: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
entry: { id: "footer", data: { ...base, "background": "dark" } },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
40
46
|
export const BackgroundPrimary: Story = {
|
|
41
47
|
args: {
|
|
42
48
|
entry: { id: "footer", data: { ...base, "background": "primary" } },
|
|
@@ -55,21 +55,3 @@ export const DrawerLayoutSections: Story = {
|
|
|
55
55
|
entry: { id: "navigation", data: { ...base, "drawerLayout": "sections" } },
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
export const SearchStyleIcon: Story = {
|
|
60
|
-
args: {
|
|
61
|
-
entry: { id: "navigation", data: { ...base, "searchStyle": "icon" } },
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const SearchStyleField: Story = {
|
|
66
|
-
args: {
|
|
67
|
-
entry: { id: "navigation", data: { ...base, "searchStyle": "field" } },
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const SearchStyleInline: Story = {
|
|
72
|
-
args: {
|
|
73
|
-
entry: { id: "navigation", data: { ...base, "searchStyle": "inline" } },
|
|
74
|
-
},
|
|
75
|
-
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type BlockFieldsMap,
|
|
11
11
|
} from '@eldrajs/theme-core';
|
|
12
12
|
import manifest from '../.eldra/manifest.json';
|
|
13
|
+
import { shown } from './support/priceTokens';
|
|
13
14
|
import { mountOptions } from './support/mountBlock';
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -106,7 +107,10 @@ function isRichTextRoot(value: unknown): boolean {
|
|
|
106
107
|
function encodedTextFields(value: unknown, out: TextField[] = []): TextField[] {
|
|
107
108
|
if (typeof value === 'string') {
|
|
108
109
|
const { cleaned, meta } = decodeStega(value);
|
|
109
|
-
|
|
110
|
+
// A value holding a price token reaches the page written out (`useBlockData`), in the demo
|
|
111
|
+
// store's currency: that written text is what has to keep the payload.
|
|
112
|
+
const text = shown(cleaned);
|
|
113
|
+
if (meta !== null && text.trim() !== '') out.push({ path: meta.fieldPath, value: text });
|
|
110
114
|
return out;
|
|
111
115
|
}
|
|
112
116
|
if (Array.isArray(value)) {
|
|
@@ -218,7 +222,11 @@ function fragmentsOf(value: string): Fragment[] {
|
|
|
218
222
|
{ text: head, startsWord: true, endsWord: head.length === value.length },
|
|
219
223
|
];
|
|
220
224
|
if (value.length > 8)
|
|
221
|
-
fragments.push({
|
|
225
|
+
fragments.push({
|
|
226
|
+
text: value.slice(-8),
|
|
227
|
+
startsWord: false,
|
|
228
|
+
endsWord: true,
|
|
229
|
+
});
|
|
222
230
|
const firstWord = value.split(/\s+/)[0] ?? '';
|
|
223
231
|
if (firstWord.length >= 4 && firstWord !== head) {
|
|
224
232
|
fragments.push({ text: firstWord, startsWord: true, endsWord: true });
|
|
@@ -162,11 +162,11 @@ describe('the header’s own destinations', () => {
|
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* **The header's search is three destinations, and `EldraRouterLink` can reach none of them.**
|
|
165
|
-
* `
|
|
165
|
+
* `SearchModal` renders a real `<form method="get" :action>` (the no-JavaScript submit),
|
|
166
166
|
* the overlay's "See all N results" row is built by the library as `${action}?q=…`, and every
|
|
167
167
|
* result row is a plain `<a>` in a panel that takes no `linkAs`. All three used to point at the
|
|
168
168
|
* default language's `/search` and `/products/…` from a prefixed page — the header search is the
|
|
169
|
-
* common way into a catalogue, and `showSearch: true`
|
|
169
|
+
* common way into a catalogue, and `showSearch: true` is the shipped
|
|
170
170
|
* default, so this was the likeliest way of all to be thrown back into English mid-visit.
|
|
171
171
|
*/
|
|
172
172
|
describe('the header’s search', () => {
|
|
@@ -255,23 +255,6 @@ describe('the header’s search', () => {
|
|
|
255
255
|
wrapper.unmount();
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
|
|
259
|
-
it('submits the inline field into the active locale too', () => {
|
|
260
|
-
// `searchStyle: 'field'` renders `SearchBar` in the bar itself, with its own `<form action>`.
|
|
261
|
-
const wrapper = mountHeader({
|
|
262
|
-
...(navigationMock as Record<string, unknown>),
|
|
263
|
-
searchStyle: 'field',
|
|
264
|
-
});
|
|
265
|
-
try {
|
|
266
|
-
const actions = wrapper
|
|
267
|
-
.findAll('form[role="search"]')
|
|
268
|
-
.map((form) => form.attributes('action'));
|
|
269
|
-
expect(actions.length).toBeGreaterThan(0);
|
|
270
|
-
for (const action of actions) expect(action).toBe('/is-IS/search');
|
|
271
|
-
} finally {
|
|
272
|
-
wrapper.unmount();
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
258
|
});
|
|
276
259
|
|
|
277
260
|
describe('the search block’s results destination', () => {
|
|
@@ -198,7 +198,6 @@ describe('article sample page', () => {
|
|
|
198
198
|
const wrapper = await mountPage(page);
|
|
199
199
|
const roots = pageBlockRoots(wrapper);
|
|
200
200
|
const articleEl = roots[2]!;
|
|
201
|
-
const footerEl = roots[5]!;
|
|
202
201
|
|
|
203
202
|
expect(articleEl.textContent).toContain(
|
|
204
203
|
'Bisqueware waiting for its glaze bath in the Portland studio.'
|
|
@@ -206,7 +205,6 @@ describe('article sample page', () => {
|
|
|
206
205
|
expect(articleEl.textContent).toContain(
|
|
207
206
|
'Ingrid has thrown pots in Portland for eighteen years'
|
|
208
207
|
);
|
|
209
|
-
expect(footerEl.textContent).toContain('Studio and shop in Portland, Oregon.');
|
|
210
208
|
expect(wrapper.text()).not.toContain('Bergen');
|
|
211
209
|
});
|
|
212
210
|
|
|
@@ -25,8 +25,8 @@ const page = fixture as unknown as PageFixture;
|
|
|
25
25
|
* title and the strip of sibling categories from it, and `collection-grid` in `scope: 'category'`
|
|
26
26
|
* lists that category's whole subtree. So the one thing this page needs that no other page spec
|
|
27
27
|
* does is a demo route that *is* a category page — `home/ceramics`, the demo tree's own nested
|
|
28
|
-
* branch (`Homeware › Ceramics`, with `Kitchen` as the sibling the strip never shows and
|
|
29
|
-
* children
|
|
28
|
+
* branch (`Homeware › Ceramics`, with `Kitchen` as the sibling the strip never shows and its five
|
|
29
|
+
* empty children — `Mugs and cups` to `Gift sets` — as the strip under the title).
|
|
30
30
|
*/
|
|
31
31
|
const CATEGORY_PATH = 'home/ceramics';
|
|
32
32
|
const CATEGORY_TITLE = 'Ceramics';
|
|
@@ -108,23 +108,45 @@ describe('category sample page', () => {
|
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
* The strip under the title is the current category's **children**, each linking to its own page
|
|
112
|
-
*
|
|
113
|
-
*
|
|
111
|
+
* The strip under the title is the current category's **children**, each linking to its own page,
|
|
112
|
+
* led by an "All <title>" chip for the page itself — the one current chip, as the design's "All
|
|
113
|
+
* ceramics". A leaf (`Vases`, under Ceramics) has no strip at all, not a lone "All" chip.
|
|
114
114
|
*/
|
|
115
|
-
it('shows a strip of child categories
|
|
116
|
-
const
|
|
117
|
-
|
|
115
|
+
it('shows a strip of child categories, led by the category itself, only where it has children', async () => {
|
|
116
|
+
const wrapper = await mountCategoryPage();
|
|
117
|
+
const strip = wrapper.get('ul[aria-label="Categories in this one"]');
|
|
118
|
+
const links = strip.findAll('a');
|
|
119
|
+
expect(links.map((link) => link.text())).toEqual([
|
|
120
|
+
'All ceramics',
|
|
121
|
+
'Mugs and cups',
|
|
122
|
+
'Bowls',
|
|
123
|
+
'Plates and platters',
|
|
124
|
+
'Vases',
|
|
125
|
+
'Gift sets',
|
|
126
|
+
]);
|
|
127
|
+
expect(links.map((link) => link.attributes('href'))).toEqual([
|
|
128
|
+
'/categories/home/ceramics',
|
|
129
|
+
'/categories/home/ceramics/mugs-and-cups',
|
|
130
|
+
'/categories/home/ceramics/bowls',
|
|
131
|
+
'/categories/home/ceramics/plates-and-platters',
|
|
132
|
+
'/categories/home/ceramics/vases',
|
|
133
|
+
'/categories/home/ceramics/gift-sets',
|
|
134
|
+
]);
|
|
135
|
+
// Only the "All" chip is current: every child is somewhere else.
|
|
136
|
+
const current = strip.findAll('[aria-current="page"]');
|
|
137
|
+
expect(current).toHaveLength(1);
|
|
138
|
+
expect(current[0]!.text()).toBe('All ceramics');
|
|
118
139
|
|
|
119
140
|
const parent = await mountCategoryPage('home');
|
|
120
|
-
const
|
|
121
|
-
expect(
|
|
141
|
+
const parentStrip = parent.get('ul[aria-label="Categories in this one"]');
|
|
142
|
+
expect(parentStrip.findAll('a').map((link) => link.attributes('href'))).toEqual([
|
|
143
|
+
'/categories/home',
|
|
122
144
|
'/categories/home/ceramics',
|
|
123
145
|
'/categories/home/kitchen',
|
|
124
146
|
]);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
expect(
|
|
147
|
+
|
|
148
|
+
const leaf = await mountCategoryPage('home/ceramics/vases');
|
|
149
|
+
expect(leaf.find('ul[aria-label="Categories in this one"]').exists()).toBe(false);
|
|
128
150
|
});
|
|
129
151
|
|
|
130
152
|
/**
|
|
@@ -127,17 +127,15 @@ describe('home page (pages/home.page.json)', () => {
|
|
|
127
127
|
// `winter-knitwear`/`the-winter-edit` — a slug the demo catalogue doesn't recognise resolves
|
|
128
128
|
// to no products at all and the whole block renders nothing live, so the fixture names a real
|
|
129
129
|
// collection rather than a placeholder. Real product cards render, capped at the `limit: "8"`
|
|
130
|
-
// override
|
|
131
|
-
// `collection` variant derives its own link (`/collections/<slug>`) and has no `viewAllHref`
|
|
132
|
-
// field to override it with.
|
|
130
|
+
// override.
|
|
133
131
|
const carouselRoot = roots[4];
|
|
134
132
|
expect(carouselRoot.querySelectorAll('h3')).toHaveLength(8);
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
);
|
|
140
|
-
expect(
|
|
133
|
+
// "Just in / New arrivals" is a plain heading with the filter chips beside it, as the design
|
|
134
|
+
// draws it: the fixture sets no `viewAllLabel`, so the heading is not a "view all" link.
|
|
135
|
+
const carouselHeading = carouselRoot.querySelector('h2')!;
|
|
136
|
+
expect(carouselHeading.textContent).toBe('New arrivals');
|
|
137
|
+
expect(carouselHeading.querySelector('a')).toBeNull();
|
|
138
|
+
expect(carouselRoot.querySelector('[aria-pressed]')).not.toBeNull();
|
|
141
139
|
// The slug came out of the reference, not out of a handle field: the fixture carries no
|
|
142
140
|
// `sourceHandle`, and there is no field left that could have supplied it.
|
|
143
141
|
const carouselData = homeFixture.blocks.find((block) => block.apiId === 'product-carousel')!
|
|
@@ -152,13 +150,28 @@ describe('home page (pages/home.page.json)', () => {
|
|
|
152
150
|
expect(splitRows[0]!.children[0]?.className).not.toContain('order-2');
|
|
153
151
|
expect(roots[5].textContent).toContain('Harbour Pottery');
|
|
154
152
|
|
|
155
|
-
// article-list: the three journal stories the fixture names
|
|
153
|
+
// article-list: the three journal stories the fixture names, each with its "category · reading
|
|
154
|
+
// time" line above the title and no date under it (the stories carry no `publishedAt`).
|
|
156
155
|
expect(roots[6].querySelectorAll('h3')).toHaveLength(3);
|
|
156
|
+
expect(roots[6].textContent).toContain('At home · 4 min read');
|
|
157
|
+
expect(roots[6].querySelector('time')).toBeNull();
|
|
158
|
+
|
|
159
|
+
// trust-strip: the three promises are plain titles, none of them a link.
|
|
160
|
+
expect(roots[2].querySelectorAll('a')).toHaveLength(0);
|
|
157
161
|
|
|
158
162
|
// footer `showNewsletter: false`: its own newsletter copy never renders.
|
|
159
163
|
expect(roots[8].textContent).not.toContain('New pieces, maker stories');
|
|
160
164
|
});
|
|
161
165
|
|
|
166
|
+
it('writes the Ceramics tile’s price token in the shopper’s currency, never the raw token', async () => {
|
|
167
|
+
// The home seed's one fixed-amount price (`⟦price#mugs …⟧`): the demo store sells in US dollars.
|
|
168
|
+
expect(JSON.stringify(fixture)).toContain('Mugs from ⟦price#mugs EUR=2600 ISK=3990 USD=2800⟧');
|
|
169
|
+
const wrapper = await mountPage(homeFixture);
|
|
170
|
+
expect(wrapper.text()).toContain('Mugs from $28.00, bowls, vases');
|
|
171
|
+
expect(wrapper.text()).not.toContain('⟦');
|
|
172
|
+
wrapper.unmount();
|
|
173
|
+
});
|
|
174
|
+
|
|
162
175
|
it('has exactly one h1, and no heading level is skipped', async () => {
|
|
163
176
|
const wrapper = await mountPage(homeFixture);
|
|
164
177
|
const main = wrapper.get('main#main');
|
|
@@ -212,7 +225,7 @@ describe('home page (pages/home.page.json)', () => {
|
|
|
212
225
|
expect(newsletterForms).toHaveLength(1);
|
|
213
226
|
});
|
|
214
227
|
|
|
215
|
-
it('opens the mobile menu
|
|
228
|
+
it('opens the mobile menu under the header from the menu button, and Esc returns focus to it', async () => {
|
|
216
229
|
// `withAuthoredHeaderLink`: the seeded header ships no links and no call to action, so it
|
|
217
230
|
// draws no Menu button and no drawer — see that helper's own comment. The mobile
|
|
218
231
|
// menu is what a header a merchant *has* filled in offers, which is the state under test here.
|
|
@@ -221,18 +234,21 @@ describe('home page (pages/home.page.json)', () => {
|
|
|
221
234
|
});
|
|
222
235
|
// The menu button lives in the header, which is a sibling of `<main>` now — so this reads off
|
|
223
236
|
// the whole page rather than `main`.
|
|
224
|
-
|
|
237
|
+
// The menu is the design's inline drawer: a disclosure under the bar, not a dialog.
|
|
238
|
+
const menuButton = wrapper.get('[data-part="toggle"]');
|
|
225
239
|
menuButton.element.focus();
|
|
226
240
|
await menuButton.trigger('click');
|
|
227
241
|
|
|
228
|
-
const
|
|
229
|
-
expect(
|
|
242
|
+
const drawer = wrapper.get(`#${menuButton.attributes('aria-controls')}`);
|
|
243
|
+
expect(menuButton.attributes('aria-expanded')).toBe('true');
|
|
244
|
+
expect((drawer.element as HTMLElement).style.display).toBe('');
|
|
230
245
|
|
|
231
246
|
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
|
|
232
247
|
await new Promise((resolve) => setTimeout(resolve));
|
|
233
248
|
await wrapper.vm.$nextTick();
|
|
234
249
|
|
|
235
|
-
expect(
|
|
250
|
+
expect(menuButton.attributes('aria-expanded')).toBe('false');
|
|
251
|
+
expect((drawer.element as HTMLElement).style.display).toBe('none');
|
|
236
252
|
expect(document.activeElement).toBe(menuButton.element);
|
|
237
253
|
|
|
238
254
|
wrapper.unmount();
|
|
@@ -279,10 +295,10 @@ describe('home page (pages/home.page.json)', () => {
|
|
|
279
295
|
const wrapper = await mountPage(homeFixture);
|
|
280
296
|
const text = wrapper.text();
|
|
281
297
|
|
|
282
|
-
|
|
298
|
+
// The design's home page names the delivery threshold and the returns window; the studio's
|
|
299
|
+
// city and the welcome discount live on other pages (the footer carries no description here).
|
|
283
300
|
expect(text).toContain('$80');
|
|
284
301
|
expect(text).toMatch(/30[- ]day/);
|
|
285
|
-
expect(text).toContain('10%');
|
|
286
302
|
|
|
287
303
|
expect(text).not.toContain('Leeds');
|
|
288
304
|
expect(text).not.toContain('Bergen');
|