diff --git a/tests/lib/rules/no-reserved-component-names.js b/tests/lib/rules/no-reserved-component-names.js index 14ab1334f..41cddcfd5 100644 --- a/tests/lib/rules/no-reserved-component-names.js +++ b/tests/lib/rules/no-reserved-component-names.js @@ -245,7 +245,6 @@ const invalidElements = [ 'menu', 'Menu', 'menuitem', - 'menuitem', 'summary', 'Summary', 'content', diff --git a/tests/lib/rules/this-in-template.js b/tests/lib/rules/this-in-template.js index 6750f2cb3..53896794e 100644 --- a/tests/lib/rules/this-in-template.js +++ b/tests/lib/rules/this-in-template.js @@ -43,10 +43,6 @@ function createValidTests(prefix, options) { code: ``, options }, - { - code: ``, - options - }, { code: ``, options @@ -67,26 +63,6 @@ function createValidTests(prefix, options) { code: ``, options }, - { - code: ``, - options - }, - { - code: ``, - options - }, - { - code: ``, - options - }, - { - code: ``, - options - }, - { - code: ``, - options - }, { code: ``, options - }, - - // We cannot use `.` in dynamic arguments because the right of the `.` becomes a modifier. - { - code: ``, - options } ] } @@ -181,7 +151,7 @@ function createInvalidTests(prefix, options, message, type) { )}bar">`, errors: [{ message, type }], options - }, + } // We cannot use `.` in dynamic arguments because the right of the `.` becomes a modifier. // { @@ -189,22 +159,6 @@ function createInvalidTests(prefix, options, message, type) { // errors: [{ message, type }], // options // } - ...(options[0] === 'always' - ? [] - : [ - { - code: ``, - output: ``, - errors: [{ message, type }], - options - }, - { - code: ``, - output: ``, - errors: [{ message, type }], - options - } - ]) ] } @@ -216,7 +170,41 @@ ruleTester.run('this-in-template', rule, { ...createValidTests('', []), ...createValidTests('', ['never']), ...createValidTests('this.', ['always']), - ...createValidTests('this?.', ['always']) + ...createValidTests('this?.', ['always']), + ...[[], ['never'], ['always']].flatMap((options) => { + const comment = options.join('') + return [ + { + code: ``, + options + }, + { + code: ``, + options + }, + { + code: ``, + options + }, + { + code: ``, + options + }, + { + code: ``, + options + }, + { + code: ``, + options + }, + // We cannot use `.` in dynamic arguments because the right of the `.` becomes a modifier. + { + code: ``, + options + } + ] + }) ], invalid: [ ...createInvalidTests( @@ -244,6 +232,25 @@ ruleTester.run('this-in-template', rule, { 'ThisExpression' ), ...createInvalidTests('', ['always'], "Expected 'this'.", 'Identifier'), + ...[[], ['never']].flatMap((options) => { + const comment = options.join('') + const message = "Unexpected usage of 'this'." + const type = 'ThisExpression' + return [ + { + code: ``, + output: ``, + errors: [{ message, type }], + options + }, + { + code: ``, + output: ``, + errors: [{ message, type }], + options + } + ] + }), { code: ``, output: ``,