Skip to content

Commit

Permalink
Merge pull request #426 from NYPL/SCC-4409/my-account-qa-3
Browse files Browse the repository at this point in the history
My Account 2.0 QA round 4
  • Loading branch information
7emansell authored Jan 2, 2025
2 parents 626168b + 747e18c commit e1fd0bd
Show file tree
Hide file tree
Showing 7 changed files with 1,669 additions and 2,830 deletions.
4 changes: 3 additions & 1 deletion __test__/pages/bib/bibPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ describe("Bib Page Item Table", () => {
)
await userEvent.click(screen.getByText("View all 26 items").closest("a"))
expect(
screen.getByText("Loading all 26 items. This may take a few moments...")
screen.queryAllByText(
"Loading all 26 items. This may take a few moments..."
)[0]
).toBeInTheDocument()
})

Expand Down
4,476 changes: 1,650 additions & 2,826 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"coverage": "jest --coverage"
},
"dependencies": {
"@nypl/design-system-react-components": "3.4.0",
"@nypl/design-system-react-components": "3.5.1",
"@nypl/nypl-data-api-client": "1.0.5",
"@nypl/pickup-time-estimator": "^1.5.2",
"@nypl/sierra-wrapper": "1.1.0",
Expand Down
1 change: 1 addition & 0 deletions src/components/MyAccount/Settings/PasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const PasswordFormField = forwardRef<TextInputRefType, PasswordFormFieldProps>(
onChange={handler}
invalidText="Pin/passwords do not match."
isInvalid={isInvalid}
isClearable
/>
</Flex>
)
Expand Down
13 changes: 11 additions & 2 deletions src/components/MyAccount/Settings/SettingsInputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ const SettingsInputForm = ({
updatedInputs[index] = value
setTempInputs(updatedInputs)

const firstInputEmpty = index === 0
const firstInput = index === 0

if (firstInputEmpty && (!value || !validateInput(value, updatedInputs))) {
if (firstInput && (!value || !validateInput(value, updatedInputs))) {
setError(true)
} else {
const hasInvalidInput = updatedInputs.some(
Expand Down Expand Up @@ -127,6 +127,13 @@ const SettingsInputForm = ({
setError(hasInvalidInput)
}

const handleClearableCallback = (index) => {
const updatedInputs = [...tempInputs]
updatedInputs[index] = ""
setTempInputs(updatedInputs)
setError(true)
}

const cancelEditing = () => {
setTempInputs([...inputs])
setIsEditing(false)
Expand Down Expand Up @@ -224,6 +231,8 @@ const SettingsInputForm = ({
invalidText={formUtils.errorMessage}
onChange={(e) => handleInputChange(e, index)}
isRequired
isClearable
isClearableCallback={() => handleClearableCallback(index)}
/>
{index == 0 && <div style={{ width: "57px" }}> </div>}
{index !== 0 && (
Expand Down
1 change: 1 addition & 0 deletions src/components/MyAccount/Settings/SettingsSelectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ const SettingsSelectForm = ({
sx={{
width: { base: "80%", sm: "320px" },
marginLeft: { base: "m", lg: "unset" },
marginTop: "-xxs",
}}
content="Please set a phone number or email address to choose a notification preference."
/>
Expand Down
2 changes: 2 additions & 0 deletions src/components/MyAccount/Settings/UsernameForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ const UsernameForm = ({ patron, usernameState }: UsernameFormProps) => {
isInvalid={error && !validateUsername(tempUsername)}
showHelperInvalidText={true}
onChange={handleInputChange}
isClearable
isClearableCallback={() => setError(true)}
/>
<Button
aria-label="Delete username from your account"
Expand Down

0 comments on commit e1fd0bd

Please sign in to comment.