Skip to content

Commit 4b8e588

Browse files
committed
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.
1 parent d05450f commit 4b8e588

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

admin/tool/brickfield/classes/local/htmlchecker/common/checks/img_alt_is_too_long.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function check(): void {
3737
global $alttextlengthlimit;
3838

3939
foreach ($this->get_all_elements('img') as $img) {
40-
$alttextlengthlimit = 125;
40+
$alttextlengthlimit = 750;
4141
if ($img->hasAttribute('alt') && core_text::strlen($img->getAttribute('alt')) > $alttextlengthlimit) {
4242
$this->add_report($img);
4343
}

admin/tool/brickfield/tests/local/htmlchecker/common/checks/img_alt_is_too_long_test.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ protected function get_test_html(string $alttext): string {
6464
*/
6565
public static function img_alt_text_provider(): array {
6666
return [
67-
'Alt text <= 125 characters' => [
67+
'Alt text <= 750 characters' => [
6868
true,
69-
str_repeat("Hello world!", 10),
69+
str_repeat("Hello world!", 60),
7070
],
71-
'Alt text > 125 characters' => [
71+
'Alt text > 750 characters' => [
7272
false,
73-
str_repeat("Hello world!", 25),
73+
str_repeat("Hello world!", 65),
7474
],
75-
'Multi-byte alt text <= 125 characters' => [
75+
'Multi-byte alt text <= 750 characters' => [
7676
true,
77-
str_repeat('こんにちは、世界!', 13),
77+
str_repeat('こんにちは、世界!', 83),
7878
],
79-
'Multi-byte alt text > 125 characters' => [
79+
'Multi-byte alt text > 750 characters' => [
8080
false,
81-
str_repeat('こんにちは、世界!', 30),
81+
str_repeat('こんにちは、世界!', 90),
8282
],
8383
];
8484
}
@@ -96,7 +96,7 @@ public function test_check(bool $expectedpass, string $alttext): void {
9696
if ($expectedpass) {
9797
$this->assertEmpty($results);
9898
} else {
99-
$this->assertTrue($results[0]->element->tagName === 'img');
99+
$this->assertEquals('img', $results[0]->element->tagName);
100100
}
101101
}
102102
}

0 commit comments

Comments
 (0)