Skip to content

Commit

Permalink
Backport two custom Behat steps which were part of upgrade commits bu…
Browse files Browse the repository at this point in the history
…t which should be part of legacy branches as well
  • Loading branch information
abias committed Jan 6, 2025
1 parent c876b39 commit eadf879
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/behat/behat_theme_boost_union_base_general.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit eadf879

Please sign in to comment.