/** * @fileoverview Enforce html element has lang prop. * @author Ethan Cohen */ // ----------------------------------------------------------------------------- // Requirements // ----------------------------------------------------------------------------- import { RuleTester } from 'eslint'; import parserOptionsMapper from '../../__util__/parserOptionsMapper'; import parsers from '../../__util__/helpers/parsers'; import rule from '../../../src/rules/html-has-lang'; // ----------------------------------------------------------------------------- // Tests // ----------------------------------------------------------------------------- const ruleTester = new RuleTester(); const expectedError = { message: '
elements must have the lang prop.', type: 'JSXOpeningElement', }; ruleTester.run('html-has-lang', rule, { valid: parsers.all([].concat( { code: '
;' }, { code: '
' }, { code: '
' }, { code: '
' }, { code: '
' }, { code: '
' }, { code: '', errors: [expectedError], settings: { 'jsx-a11y': { components: { HTMLTop: 'html' } } } }, )).map(parserOptionsMapper), invalid: parsers.all([].concat( { code: '
', errors: [expectedError] }, { code: '
', errors: [expectedError] }, { code: '
', errors: [expectedError] }, { code: '', errors: [expectedError], settings: { 'jsx-a11y': { components: { HTMLTop: 'html' } } } }, )).map(parserOptionsMapper), });