From 17b4165b2845b191f9ed3af33dce93de4bfedcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojtek=20Zieli=C5=84ski?= Date: Thu, 24 Oct 2019 11:25:57 +0200 Subject: [PATCH] Added datalist examples in next() and type() documentation --- source/api/commands/next.md | 17 +++++++++++++++++ source/api/commands/type.md | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/source/api/commands/next.md b/source/api/commands/next.md index e80e07bb89..33c8398a1c 100644 --- a/source/api/commands/next.md +++ b/source/api/commands/next.md @@ -70,6 +70,23 @@ Option | Default | Description cy.get('.second').next() ``` +### Testing a datalist +```html + + + + + + +``` + +```javascript +cy.get('#fruit option') + .first().should('have.text', 'Apple') + .next().should('have.text', 'Banana') + .next().should('have.text', 'Cantaloupe') +``` + ## Selector ### Find the very next sibling of each li. Keep only the ones with a class `selected` diff --git a/source/api/commands/type.md b/source/api/commands/type.md index 2b444db3ed..f6bd41373a 100644 --- a/source/api/commands/type.md +++ b/source/api/commands/type.md @@ -106,6 +106,21 @@ Each keypress is delayed 10ms by default in order to simulate how a very fast us cy.get('[contenteditable]').type('some text!') ``` +### 'Selecting' an option from datalist +For 'selecting' an option, just type it into the input. +```html + + + + + + +``` + +```javascript +cy.get('input').type('Apple') +``` + ## Tabindex ### Type into a non-input or non-textarea element with `tabindex`