-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport two custom Behat steps which were part of upgrade commits bu…
…t which should be part of legacy branches as well
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,29 @@ public function dom_element_should_have_computed_style($selector, $style, $value | |
} | ||
} | ||
|
||
/** | ||
* Checks if the given DOM element does not have the given computed style. | ||
* | ||
* @copyright 2024 Alexander Bias <[email protected]> | ||
* @Then DOM element :arg1 should not have computed style :arg2 :arg3 | ||
* @param string $selector | ||
* @param string $style | ||
* @param string $value | ||
* @throws ExpectationException | ||
*/ | ||
public function dom_element_should_not_have_computed_style($selector, $style, $value) { | ||
$stylejs = " | ||
return ( | ||
window.getComputedStyle(document.querySelector('$selector')).getPropertyValue('$style') | ||
) | ||
"; | ||
$computedstyle = $this->evaluate_script($stylejs); | ||
if ($computedstyle == $value) { | ||
throw new ExpectationException('The \''.$selector.'\' DOM element does have the computed style \''. | ||
$style.'\'=\''.$computedstyle.'\', but it should not have it.', $this->getSession()); | ||
} | ||
} | ||
|
||
/** | ||
* Checks if the given DOM element has a background image with the given file name. | ||
* | ||
|
@@ -280,6 +303,15 @@ public function purge_theme_cache_and_reload_theme() { | |
theme_reset_all_caches(); | ||
} | ||
|
||
/** | ||
* Purges all caches | ||
* | ||
* @Given /^all caches are purged$/ | ||
*/ | ||
public function purge_all_caches() { | ||
purge_caches(); | ||
} | ||
|
||
/** | ||
* Disables debugging in Behat. | ||
* | ||
|