February 2019
Beginner
694 pages
18h 4m
English
When working with forms in our applications, there are generally two things that we need to test. The first is the population of values in a form, and the second is retrieving these values once the user has submitted the form. Remember that in large applications, a user will generally either enter new data into a form (to create something), or the user might be modifying existing data through a form (to update something). This is why we need to test setting the initial values of a form. Our test is as follows:
it("should find form-group input with value", () => {
let formGroup = renderedHtml.find('.form-group');
let input = formGroup.find('input');
expect(input.length).toBeGreaterThan(0, 'could not find form-group label'); expect(input.attr('value')).toContain('testName'); ...Read now
Unlock full access