MDL-83634 tool_brickfield: Increase the alt text limit to 750 characters
This is consistent with the alt-text length limit of 750 characters in Moodle's editor.
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ class img_alt_is_too_long extends brickfield_accessibility_test {
|
||||
global $alttextlengthlimit;
|
||||
|
||||
foreach ($this->get_all_elements('img') as $img) {
|
||||
$alttextlengthlimit = 125;
|
||||
$alttextlengthlimit = 750;
|
||||
if ($img->hasAttribute('alt') && core_text::strlen($img->getAttribute('alt')) > $alttextlengthlimit) {
|
||||
$this->add_report($img);
|
||||
}
|
||||
|
||||
+9
-9
@@ -64,21 +64,21 @@ EOD;
|
||||
*/
|
||||
public static function img_alt_text_provider(): array {
|
||||
return [
|
||||
'Alt text <= 125 characters' => [
|
||||
'Alt text <= 750 characters' => [
|
||||
true,
|
||||
str_repeat("Hello world!", 10),
|
||||
str_repeat("Hello world!", 60),
|
||||
],
|
||||
'Alt text > 125 characters' => [
|
||||
'Alt text > 750 characters' => [
|
||||
false,
|
||||
str_repeat("Hello world!", 25),
|
||||
str_repeat("Hello world!", 65),
|
||||
],
|
||||
'Multi-byte alt text <= 125 characters' => [
|
||||
'Multi-byte alt text <= 750 characters' => [
|
||||
true,
|
||||
str_repeat('こんにちは、世界!', 13),
|
||||
str_repeat('こんにちは、世界!', 83),
|
||||
],
|
||||
'Multi-byte alt text > 125 characters' => [
|
||||
'Multi-byte alt text > 750 characters' => [
|
||||
false,
|
||||
str_repeat('こんにちは、世界!', 30),
|
||||
str_repeat('こんにちは、世界!', 90),
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -96,7 +96,7 @@ EOD;
|
||||
if ($expectedpass) {
|
||||
$this->assertEmpty($results);
|
||||
} else {
|
||||
$this->assertTrue($results[0]->element->tagName === 'img');
|
||||
$this->assertEquals('img', $results[0]->element->tagName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user