@shopbite-de/storefront 1.31.3 → 2.0.1

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 (187) hide show
  1. package/.github/workflows/ci.yaml +87 -0
  2. package/.gitignore +5 -0
  3. package/CLAUDE.md +27 -8
  4. package/app/app.vue +10 -6
  5. package/app/assets/css/main.css +103 -61
  6. package/app/components/AddToWishlist.vue +15 -25
  7. package/app/components/Address/Card.vue +6 -11
  8. package/app/components/Address/Detail.vue +23 -23
  9. package/app/components/Address/Fields.vue +175 -73
  10. package/app/components/Address/Form.vue +107 -106
  11. package/app/components/Cart/Bar.vue +6 -9
  12. package/app/components/Cart/Item.vue +48 -63
  13. package/app/components/Cart/QuickView.vue +38 -25
  14. package/app/components/Cart/Upsell.vue +24 -62
  15. package/app/components/Category/Breadcrumb.vue +29 -3
  16. package/app/components/Category/FilterGroup.vue +20 -41
  17. package/app/components/Category/Listing.vue +100 -130
  18. package/app/components/Category/SearchInput.vue +22 -19
  19. package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
  20. package/app/components/Checkout/LoginOrRegister.vue +28 -29
  21. package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
  22. package/app/components/Checkout/Summary.vue +90 -60
  23. package/app/components/Checkout/VoucherInput.vue +40 -27
  24. package/app/components/Contact/Form.vue +164 -192
  25. package/app/components/DemoBanner.vue +5 -5
  26. package/app/components/Footer/StoreStatus.vue +2 -2
  27. package/app/components/Footer.vue +125 -57
  28. package/app/components/Header.vue +283 -18
  29. package/app/components/Home/Categories.vue +116 -0
  30. package/app/components/Home/Facts.vue +71 -0
  31. package/app/components/Home/Faq.vue +34 -16
  32. package/app/components/Home/Hero.vue +172 -0
  33. package/app/components/Home/Highlights.vue +29 -37
  34. package/app/components/Home/Restaurant.vue +102 -0
  35. package/app/components/Menu/BonCard.vue +180 -0
  36. package/app/components/Menu/CartPanel.vue +24 -0
  37. package/app/components/Menu/CategoryIndex.vue +54 -0
  38. package/app/components/Menu/OrderMode.vue +20 -0
  39. package/app/components/Menu/SectionHeader.vue +38 -0
  40. package/app/components/Navigation/MobileTop.vue +23 -15
  41. package/app/components/Order/Confirmation.vue +119 -0
  42. package/app/components/Order/Detail.vue +80 -88
  43. package/app/components/Product/CardSkeleton.vue +8 -12
  44. package/app/components/Product/Configurator.vue +8 -16
  45. package/app/components/Product/CrossSelling.vue +75 -83
  46. package/app/components/Product/DeselectIngredient.vue +17 -22
  47. package/app/components/Product/Detail.vue +35 -27
  48. package/app/components/Product/QuickView.vue +80 -51
  49. package/app/components/SalesChannelSwitch.vue +14 -28
  50. package/app/components/Sb/Button.vue +70 -0
  51. package/app/components/Sb/Checkbox.vue +73 -0
  52. package/app/components/Sb/Chip.vue +51 -0
  53. package/app/components/Sb/ChoiceGroup.vue +82 -0
  54. package/app/components/Sb/ConfirmDialog.vue +60 -0
  55. package/app/components/Sb/Field.vue +77 -0
  56. package/app/components/Sb/Icon.vue +66 -0
  57. package/app/components/Sb/IconButton.vue +55 -0
  58. package/app/components/Sb/Input.vue +23 -0
  59. package/app/components/Sb/SegmentedControl.vue +34 -0
  60. package/app/components/Sb/Select.vue +49 -0
  61. package/app/components/Sb/Sheet.vue +83 -0
  62. package/app/components/Sb/Stars.vue +60 -0
  63. package/app/components/Sb/StatusPill.vue +38 -0
  64. package/app/components/Sb/Stepper.vue +72 -0
  65. package/app/components/User/AccountHeader.vue +16 -0
  66. package/app/components/User/AuthPanel.vue +41 -0
  67. package/app/components/User/Detail.vue +32 -29
  68. package/app/components/User/LoginForm.vue +92 -98
  69. package/app/components/User/RegistrationForm.vue +285 -249
  70. package/app/components/Wishlist.vue +55 -155
  71. package/app/composables/useCartMutations.ts +9 -27
  72. package/app/composables/useCheckoutMethodGuard.ts +2 -24
  73. package/app/composables/useContactForm.ts +66 -0
  74. package/app/composables/useHomeMenuCategories.ts +41 -0
  75. package/app/composables/useNavigation.ts +10 -2
  76. package/app/composables/useOrderMode.ts +65 -0
  77. package/app/composables/useRegistrationForm.ts +161 -0
  78. package/app/composables/useRestaurantSchema.ts +1 -1
  79. package/app/composables/useShareLink.ts +3 -13
  80. package/app/composables/useSortingSelection.ts +13 -0
  81. package/app/composables/useThemePreset.ts +24 -0
  82. package/app/composables/useVoucherCode.ts +7 -16
  83. package/app/composables/useWishlistActions.ts +0 -51
  84. package/app/error.vue +31 -9
  85. package/app/layouts/account.vue +45 -50
  86. package/app/layouts/default.vue +2 -3
  87. package/app/layouts/listing.vue +3 -5
  88. package/app/pages/[...all].vue +8 -4
  89. package/app/pages/account/recover/password/index.vue +113 -80
  90. package/app/pages/anmelden.vue +11 -10
  91. package/app/pages/bestellung/[id]/erfolg.vue +1 -15
  92. package/app/pages/bestellung/[id]/fehler.vue +63 -51
  93. package/app/pages/bestellung/[id]/index.vue +3 -85
  94. package/app/pages/bestellung/kasse.vue +29 -0
  95. package/app/pages/bestellung.vue +8 -60
  96. package/app/pages/index.vue +12 -52
  97. package/app/pages/kontakt.vue +27 -7
  98. package/app/pages/konto/adressen.vue +106 -102
  99. package/app/pages/konto/bestellung/[id].vue +9 -43
  100. package/app/pages/konto/bestellungen.vue +55 -33
  101. package/app/pages/konto/index.vue +47 -62
  102. package/app/pages/konto/profil.vue +162 -100
  103. package/app/pages/maintenance.vue +8 -6
  104. package/app/pages/merkliste.vue +7 -8
  105. package/app/pages/passwort-vergessen.vue +92 -75
  106. package/app/pages/registrierung/bestaetigen.vue +20 -48
  107. package/app/pages/registrierung/index.vue +16 -7
  108. package/app/pages/suche.vue +94 -95
  109. package/app/plugins/theme-preset.ts +9 -0
  110. package/app/utils/highlight.ts +25 -0
  111. package/app/utils/product.ts +9 -0
  112. package/app/validation/registrationSchema.ts +1 -1
  113. package/modules/theme.ts +123 -0
  114. package/nuxt.config.ts +30 -16
  115. package/package.json +6 -8
  116. package/playwright.config.ts +11 -0
  117. package/server/api/listing/[categoryId].get.ts +3 -0
  118. package/shared/theme/presets.ts +303 -0
  119. package/test/a11y/presets.test.ts +225 -0
  120. package/test/layer/nuxt.config.ts +8 -0
  121. package/test/nuxt/AccountPagesPreset.test.ts +191 -0
  122. package/test/nuxt/AuthPagesPreset.test.ts +87 -0
  123. package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
  124. package/test/nuxt/CartItem.test.ts +18 -3
  125. package/test/nuxt/CartUpsell.test.ts +1 -2
  126. package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
  127. package/test/nuxt/CheckoutOnePage.test.ts +115 -0
  128. package/test/nuxt/CheckoutSummary.test.ts +6 -6
  129. package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
  130. package/test/nuxt/ContactFormPreset.test.ts +115 -0
  131. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  132. package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
  133. package/test/nuxt/HomeFaq.test.ts +3 -2
  134. package/test/nuxt/MenuBonCard.test.ts +122 -0
  135. package/test/nuxt/OrderPagesPreset.test.ts +132 -0
  136. package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
  137. package/test/nuxt/ProductCrossSelling.test.ts +2 -1
  138. package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
  139. package/test/nuxt/ProductSheetPreset.test.ts +105 -0
  140. package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
  141. package/test/nuxt/RegistrationForm.test.ts +89 -270
  142. package/test/nuxt/SbBaseComponents.test.ts +170 -0
  143. package/test/nuxt/SbStars.test.ts +25 -0
  144. package/test/nuxt/useCartMutations.test.ts +3 -17
  145. package/test/nuxt/useCartUpsell.test.ts +1 -1
  146. package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
  147. package/test/nuxt/useShareLink.test.ts +1 -9
  148. package/test/nuxt/useWishlistActions.test.ts +3 -26
  149. package/test/unit/highlight.spec.ts +31 -0
  150. package/test/unit/product.spec.ts +12 -0
  151. package/test/unit/themePresets.spec.ts +61 -0
  152. package/app/app.config.ts +0 -19
  153. package/app/components/AnimatedSection.vue +0 -74
  154. package/app/components/BottomNavi.vue +0 -70
  155. package/app/components/Category/Header.vue +0 -48
  156. package/app/components/Checkout/PaymentMethod.vue +0 -30
  157. package/app/components/Checkout/ShippingMethod.vue +0 -30
  158. package/app/components/Cta.vue +0 -30
  159. package/app/components/Feature/Card.vue +0 -121
  160. package/app/components/Features.vue +0 -42
  161. package/app/components/Footer/Contact.vue +0 -82
  162. package/app/components/Header/Body.vue +0 -82
  163. package/app/components/Header/Right.vue +0 -187
  164. package/app/components/Header/Title.vue +0 -10
  165. package/app/components/Hero.vue +0 -233
  166. package/app/components/Home/MenuCategories.vue +0 -148
  167. package/app/components/ImageGallery.vue +0 -63
  168. package/app/components/Loading.vue +0 -29
  169. package/app/components/Navigation/DesktopLeft.vue +0 -39
  170. package/app/components/Product/Card.vue +0 -177
  171. package/app/components/Product/CardCompact.vue +0 -72
  172. package/app/components/Product/CardDietBadges.vue +0 -43
  173. package/app/components/Product/CardIngredients.vue +0 -35
  174. package/app/components/Product/CardKitchen.vue +0 -34
  175. package/app/components/Product/SearchBar.vue +0 -95
  176. package/app/components/PublicAnnouncement.vue +0 -17
  177. package/app/pages/bestellung/bestaetigen.vue +0 -16
  178. package/app/pages/bestellung/warenkorb.vue +0 -49
  179. package/app/pages/bestellung/zahlung-versand.vue +0 -25
  180. package/test/nuxt/AddressFields.test.ts +0 -222
  181. package/test/nuxt/AnimatedSection.test.ts +0 -67
  182. package/test/nuxt/ContactForm.test.ts +0 -207
  183. package/test/nuxt/FooterContact.test.ts +0 -102
  184. package/test/nuxt/HeaderRight.test.ts +0 -142
  185. package/test/nuxt/Hero.test.ts +0 -126
  186. package/test/nuxt/HomeMenuCategories.test.ts +0 -94
  187. package/test/nuxt/LoginForm.test.ts +0 -159
