Skip to content

Commit c57eac8

Browse files
committed
[Tests] jsx-indent-props, jsx-indent: add passing tests
Fixes #2649
1 parent dbc8e8c commit c57eac8

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

tests/lib/rules/jsx-indent-props.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,37 @@ ruleTester.run('jsx-indent-props', rule, {
303303
},
304304
],
305305
},
306+
{
307+
code: `
308+
<a
309+
role={'button'}
310+
className={\`navbar-burger \${open ? 'is-active' : ''}\`}
311+
href={'#'}
312+
aria-label={'menu'}
313+
aria-expanded={false}
314+
onClick={openMenu}>
315+
<span aria-hidden={'true'}/>
316+
<span aria-hidden={'true'}/>
317+
<span aria-hidden={'true'}/>
318+
</a>
319+
`,
320+
options: [{ indentMode: 2 }],
321+
},
322+
{
323+
code: `
324+
<a role={'button'}
325+
className={\`navbar-burger \${open ? 'is-active' : ''}\`}
326+
href={'#'}
327+
aria-label={'menu'}
328+
aria-expanded={false}
329+
onClick={openMenu}>
330+
<span aria-hidden={'true'}/>
331+
<span aria-hidden={'true'}/>
332+
<span aria-hidden={'true'}/>
333+
</a>
334+
`,
335+
options: ['first'],
336+
},
306337
]),
307338

308339
invalid: parsers.all([

tests/lib/rules/jsx-indent.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,21 @@ const Component = () => (
11621162
`,
11631163
features: ['flow'].concat(semver.satisfies(eslintVersion, '< 8') ? 'no-babel-old' : []),
11641164
},
1165+
{
1166+
code: `
1167+
<a role={'button'}
1168+
className={\`navbar-burger \${open ? 'is-active' : ''}\`}
1169+
href={'#'}
1170+
aria-label={'menu'}
1171+
aria-expanded={false}
1172+
onClick={openMenu}>
1173+
<span aria-hidden={'true'}/>
1174+
<span aria-hidden={'true'}/>
1175+
<span aria-hidden={'true'}/>
1176+
</a>
1177+
`,
1178+
options: [2],
1179+
},
11651180
]),
11661181

11671182
invalid: parsers.all([].concat(

0 commit comments

Comments
 (0)