|
1 | 1 | 'use strict' |
2 | 2 |
|
3 | | -//------------------------------------------------------------------------------ |
4 | | -// Requirements |
5 | | -//------------------------------------------------------------------------------ |
6 | | - |
7 | 3 | const rule = require('../../../lib/rules/no-force') |
8 | | - |
9 | 4 | const RuleTester = require('eslint').RuleTester |
10 | 5 |
|
11 | | -const errors = [{ messageId: 'unexpected' }] |
12 | | -const parserOptions = { ecmaVersion: 2018 } |
| 6 | +const ruleTester = new RuleTester() |
13 | 7 |
|
14 | | -//------------------------------------------------------------------------------ |
15 | | -// Tests |
16 | | -//------------------------------------------------------------------------------ |
17 | | - |
18 | | -let ruleTester = new RuleTester() |
| 8 | +const errors = [{ messageId: 'unexpected' }] |
19 | 9 |
|
20 | 10 | ruleTester.run('no-force', rule, { |
21 | 11 |
|
22 | 12 | valid: [ |
23 | | - { code: `cy.get('button').click()`, parserOptions }, |
24 | | - { code: `cy.get('button').click({multiple: true})`, parserOptions }, |
25 | | - { code: `cy.get('button').dblclick()`, parserOptions }, |
26 | | - { code: `cy.get('input').type('somth')`, parserOptions }, |
27 | | - { code: `cy.get('input').type('somth', {anyoption: true})`, parserOptions }, |
28 | | - { code: `cy.get('input').trigger('click', {anyoption: true})`, parserOptions }, |
29 | | - { code: `cy.get('input').rightclick({anyoption: true})`, parserOptions }, |
30 | | - { code: `cy.get('input').check()`, parserOptions }, |
31 | | - { code: `cy.get('input').select()`, parserOptions }, |
32 | | - { code: `cy.get('input').focus()`, parserOptions }, |
33 | | - { code: `cy.document().trigger("keydown", { ...event })`, parserOptions }, |
| 13 | + { code: `cy.get('button').click()` }, |
| 14 | + { code: `cy.get('button').click({multiple: true})` }, |
| 15 | + { code: `cy.get('button').dblclick()` }, |
| 16 | + { code: `cy.get('input').type('somth')` }, |
| 17 | + { code: `cy.get('input').type('somth', {anyoption: true})` }, |
| 18 | + { code: `cy.get('input').trigger('click', {anyoption: true})` }, |
| 19 | + { code: `cy.get('input').rightclick({anyoption: true})` }, |
| 20 | + { code: `cy.get('input').check()` }, |
| 21 | + { code: `cy.get('input').select()` }, |
| 22 | + { code: `cy.get('input').focus()` }, |
| 23 | + { code: `cy.document().trigger("keydown", { ...event })` }, |
34 | 24 | ], |
35 | 25 |
|
36 | 26 | invalid: [ |
37 | | - { code: `cy.get('button').click({force: true})`, parserOptions, errors }, |
38 | | - { code: `cy.get('button').dblclick({force: true})`, parserOptions, errors }, |
39 | | - { code: `cy.get('input').type('somth', {force: true})`, parserOptions, errors }, |
40 | | - { code: `cy.get('div').find('.foo').type('somth', {force: true})`, parserOptions, errors }, |
41 | | - { code: `cy.get('div').find('.foo').find('.bar').click({force: true})`, parserOptions, errors }, |
42 | | - { code: `cy.get('div').find('.foo').find('.bar').trigger('change', {force: true})`, parserOptions, errors }, |
43 | | - { code: `cy.get('input').trigger('click', {force: true})`, parserOptions, errors }, |
44 | | - { code: `cy.get('input').rightclick({force: true})`, parserOptions, errors }, |
45 | | - { code: `cy.get('input').check({force: true})`, parserOptions, errors }, |
46 | | - { code: `cy.get('input').select({force: true})`, parserOptions, errors }, |
47 | | - { code: `cy.get('input').focus({force: true})`, parserOptions, errors }, |
| 27 | + { code: `cy.get('button').click({force: true})`, errors }, |
| 28 | + { code: `cy.get('button').dblclick({force: true})`, errors }, |
| 29 | + { code: `cy.get('input').type('somth', {force: true})`, errors }, |
| 30 | + { code: `cy.get('div').find('.foo').type('somth', {force: true})`, errors }, |
| 31 | + { code: `cy.get('div').find('.foo').find('.bar').click({force: true})`, errors }, |
| 32 | + { code: `cy.get('div').find('.foo').find('.bar').trigger('change', {force: true})`, errors }, |
| 33 | + { code: `cy.get('input').trigger('click', {force: true})`, errors }, |
| 34 | + { code: `cy.get('input').rightclick({force: true})`, errors }, |
| 35 | + { code: `cy.get('input').check({force: true})`, errors }, |
| 36 | + { code: `cy.get('input').select({force: true})`, errors }, |
| 37 | + { code: `cy.get('input').focus({force: true})`, errors }, |
48 | 38 | ], |
49 | 39 | }) |
0 commit comments