Skip to content

Commit 7f20fe5

Browse files
committed
MDL-83634 tool_brickfield: Test the image alt text check's severity
1 parent e232841 commit 7f20fe5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

+14-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424

2525
namespace tool_brickfield\local\htmlchecker\common\checks;
2626

27+
use tool_brickfield\local\htmlchecker\brickfield_accessibility;
28+
2729
defined('MOODLE_INTERNAL') || die();
2830

2931
require_once('all_checks.php');
3032

3133
/**
3234
* Class img_alt_is_too_long_testcase
3335
*
34-
* @covers \tool_brickfield\local\htmlchecker\common\checks\img_alt_is_too_long
36+
* @covers img_alt_is_too_long
3537
*/
3638
final class img_alt_is_too_long_test extends all_checks {
3739
/** @var string Check type */
@@ -99,4 +101,15 @@ public function test_check(bool $expectedpass, string $alttext): void {
99101
$this->assertEquals('img', $results[0]->element->tagName);
100102
}
101103
}
104+
105+
/**
106+
* Test the severity of the {@see img_alt_is_too_long} check.
107+
*
108+
* @return void
109+
*/
110+
public function test_severity() {
111+
$html = $this->get_test_html('Some alt text');
112+
$checker = new brickfield_accessibility($html, 'brickfield', 'string');
113+
$this->assertEquals(brickfield_accessibility::BA_TEST_SUGGESTION, $checker->get_test_severity(img_alt_is_too_long::class));
114+
}
102115
}

0 commit comments

Comments
 (0)