mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-75985 behat: Standardise HTML output when comparing editor content
This commit adds a standardise_html function and updates the matches function to compare normalised content. This allows for a wider variety of valid editor output to be handled using the standard value matching steps in Behat, thus supporting editors other than Atto better.
This commit is contained in:
parent
3bc792b9b8
commit
febd5d944c
3 changed files with 72 additions and 6 deletions
|
@ -1776,7 +1776,17 @@ EOF;
|
|||
* @param string $keys The key, or list of keys, to type
|
||||
*/
|
||||
public function i_type(string $keys): void {
|
||||
behat_base::type_keys($this->getSession(), str_split($keys));
|
||||
// Certain keys, such as the newline character, must be converted to the appropriate character code.
|
||||
// Without this, keys will behave differently depending on the browser.
|
||||
$keylist = array_map(function($key): string {
|
||||
switch ($key) {
|
||||
case '\n':
|
||||
behat_keys::ENTER;
|
||||
default:
|
||||
return $key;
|
||||
}
|
||||
}, str_split($keys));
|
||||
behat_base::type_keys($this->getSession(), $keylist);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue