mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #277 from creative-commoners/pulls/5.3/scroll
NEW Add methods for scrolling to top and bottom of edit form panel
This commit is contained in:
commit
1ad9927e43
@ -1181,6 +1181,18 @@ JS;
|
|||||||
$this->getSession()->executeScript($javascript);
|
$this->getSession()->executeScript($javascript);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Given /^I scroll to the bottom of the edit form panel$/
|
||||||
|
*/
|
||||||
|
public function iScrollToTheBottomOfTheEditFormPanel()
|
||||||
|
{
|
||||||
|
$javascript = implode('', [
|
||||||
|
"var el = document.querySelector('.cms #Form_EditForm > .panel,.cms #Form_ItemEditForm > .panel');",
|
||||||
|
"el.scrollTo(0, Math.max(el.scrollHeight, el.scrollHeight, el.clientHeight));",
|
||||||
|
]);
|
||||||
|
$this->getSession()->executeScript($javascript);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Given /^I scroll to the top$/
|
* @Given /^I scroll to the top$/
|
||||||
*/
|
*/
|
||||||
@ -1189,6 +1201,18 @@ JS;
|
|||||||
$this->getSession()->executeScript('window.scrollTo(0,0);');
|
$this->getSession()->executeScript('window.scrollTo(0,0);');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Given /^I scroll to the top of the edit form panel$/
|
||||||
|
*/
|
||||||
|
public function iScrollToTheTopOfTheEditFormPanel()
|
||||||
|
{
|
||||||
|
$javascript = implode('', [
|
||||||
|
"var el = document.querySelector('.cms #Form_EditForm > .panel,.cms #Form_ItemEditForm > .panel');",
|
||||||
|
"el.scrollTo(0, 0);",
|
||||||
|
]);
|
||||||
|
$this->getSession()->executeScript($javascript);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scroll to a certain element by label.
|
* Scroll to a certain element by label.
|
||||||
* Requires an "id" attribute to uniquely identify the element in the document.
|
* Requires an "id" attribute to uniquely identify the element in the document.
|
||||||
|
Loading…
Reference in New Issue
Block a user