Saving Form Data
The preceding chapter introduced Playwright and SvelteKit routes. The data in our /birthdays
route was hardcoded. In this chapter, we’ll force the real implementation of the load
function by adding the ability to add new birthdays into the system.
Figure 4.1 shows the new form we’ll be building. It is attached to the bottom of the birthday list at the /
birthdays
route:
Figure 4.1 – The form for adding a new birthday
This chapter covers the following key topics:
- Adding a Playwright test for data input
- Test-driving a SvelteKit form
- Test-driving a SvelteKit form action
By the end of the chapter, you’ll have a good understanding of how to test-drive SvelteKit forms.