Skip to content

Commit

Permalink
fix: enable localized number inputs for price notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Apr 18, 2024
1 parent a67cf06 commit 1618b05
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,14 @@ describe('Product Notification Edit Dialog Component', () => {
component.productNotificationForm = fb.group({
alertType: ['price'],
email: ['jlink@test.intershop.de', [Validators.required, SpecialValidators.email]],
priceValue: [1000, [SpecialValidators.moneyAmount]],
priceValue: [1000],
});

expect(component.formDisabled).toBeFalse();
component.submitForm();
expect(component.formDisabled).toBeFalse();
});

it('should not submit a form when the user does not provide money format for price notification', () => {
component.productNotificationForm = fb.group({
priceValue: ['abc', [SpecialValidators.moneyAmount]],
});

expect(component.formDisabled).toBeFalse();
component.submitForm();
expect(component.formDisabled).toBeTrue();
});

it('should emit delete product notification when alert type is delete', () => {
component.productNotificationForm = fb.group({
alertType: ['delete'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AppFacade } from 'ish-core/facades/app.facade';
import { ProductContextFacade } from 'ish-core/facades/product-context.facade';
import { Pricing } from 'ish-core/models/price/price.model';
import { ProductView } from 'ish-core/models/product-view/product-view.model';
import { SpecialValidators } from 'ish-shared/forms/validators/special-validators';

import { ProductNotification } from '../../models/product-notification/product-notification.model';

Expand Down Expand Up @@ -169,14 +168,11 @@ export class ProductNotificationEditFormComponent implements OnChanges {
addonLeft: {
text: this.appFacade.currencySymbol$(),
},
},
validators: {
validation: [SpecialValidators.moneyAmount],
mask: 'separator.2',
},
validation: {
messages: {
required: 'product.notification.edit.form.price.error.required',
moneyAmount: 'product.notification.edit.form.price.error.valid',
},
},
},
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,6 @@
"product.notification.edit.form.instock_notification.label": "Benachrichtigen Sie mich, wenn das Produkt wieder auf Lager ist.",
"product.notification.edit.form.no_notification.label": "Ich möchte keine Benachrichtigungen mehr zu diesem Artikel erhalten.",
"product.notification.edit.form.price.error.required": "Geben Sie einen gültigen Geldbetrag ein.",
"product.notification.edit.form.price.error.valid": "Geben Sie einen gültigen Geldbetrag ein.",
"product.notification.edit.form.price.label": "Preis",
"product.notification.edit.form.price_notification.label": "Benachrichtigen Sie mich, falls das Produkt auf folgenden Preis sinkt:",
"product.notification.edit.form.update.button.label": "Aktualisieren",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,6 @@
"product.notification.edit.form.instock_notification.label": "Notify me when the product is back in stock.",
"product.notification.edit.form.no_notification.label": "I no longer wish to receive any notifications about this item.",
"product.notification.edit.form.price.error.required": "Please enter a valid amount of money.",
"product.notification.edit.form.price.error.valid": "Please enter a valid amount of money.",
"product.notification.edit.form.price.label": "Price",
"product.notification.edit.form.price_notification.label": "Notify me if the price drops to:",
"product.notification.edit.form.update.button.label": "Update",
Expand Down
1 change: 0 additions & 1 deletion src/assets/i18n/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,6 @@
"product.notification.edit.form.instock_notification.label": "Prévenez-moi lorsque le produit est de nouveau en stock.",
"product.notification.edit.form.no_notification.label": "Je ne souhaite plus recevoir des nouvelles de cet article.",
"product.notification.edit.form.price.error.required": "Veuillez saisir une valeur monétaire valide.",
"product.notification.edit.form.price.error.valid": "Veuillez saisir une valeur monétaire valide.",
"product.notification.edit.form.price.label": "Prix",
"product.notification.edit.form.price_notification.label": "Prévenez-moi si le prix baisse à :",
"product.notification.edit.form.update.button.label": "Mettre à jour",
Expand Down

0 comments on commit 1618b05

Please sign in to comment.