Skip to content

Conversation

@kepsteen
Copy link
Contributor

@kepsteen kepsteen commented Nov 14, 2024

Closes #634

  • added edit button to Entry Name
  • created entryNameForm
    • added zod validation that string must be between 3 and 50 characters
  • created updateEntryName function to update the Document in DB
  • created onSubmit function to call updateEntryName and update state
  • wrote unit tests for new functionality

Recording 2024-11-18 at 16 58 54

@appwrite
Copy link

appwrite bot commented Nov 14, 2024

Gridiron Survivor Application 6616ea581ef9f5521c7d

Function ID Status Action
Your function has been successfully deployed.

Project name: Gridiron Survivor Application
Project ID: 6616ea581ef9f5521c7d

Function ID Status Action
userAuth 6626fef885a9f630442b ready Ready View Logs

Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.

💡 Did you know?
Appwrite has a Discord community with over 16 000 members. Come join us!

@vercel
Copy link

vercel bot commented Nov 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gridiron-survivor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 1:22am
gridiron-survivor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 1:22am

data,
): Promise<void> => {
const { name } = data;
const entryId: string = entry;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't, I'll fix it

fireEvent.click(screen.getByTestId('edit-entry-name-button'));

const entryNameInput = screen.getByTestId('entry-name-input');
const cancelButton = screen.getByLabelText('Cancel Editing');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not grab elements by text. If the text changes, this test will fail. Instead, add data-testid attribute. This is a unique ID that won't ever change. On top of this, when we add localization, things won't always be in English.

});

const input = screen.getByTestId('entry-name-input');
fireEvent.change(input, { target: { value: 'New Entry Name' } });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. Add a data-testid.

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.

Ability for user to change Entry's name

4 participants