@@ -1,72 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Schemas } from "#shopware";
3
-
4
- // Compact card for horizontal rows (top sellers, #327): cover or placeholder,
5
- // number, name, price and a plus. The whole card opens the quick view.
6
- const props = defineProps<{
7
- product: Schemas["Product"];
8
- }>();
9
-
10
- const emit = defineEmits<{
11
- select: [product: Schemas["Product"]];
12
- }>();
13
-
14
- const { getFormattedPrice } = useCommercePrice();
15
-
16
- const coverMedia = computed(() => props.product.cover?.media);
17
- const name = computed(
18
- () => props.product.translated?.name ?? props.product.name,
19
- );
20
- </script>
21
-
22
- <template>
23
- <article
24
- class="flex w-44 shrink-0 cursor-pointer snap-start flex-col overflow-hidden rounded-xl bg-default shadow-md ring ring-default transition-shadow hover:shadow-lg hover:ring-primary/40 focus-visible:outline-2 focus-visible:outline-primary"
25
- role="button"
26
- tabindex="0"
27
- aria-haspopup="dialog"
28
- :aria-label="`${name} auswählen`"
29
- @click="emit('select', product)"
30
- @keydown.enter.prevent="emit('select', product)"
31
- @keydown.space.prevent="emit('select', product)"
32
- >
33
- <img
34
- v-if="coverMedia?.url"
35
- :src="coverMedia.url"
36
- :srcset="mediaSrcSet(coverMedia)"
37
- sizes="176px"
38
- :width="mediaSize(coverMedia)?.width"
39
- :height="mediaSize(coverMedia)?.height"
40
- :alt="name"
41
- loading="lazy"
42
- decoding="async"
43
- class="h-28 w-full object-cover"
44
- />
45
- <div
46
- v-else
47
- class="flex h-28 w-full items-center justify-center bg-gradient-to-b from-brand-100 to-brand-200 text-brand-600"
48
- aria-hidden="true"
49
- >
50
- <UIcon name="i-lucide-utensils-crossed" class="size-8" />
51
- </div>
52
- <div class="flex flex-1 flex-col gap-1.5 p-3">
53
- <span class="text-xs font-semibold text-primary">
54
- #{{ product.productNumber }}
55
- </span>
56
- <span class="line-clamp-2 text-base leading-5 font-bold text-highlighted">
57
- {{ name }}
58
- </span>
59
- <div class="mt-auto flex items-center justify-between pt-1">
60
- <span class="font-bold text-highlighted">
61
- {{ getFormattedPrice(product.calculatedPrice.totalPrice) }}
62
- </span>
63
- <span
64
- class="flex size-8 items-center justify-center rounded-full bg-primary/10 text-primary ring ring-inset ring-primary/25"
65
- aria-hidden="true"
66
- >
67
- <UIcon name="i-lucide-plus" class="size-4" />
68
- </span>
69
- </div>
70
- </div>
71
- </article>
72
- </template>
@@ -1,43 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Schemas } from "#shopware";
3
-
4
- const props = withDefaults(
5
- defineProps<{
6
- sortedProperties: Schemas["PropertyGroup"][] | undefined;
7
- // `chip` sits in the ingredient row, `overlay` on the cover image (#325).
8
- variant?: "chip" | "overlay";
9
- }>(),
10
- { variant: "chip" },
11
- );
12
-
13
- const badges = computed(() => {
14
- const diets = getDiets(props.sortedProperties);
15
- return [
16
- {
17
- label: "Vegetarisch",
18
- icon: "i-lucide-leaf",
19
- show: diets.includes("vegetarian"),
20
- },
21
- { label: "Vegan", icon: "i-lucide-vegan", show: diets.includes("vegan") },
22
- ].filter((badge) => badge.show);
23
- });
24
-
25
- // Static spans with the UBadge classes, see CardIngredients.vue.
26
- const badgeClass = computed(() =>
27
- props.variant === "overlay"
28
- ? "rounded-md bg-default ring ring-inset ring-success/50"
29
- : "rounded-full bg-success/10",
30
- );
31
- </script>
32
-
33
- <template>
34
- <span
35
- v-for="badge in badges"
36
- :key="badge.label"
37
- class="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium text-success"
38
- :class="badgeClass"
39
- >
40
- <UIcon :name="badge.icon" class="size-4 shrink-0" />
41
- {{ badge.label }}
42
- </span>
43
- </template>
@@ -1,35 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Schemas } from "#shopware";
3
-
4
- const props = defineProps<{
5
- sortedProperties: Schemas["PropertyGroup"][] | undefined;
6
- withDietBadges: boolean;
7
- }>();
8
-
9
- const mainIngredients = computed(() =>
10
- getMainIngredients(props.sortedProperties),
11
- );
12
- </script>
13
-
14
- <template>
15
- <!-- Plain spans with the UBadge "soft" classes: a listing hydrates up to
16
- ten cards with several chips each, and every UBadge instance costs a
17
- tailwind-variants merge (#325). -->
18
- <div
19
- v-if="withDietBadges || mainIngredients.length > 0"
20
- class="flex flex-wrap gap-1.5"
21
- >
22
- <ProductCardDietBadges
23
- v-if="withDietBadges"
24
- :sorted-properties="sortedProperties"
25
- variant="chip"
26
- />
27
- <span
28
- v-for="ingredient in mainIngredients"
29
- :key="ingredient.id"
30
- class="inline-flex items-center rounded-full bg-elevated px-2 py-1 text-xs font-medium text-default"
31
- >
32
- {{ ingredient.translated.name }}
33
- </span>
34
- </div>
35
- </template>
@@ -1,34 +0,0 @@
1
- <script setup lang="ts">
2
- import type { Schemas } from "#shopware";
3
-
4
- const props = defineProps<{
5
- sortedProperties: Schemas["PropertyGroup"][] | undefined;
6
- }>();
7
-
8
- const kitchen = computed<
9
- { name: string; mediaUrl?: string; isImage: boolean } | undefined
10
- >(() => {
11
- const group = props.sortedProperties?.find(
12
- (propertyGroup) => propertyGroup.translated.name === "Küche",
13
- );
14
-
15
- const option = group?.options?.[0];
16
- if (!option) return undefined;
17
-
18
- return {
19
- name: option.translated.name,
20
- mediaUrl: option.media?.url,
21
- isImage: (group?.displayType ?? group?.translated.displayType) === "media",
22
- };
23
- });
24
- </script>
25
-
26
- <template>
27
- <NuxtImg
28
- v-if="kitchen?.isImage && kitchen.mediaUrl"
29
- :src="kitchen.mediaUrl"
30
- :alt="kitchen.name"
31
- class="h-4 w-4 object-contain"
32
- />
33
- <span v-else-if="kitchen">{{ kitchen.name }}</span>
34
- </template>
@@ -1,95 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref } from "vue";
3
- import { onClickOutside, useDebounceFn, useFocus } from "@vueuse/core";
4
-
5
- withDefaults(
6
- defineProps<{
7
- searchInProgress?: boolean;
8
- }>(),
9
- {
10
- searchInProgress: false,
11
- },
12
- );
13
-
14
- const emit =
15
- defineEmits<(e: "update:searchInProgress", value: boolean) => void>();
16
-
17
- const { searchTerm, search, getProducts, loading } = useProductSearchSuggest();
18
- const { onProductAdded } = useProductEvents();
19
-
20
- const searchContainer = ref(null);
21
- const searchInput = ref();
22
- const minSearchLength = 1;
23
-
24
- const active = ref(false);
25
-
26
- // Clear search when product is added to cart
27
- onProductAdded(() => {
28
- typingQuery.value = "";
29
- active.value = false;
30
- });
31
-
32
- watch(active, (value) => {
33
- const { focused } = useFocus(searchInput);
34
-
35
- focused.value = value;
36
- });
37
-
38
- // String the user has typed in the search field
39
- const typingQuery = ref("");
40
-
41
- watch(typingQuery, (value) => {
42
- if (value.length >= minSearchLength) {
43
- performSuggestSearch(value);
44
- emit("update:searchInProgress", true);
45
- } else {
46
- emit("update:searchInProgress", false);
47
- }
48
- });
49
-
50
- // Defer the search request to prevent the search from being triggered too after typing
51
- const performSuggestSearch = useDebounceFn((value) => {
52
- searchTerm.value = value;
53
- search();
54
- }, 500);
55
-
56
- if (import.meta.client) {
57
- onClickOutside(searchContainer, () => {
58
- active.value = false;
59
- });
60
- }
61
-
62
- const showSuggest = computed(() => {
63
- return typingQuery.value.length >= minSearchLength && active.value;
64
- });
65
-
66
- defineExpose({
67
- showSuggest,
68
- products: getProducts,
69
- loading,
70
- });
71
- </script>
72
-
73
- <template>
74
- <UInput
75
- v-model="typingQuery"
76
- name="search"
77
- class="w-full my-2"
78
- size="xl"
79
- :loading="loading"
80
- placeholder="Suche..."
81
- :ui="{}"
82
- @input="active = true"
83
- >
84
- <template v-if="typingQuery?.length" #trailing>
85
- <UButton
86
- color="neutral"
87
- variant="link"
88
- size="sm"
89
- icon="i-lucide-circle-x"
90
- aria-label="Clear input"
91
- @click="typingQuery = ''"
92
- />
93
- </template>
94
- </UInput>
95
- </template>
@@ -1,17 +0,0 @@
1
- <script setup lang="ts">
2
- import { ExclamationTriangleIcon } from "@heroicons/vue/24/outline";
3
-
4
- defineProps<{
5
- message?: string;
6
- }>();
7
- </script>
8
-
9
- <template>
10
- <div
11
- v-if="message"
12
- class="bg-red-100 z-50 text-blackish flex p-8 gap-4 shadow-md rounded-md my-4"
13
- >
14
- <ExclamationTriangleIcon class="w-14 h-14 min-w-12" />
15
- <div>{{ message }}</div>
16
- </div>
17
- </template>
@@ -1,16 +0,0 @@
1
- <script setup lang="ts">
2
- useSeoMeta({
3
- title: "Prüfen & Bestellen",
4
- robots: "noindex, nofollow",
5
- });
6
-
7
- const { isLoggedIn, isGuestSession } = useUser();
8
-
9
- if (!isLoggedIn.value && !isGuestSession.value) {
10
- await navigateTo("/bestellung/warenkorb");
11
- }
12
- </script>
13
-
14
- <template>
15
- <CheckoutSummary />
16
- </template>
@@ -1,49 +0,0 @@
1
- <script setup lang="ts">
2
- useSeoMeta({
3
- title: "Warenkorb",
4
- robots: "noindex, nofollow",
5
- });
6
-
7
- const { isLoggedIn, isGuestSession } = useUser();
8
- const { isEmpty } = useCart();
9
-
10
- const isCustomerAvailable = computed<boolean>(() => {
11
- return isLoggedIn.value || isGuestSession.value;
12
- });
13
- </script>
14
-
15
- <template>
16
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-8 py-8">
17
- <div class="flex flex-col gap-4">
18
- <h2 class="text-lg font-semibold">
19
- {{ isCustomerAvailable ? "Deine Daten" : "Anmelden oder registrieren" }}
20
- </h2>
21
- <CheckoutLoginOrRegister v-if="!isLoggedIn && !isGuestSession" />
22
- <UserDetail v-else :with-edit-button="true" />
23
- </div>
24
-
25
- <div class="flex flex-col gap-4">
26
- <h2 class="text-lg font-semibold">Warenkorb</h2>
27
- <UCard>
28
- <CartQuickView />
29
- </UCard>
30
- <UButton
31
- v-if="!isEmpty && isCustomerAvailable"
32
- label="Zahlungs- und Versandart auswählen"
33
- size="xl"
34
- block
35
- trailing-icon="i-lucide-arrow-right"
36
- to="/bestellung/zahlung-versand"
37
- />
38
- <UButton
39
- v-if="isEmpty"
40
- label="Zur Speisekarte"
41
- size="xl"
42
- block
43
- variant="outline"
44
- icon="i-lucide-arrow-left"
45
- to="/speisekarte"
46
- />
47
- </div>
48
- </div>
49
- </template>
@@ -1,25 +0,0 @@
1
- <script setup lang="ts">
2
- useSeoMeta({
3
- title: "Zahlung & Versand",
4
- robots: "noindex, nofollow",
5
- });
6
-
7
- const { isLoggedIn, isGuestSession } = useUser();
8
-
9
- if (!isLoggedIn.value && !isGuestSession.value) {
10
- await navigateTo("/bestellung/warenkorb");
11
- }
12
- </script>
13
-
14
- <template>
15
- <div class="flex flex-col gap-8 py-8">
16
- <CheckoutPaymentAndDelivery />
17
- <UButton
18
- label="Weiter zu Prüfen & Bestellen"
19
- trailing-icon="i-lucide-arrow-right"
20
- size="xl"
21
- block
22
- to="/bestellung/bestaetigen"
23
- />
24
- </div>
25
- </template>
@@ -1,222 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { reactive } from "vue";
3
- import { mountSuspended, mockNuxtImport } from "@nuxt/test-utils/runtime";
4
- import Fields from "~/components/Address/Fields.vue";
5
- import type { AddressSchema } from "~/validation/registrationSchema";
6
-
7
- const { mockGetSuggestions } = vi.hoisted(() => ({
8
- mockGetSuggestions: vi.fn().mockResolvedValue([]),
9
- }));
10
-
11
- mockNuxtImport("useAddressAutocomplete", () => () => ({
12
- getSuggestions: mockGetSuggestions,
13
- }));
14
-
15
- describe("AddressFields", () => {
16
- const defaultProps = {
17
- modelValue: {
18
- firstName: "",
19
- lastName: "",
20
- street: "",
21
- zipcode: "",
22
- city: "",
23
- phoneNumber: "",
24
- countryId: "",
25
- },
26
- prefix: "billingAddress",
27
- };
28
-
29
- it("renders basic address fields", async () => {
30
- const wrapper = await mountSuspended(Fields, {
31
- props: defaultProps,
32
- });
33
-
34
- expect(wrapper.find('input[name="billingAddress.street"]').exists()).toBe(
35
- true,
36
- );
37
- expect(wrapper.find('input[name="billingAddress.zipcode"]').exists()).toBe(
38
- true,
39
- );
40
- expect(wrapper.find('input[name="billingAddress.city"]').exists()).toBe(
41
- true,
42
- );
43
- expect(
44
- wrapper.find('input[name="billingAddress.phoneNumber"]').exists(),
45
- ).toBe(true);
46
- });
47
-
48
- it("renders name fields when showNames is true", async () => {
49
- const wrapper = await mountSuspended(Fields, {
50
- props: {
51
- ...defaultProps,
52
- showNames: true,
53
- },
54
- });
55
-
56
- expect(
57
- wrapper.find('input[name="billingAddress.firstName"]').exists(),
58
- ).toBe(true);
59
- expect(wrapper.find('input[name="billingAddress.lastName"]').exists()).toBe(
60
- true,
61
- );
62
- });
63
-
64
- it("does not render name fields when showNames is false", async () => {
65
- const wrapper = await mountSuspended(Fields, {
66
- props: {
67
- ...defaultProps,
68
- showNames: false,
69
- },
70
- });
71
-
72
- expect(
73
- wrapper.find('input[name="billingAddress.firstName"]').exists(),
74
- ).toBe(false);
75
- expect(wrapper.find('input[name="billingAddress.lastName"]').exists()).toBe(
76
- false,
77
- );
78
- });
79
-
80
- it("renders business fields when accountType is business", async () => {
81
- const wrapper = await mountSuspended(Fields, {
82
- props: {
83
- ...defaultProps,
84
- accountType: "business",
85
- },
86
- });
87
-
88
- expect(wrapper.find('input[name="billingAddress.company"]').exists()).toBe(
89
- true,
90
- );
91
- expect(
92
- wrapper.find('input[name="billingAddress.department"]').exists(),
93
- ).toBe(true);
94
- });
95
-
96
- it("updates modelValue when input changes", async () => {
97
- const modelValue = reactive({
98
- firstName: "",
99
- lastName: "",
100
- street: "",
101
- zipcode: "",
102
- city: "",
103
- phoneNumber: "",
104
- countryId: "",
105
- });
106
- const wrapper = await mountSuspended(Fields, {
107
- props: {
108
- ...defaultProps,
109
- modelValue,
110
- "onUpdate:modelValue": (val: AddressSchema) =>
111
- Object.assign(modelValue, val),
112
- },
113
- });
114
-
115
- await wrapper
116
- .find('input[name="billingAddress.street"]')
117
- .setValue("New Street");
118
- expect(modelValue.street).toBe("New Street");
119
- });
120
-
121
- it("shows correction automatically on input after debounce", async () => {
122
- mockGetSuggestions.mockResolvedValue([
123
- {
124
- street: "Corrected Street 123",
125
- city: "Corrected City",
126
- zipcode: "54321",
127
- label: "Corrected Street 123, 54321 Corrected City",
128
- },
129
- ]);
130
-
131
- const modelValue = reactive({
132
- firstName: "John",
133
- lastName: "Doe",
134
- street: "Musterstr 1",
135
- zipcode: "12345",
136
- city: "Musterstadt",
137
- phoneNumber: "12345678",
138
- countryId: "",
139
- });
140
-
141
- const wrapper = await mountSuspended(Fields, {
142
- props: {
143
- ...defaultProps,
144
- modelValue,
145
- },
146
- });
147
-
148
- // Change input to trigger watch
149
- await wrapper
150
- .find('input[name="billingAddress.street"]')
151
- .setValue("Musterstr 2");
152
-
153
- // Wait for debounce and async check
154
- await new Promise((resolve) => setTimeout(resolve, 600));
155
-
156
- expect(wrapper.text()).toContain(
157
- "Meinten Sie: Corrected Street 123, 54321 Corrected City?",
158
- );
159
- });
160
-
161
- it("shows correction when checkAddress is called", async () => {
162
- const modelValue = reactive({
163
- firstName: "John",
164
- lastName: "Doe",
165
- street: "Musterstr 1",
166
- zipcode: "12345",
167
- city: "Musterstadt",
168
- phoneNumber: "12345678",
169
- countryId: "",
170
- });
171
-
172
- const _wrapper = await mountSuspended(Fields, {
173
- props: {
174
- ...defaultProps,
175
- modelValue,
176
- },
177
- });
178
-
179
- // Mock getSuggestions to return a correction
180
- // Note: In a real test we might need to mock useAddressAutocomplete
181
- // But let's see if we can just call the exposed method
182
-
183
- // For this to work reliably in test, we might need to mock useAddressAutocomplete
184
- // since it's used inside checkAddress
185
- });
186
-
187
- it("shows correction automatically on input after debounce even for short street names", async () => {
188
- mockGetSuggestions.mockResolvedValueOnce([
189
- {
190
- street: "B 1",
191
- city: "Berlin",
192
- zipcode: "10115",
193
- label: "B 1, 10115 Berlin",
194
- },
195
- ]);
196
-
197
- const modelValue = reactive({
198
- firstName: "John",
199
- lastName: "Doe",
200
- street: "",
201
- zipcode: "10115",
202
- city: "Berlin",
203
- phoneNumber: "12345678",
204
- countryId: "",
205
- });
206
-
207
- const wrapper = await mountSuspended(Fields, {
208
- props: {
209
- ...defaultProps,
210
- modelValue,
211
- },
212
- });
213
-
214
- // Change input to trigger watch
215
- await wrapper.find('input[name="billingAddress.street"]').setValue("B1");
216
-
217
- // Wait for debounce and async check
218
- await new Promise((resolve) => setTimeout(resolve, 600));
219
-
220
- expect(wrapper.text()).toContain("Meinten Sie: B 1, 10115 Berlin?");
221
- });
222
- });
@@ -1,67 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
2
- import { mountSuspended } from "@nuxt/test-utils/runtime";
3
- import { renderToString } from "@vue/server-renderer";
4
- import { createSSRApp, h, nextTick } from "vue";
5
- import AnimatedSection from "~/components/AnimatedSection.vue";
6
-
7
- describe("AnimatedSection", () => {
8
- let intersectionCallback: IntersectionObserverCallback;
9
-
10
- beforeEach(() => {
11
- global.IntersectionObserver = vi.fn().mockImplementation(function (
12
- this: IntersectionObserver,
13
- callback: IntersectionObserverCallback,
14
- ) {
15
- intersectionCallback = callback;
16
- this.observe = vi.fn();
17
- this.unobserve = vi.fn();
18
- this.disconnect = vi.fn();
19
- }) as unknown as typeof IntersectionObserver;
20
- vi.stubGlobal("matchMedia", () => ({ matches: false }));
21
- });
22
-
23
- afterEach(() => {
24
- vi.unstubAllGlobals();
25
- });
26
-
27
- it("renders the content visible in the server HTML", async () => {
28
- const app = createSSRApp({
29
- render: () =>
30
- h(AnimatedSection, null, { default: () => h("p", "Pizza Salami") }),
31
- });
32
-
33
- const html = await renderToString(app);
34
-
35
- expect(html).toContain("Pizza Salami");
36
- expect(html).toContain("opacity-100");
37
- expect(html).not.toContain("opacity-0");
38
- });
39
-
40
- it("only hides a section that is out of view after mount, then reveals it", async () => {
41
- const wrapper = await mountSuspended(AnimatedSection, {
42
- slots: { default: () => "Pizza Salami" },
43
- });
44
- const section = wrapper.find("div");
45
-
46
- expect(section.classes()).toContain("opacity-100");
47
-
48
- intersectionCallback(
49
- [
50
- { isIntersecting: false, target: section.element },
51
- ] as unknown as IntersectionObserverEntry[],
52
- {} as IntersectionObserver,
53
- );
54
- await nextTick();
55
- expect(section.classes()).toContain("opacity-0");
56
- expect(section.classes()).toContain("translate-y-20");
57
-
58
- intersectionCallback(
59
- [
60
- { isIntersecting: true, target: section.element },
61
- ] as unknown as IntersectionObserverEntry[],
62
- {} as IntersectionObserver,
63
- );
64
- await nextTick();
65
- expect(section.classes()).toContain("opacity-100");
66
- });
67
- });