Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error messages for adding empty or duplicate items #28

Merged
merged 4 commits into from
Sep 15, 2024

Conversation

Hudamabkhoot
Copy link
Collaborator

Description

This update prevents users from adding empty or duplicate items to their list. Users will receive appropriate error messages if they attempt to submit an empty item or an item that already exists in the list, including variations in casing and punctuation.

Related Issue

Closes #10

Acceptance criteria

  • Show an error message if the user tries to submit an empty item
  • Show an error message if the user tries to submit a new item that is identical to an existing name. For instance, if the list contains apples and the user adds apples.
  • Show an error message if the user tries to submit a new item that matches an existing name with punctuation and casing normalized. For instance, if the list contains apples and the user adds aPples or apples, or a pples.
  • The user’s original input is saved in the database.

Type of Changes

Enhancement

Updates

Before

Screen Shot 2024-09-13 at 13 06 34

After

Screen Shot 2024-09-13 at 12 41 00
Screen Shot 2024-09-13 at 12 41 25
Screen Shot 2024-09-13 at 13 06 51

Testing Steps / QA Criteria

  • Do a git checkout jo-hm-check-item-input and git pull.
  • Open the homepage by running npm start.
  • Navigate to ManageList and attempt to add an empty item, an error message will appear because the input field is required.
  • Trying to add an item that already exists will result in an error message.
  • Test adding an item with different casing or punctuation from an existing item, it should result in an error message.
  • Navigate to List to verify that if the item was not already in the list, it is displayed in the list regardless of error conditions.

Copy link

Visit the preview URL for this PR (updated for commit 083c21e):

https://tcl-79-smart-shopping-list--pr28-jo-hm-check-item-inp-iig44emo.web.app

(expires Fri, 20 Sep 2024 10:18:20 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: d91d9ddbda780208241c52942f544acf8e81407a

Copy link
Collaborator

@redapy redapy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done, LGTM!

@Hudamabkhoot Hudamabkhoot merged commit 4f123b4 into main Sep 15, 2024
2 checks passed
@Hudamabkhoot Hudamabkhoot deleted the jo-hm-check-item-input branch September 15, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10. As a user, I want to be alerted when I’m entering an empty item or an item that's already on my list
3 participants