Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fdietze committed Dec 15, 2022
1 parent 70cfab8 commit f8a4cc3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ Formidable defines a typeclass [`Form[T]`](formidable/src/main/scala/Form.scala)

Automatic derivation is achieved using [Magnolia](https://github.com/softwaremill/magnolia).

It keeps backups of already entered data wherever it can, to help the user.



23 changes: 23 additions & 0 deletions cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,27 @@ describe('Form interactions', () => {
cy.get('.value').should('have.text', 'Some(15)')
})
})

it('backup entered values (Option in case class)', () => {
cy.get('.Company').within(($form) => {
cy.contains('tr', 'address:').find('input[type="checkbox"]').check()
cy.contains('tr', 'city:').find('input[type="text"]').clear().type('Madrid')
cy.contains('tr', 'address:').find('input[type="checkbox"]').uncheck()
cy.contains('tr', 'address:').find('input[type="checkbox"]').check()
cy.get('.value').should('have.text', 'Company(,Some(Address(Madrid,)))') // test default value
})
})

it.only('backup entered values (nested sum types)', () => {
cy.get('.GenericLinkedList\\[Pet\\]').within(($form) => {
cy.get('select').select('Cons')
cy.contains('tr', 'name:').find('input[type="text"]').clear().type('Dog')
cy.contains('tr', 'head:').within(($form) => {
cy.get('select').select('Dog')
cy.get('select').select('Cat')
})

cy.get('.value').should('have.text', 'Cons(Cat(Dog,4),Nil)')
})
})
})

0 comments on commit f8a4cc3

Please sign in to comment.