Sha256: ae1de2f3bc4b53a61b94126aed0606246a529858ed52b46a4c8359153947b367

Contents?: true

Size: 1.07 KB

Versions: 104

Compression:

Stored size: 1.07 KB

Contents

/* global reporters */
function configureChecksRulesAndBranding(spec) {
	/*eslint max-statements: ["error",21]*/
	'use strict';
	var audit;

	audit = axe._audit;
	if (!audit) {
		throw new Error('No audit configured');
	}

	if (
		spec.reporter &&
		(typeof spec.reporter === 'function' || reporters[spec.reporter])
	) {
		audit.reporter = spec.reporter;
	}

	if (spec.checks) {
		spec.checks.forEach(function(check) {
			audit.addCheck(check);
		});
	}

	const modifiedRules = [];
	if (spec.rules) {
		spec.rules.forEach(function(rule) {
			modifiedRules.push(rule.id);
			audit.addRule(rule);
		});
	}

	if (spec.disableOtherRules) {
		audit.rules.forEach(rule => {
			if (modifiedRules.includes(rule.id) === false) {
				rule.enabled = false;
			}
		});
	}

	if (typeof spec.branding !== 'undefined') {
		audit.setBranding(spec.branding);
	} else {
		audit._constructHelpUrls();
	}

	if (spec.tagExclude) {
		audit.tagExclude = spec.tagExclude;
	}

	// Support runtime localization
	if (spec.locale) {
		audit.applyLocale(spec.locale);
	}
}

axe.configure = configureChecksRulesAndBranding;

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
govuk_publishing_components-21.16.3 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.16.2 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.16.1 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.16.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.15.2 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.15.1 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.15.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.14.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.13.5 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.13.4 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.13.3 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.13.2 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.13.1 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.13.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.12.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.11.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.10.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.9.0 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.8.1 node_modules/axe-core/lib/core/public/configure.js
govuk_publishing_components-21.8.0 node_modules/axe-core/lib/core/public/configure.js