Download react-hook-form/cypress/e2e/setValueWithSchema.cy.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/cypress/e2e/setValueWithSchema.cy.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-hook-form/cypress/e2e/setValueWithSchema.cy.ts
-
curl -L -o setValueWithSchema.cy.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/cypress/e2e/setValueWithSchema.cy.ts
1.04 kB
| describe('form setValue with schema', () => { | |
| it('should set input value, trigger validation and clear all errors', () => { | |
| cy.visit('http://localhost:3000/setValueWithSchema'); | |
| cy.get('input[name="firstName"]').type('a'); | |
| cy.get('input[name="firstName"] + p').contains('firstName error'); | |
| cy.get('p').should('have.length', 1); | |
| cy.get('input[name="firstName"]').type('asdasdasdasd'); | |
| cy.get('input[name="lastName"]').type('a'); | |
| cy.get('input[name="lastName"] + p').contains('lastName error'); | |
| cy.get('p').should('have.length', 1); | |
| cy.get('input[name="lastName"]').type('asdasdasdasd'); | |
| cy.get('input[name="age"]').type('a2323'); | |
| cy.get('#submit').click(); | |
| cy.get('p').should('have.length', 1); | |
| cy.get('input[name="requiredField"] + p').contains('RequiredField error'); | |
| cy.get('#setValue').click(); | |
| cy.get('input[name="requiredField"]').should('have.value', 'test123456789'); | |
| cy.get('p').should('have.length', 0); | |
| cy.get('#renderCount').contains('35'); | |
| }); | |
| }); | |