File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,20 @@ const { startCase } = require('lodash');
44
55/** @typedef {import('axe-core').RuleMetadata } RuleMeta */
66
7+ /**
8+ * Additional rules which are disabled by default.
9+ * Typically these are added because the rule doesn't
10+ * work correctly in some or all webhint contexts.
11+ */
12+ const disabledRules = new Set ( [
13+ /**
14+ * Disabled due to false-positives in jsdom contexts.
15+ * Occurs because jsdom reports `display: none` for `<svg><title>`.
16+ * See https://github.com/webhintio/hint/issues/5030.
17+ */
18+ 'svg-img-alt'
19+ ] ) ;
20+
721/**
822 * @param {string } str
923 */
@@ -33,7 +47,7 @@ const escapeKey = (id) => {
3347 * @param {RuleMeta } rule
3448 */
3549const isRuleDisabled = ( rule ) => {
36- return rule . tags . includes ( 'experimental' ) || rule . tags . every ( ( tag ) => {
50+ return disabledRules . has ( rule . ruleId ) || rule . tags . includes ( 'experimental' ) || rule . tags . every ( ( tag ) => {
3751 return ! tag . startsWith ( 'wcag' ) ;
3852 } ) ;
3953} ;
Original file line number Diff line number Diff line change 1+ import { generateHTMLPage } from '@hint/utils-create-server' ;
2+ import { getHintPath , HintTest , testHint } from '@hint/utils-tests-helpers' ;
3+
4+ const hintPath = getHintPath ( __filename , true ) ;
5+
6+ const html = {
7+ role : generateHTMLPage ( undefined , `
8+ <div>
9+ <h1>test</h1>
10+ <svg role="img"><title>test</title></svg>
11+ </div>` )
12+ } ;
13+
14+ const tests : HintTest [ ] = [
15+ {
16+ name : `HTML passes an svg with role` ,
17+ serverConfig : html . role
18+ }
19+ ] ;
20+
21+ testHint ( hintPath , tests ) ;
You can’t perform that action at this time.
0 commit comments