docs: Added trigger, scrollTo, scrollIntoView to main sidebar #358

This commit is contained in:
Jennifer Shehane
2017-08-17 12:29:30 -04:00
parent c056a02117
commit 78a7a58b53
5 changed files with 57 additions and 21 deletions

View File

@@ -79,6 +79,13 @@ module.exports = function yields (hexo, args) {
</ul>`
}
const scrollability = () => {
return `<ul>
<li><p>${childCmdDom}.</p></li>
<li><p>${cmd} requires the element to be scrollable.</p></li>
</ul>`
}
const submitability = () => {
return `<ul>
<li><p>${childCmdDom}.</p></li>
@@ -175,6 +182,8 @@ module.exports = function yields (hexo, args) {
return checkability()
case 'selectability':
return selectability()
case 'scrollability':
return scrollability()
case 'submitability':
return submitability()
case 'spread':

View File

@@ -104,8 +104,8 @@ api:
root: root.html
route: route.html
screenshot: screenshot.html
# scrollintoview: scrollintoview.html
# scrollto: scrollto.html
scrollintoview: scrollintoview.html
scrollto: scrollto.html
select: select.html
server: server.html
setcookie: setcookie.html
@@ -118,7 +118,7 @@ api:
then: then.html
tick: tick.html
title: title.html
# trigger: trigger.html
trigger: trigger.html
type: type.html
uncheck: uncheck.html
url: url.html

View File

@@ -54,7 +54,7 @@ Option | Default | Description
***Snapshots do not reflect scroll behavior***
*Cypress does not reflect the accurate scroll positions of any elements within snapshots.* If you want to see the actual scrolling behavior in action, we recommend using {% url `.pause()` pause %} to walk through each command or {% url 'watching the video of the test run' screenshots-and-videos.html#Videos %}.
*Cypress does not reflect the accurate scroll positions of any elements within snapshots.* If you want to see the actual scrolling behavior in action, we recommend using {% url `.pause()` pause %} to walk through each command or {% url 'watching the video of the test run' screenshots-and-videos#Videos %}.
# Rules

View File

@@ -3,8 +3,6 @@ title: scrollTo
comments: false
---
THIS DOCUMENT NEEDS ITS USAGE, REQUIREMENTS, ASSERTIONS, AND TIMEOUTS FIXED
Scroll to a specific position.
# Syntax
@@ -14,11 +12,18 @@ cy.scrollTo(position)
cy.scrollTo(x, y)
cy.scrollTo(position, options)
cy.scrollTo(x, y, options)
// ---or---
.scrollTo(position)
.scrollTo(x, y)
.scrollTo(position, options)
.scrollTo(x, y, options)
```
## Usage
`cy.scrollTo()` can be chained off of `cy` to scroll to a position in the window or chained off another cy command that *yields* a DOM element - limiting scrolling to it's yielded element.
**{% fa fa-check-circle green %} Correct Usage**
```javascript
cy.scrollTo(0, 500) // Scroll the window 500px down
@@ -62,18 +67,6 @@ Option | Default | Description
{% yields same_subject cy.scrollTo %}
## Timeouts {% helper_icon timeout %}
`cy.scrollTo()` will wait until the window or element is in a 'scrollable' state for the duration of the {% url `defaultCommandTimeout` configuration#Timeouts %} or the duration of the `timeout` specified in the command's options.
## Requirements {% helper_icon requirements %}
{% requirements scrollability .scrollTo %}
## Timeouts {% helper_icon timeout %}
{% timeouts assertions .scrollTo %}
# Examples
## Position
@@ -126,11 +119,45 @@ cy.get('#slider').scrollTo('right', { duration: 2000} )
# Notes
## Actionability
`cy.scrollTo()` is an "action command" that follows all the rules {% url 'defined here' interacting-with-elements %}.
## Scopes
`cy.scrollTo()` acts differently whether its starting a series of commands or being chained off of an existing.
***When starting a series of commands:***
This scrolls the `window`.
```javascript
cy.scrollTo('bottom')
```
***When chained to an existing series of commands:***
This will scroll the `<#checkout-items>` element.
```javascript
cy.get('#checkout-items').scrollTo('right')
```
## Snapshots
***Snapshots do not reflect scroll behavior***
*Cypress does not reflect the accurate scroll positions of any elements within snapshots.* If you want to see the actual scrolling behavior in action, we recommend using {% url `.pause()` pause %} to walk through each command or {% url 'watching the video of the test run' screenshots-and-videos.html#Videos %}.
*Cypress does not reflect the accurate scroll positions of any elements within snapshots.* If you want to see the actual scrolling behavior in action, we recommend using {% url `.pause()` pause %} to walk through each command or {% url 'watching the video of the test run' screenshots-and-videos#Videos %}.
# Rules
## Requirements {% helper_icon requirements %}
{% requirements scrollability .scrollTo %}
## Timeouts {% helper_icon timeout %}
{% timeouts assertions .scrollTo %}
# Command Log

View File

@@ -84,7 +84,7 @@ cy.get('button').trigger('mouseover') // yields 'button'
***Drag and Drop***
{% note info %}
{% url 'Check out our example recipe triggering mouse and drag events to test dragging and dropping' drag-and-drop %}
{% url 'Check out our example recipe triggering mouse and drag events to test dragging and dropping' testing-the-dom-recipe %}
{% endnote %}
## Change Event