Skip to content

Commit

Permalink
✅ test: onsubmit hook for kbd/mouse selection
Browse files Browse the repository at this point in the history
  • Loading branch information
niketpathak committed Sep 6, 2022
1 parent b77c736 commit eddeeec
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cypress/e2e/typeahead-testable.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,18 @@ context('Typeahead', () => {
it('Executes onSubmit hook', () => {
cy.get('#input-eleven').as('input11').type('dar', { delay: 100 });
cy.get('.typeahead-test-eleven .tt-list').as('list').children().should('have.length', 4);

// select value via kbd
cy.get('@input11').type('{downarrow}{enter}');
cy.get('.onsubmit_test').should('contain.text', '#DBLD');

// select value via mouse
cy.get('@input11').clear().type('p');
cy.get('@list').children().first().click();
cy.get('@input11').type('{enter}');
cy.get('.onsubmit_test').should('contain.text', '#PR');

// submit without selecting a value
cy.get('@input11').clear().type('dar{enter}');
cy.get('.onsubmit_test').should('contain.text', 'Passed');
});
Expand Down

0 comments on commit eddeeec

Please sign in to comment.