@@ -215,6 +215,30 @@ ruleTester.run('jsx-indent', rule, {
215
215
'</div>'
216
216
] . join ( '\n' ) ,
217
217
parserOptions : parserOptions
218
+ } , {
219
+ code : [
220
+ '<div>' ,
221
+ ' { this.props.asd.length > 0 ? <Button className="bacon-yay">{this.props.asd.length}</Button> : (' ,
222
+ ' <span className="bacon-no-trigger">0</span>' ,
223
+ ' ) }' ,
224
+ '</div>'
225
+ ] . join ( '\n' ) ,
226
+ parserOptions : parserOptions
227
+ } , {
228
+ code : [
229
+ '<div>' ,
230
+ ' {' ,
231
+ ' this.props.asd.length > 0' ,
232
+ ' ? (' ,
233
+ ' <Button className="bacon-yay">{this.props.asd.length}</Button>' ,
234
+ ' )' ,
235
+ ' : (' ,
236
+ ' <span className="bacon-no-trigger">0</span>' ,
237
+ ' )' ,
238
+ ' }' ,
239
+ '</div>'
240
+ ] . join ( '\n' ) ,
241
+ parserOptions : parserOptions
218
242
} ] ,
219
243
220
244
invalid : [ {
@@ -504,5 +528,63 @@ ruleTester.run('jsx-indent', rule, {
504
528
line : 4 ,
505
529
column : 5
506
530
} ]
531
+ } , {
532
+ code : [
533
+ '<div>' ,
534
+ ' {this.props.asd.length > 0 ? <Button className="bacon-yay">{this.props.asd.length}</Button> : (' ,
535
+ ' <span className="bacon-no-trigger">0</span>' ,
536
+ ' )}' ,
537
+ '</div>'
538
+ ] . join ( '\n' ) ,
539
+ output : [
540
+ '<div>' ,
541
+ ' {this.props.asd.length > 0 ? <Button className="bacon-yay">{this.props.asd.length}</Button> : (' ,
542
+ ' <span className="bacon-no-trigger">0</span>' ,
543
+ ' )}' ,
544
+ '</div>'
545
+ ] . join ( '\n' ) ,
546
+ parserOptions : parserOptions ,
547
+ errors : [ {
548
+ message : 'Expected indentation of 8 space characters but found 4.' ,
549
+ line : 3 ,
550
+ column : 5
551
+ } ]
552
+ } , {
553
+ code : [
554
+ '<div>' ,
555
+ ' {' ,
556
+ ' this.props.asd.length > 0' ,
557
+ ' ? (' ,
558
+ ' <Button className="bacon-yay">{this.props.asd.length}</Button>' ,
559
+ ' )' ,
560
+ ' : (' ,
561
+ ' <span className="bacon-no-trigger">0</span>' ,
562
+ ' )' ,
563
+ ' }' ,
564
+ '</div>'
565
+ ] . join ( '\n' ) ,
566
+ output : [
567
+ '<div>' ,
568
+ ' {' ,
569
+ ' this.props.asd.length > 0' ,
570
+ ' ? (' ,
571
+ ' <Button className="bacon-yay">{this.props.asd.length}</Button>' ,
572
+ ' )' ,
573
+ ' : (' ,
574
+ ' <span className="bacon-no-trigger">0</span>' ,
575
+ ' )' ,
576
+ ' }' ,
577
+ '</div>'
578
+ ] . join ( '\n' ) ,
579
+ parserOptions : parserOptions ,
580
+ errors : [ {
581
+ message : 'Expected indentation of 12 space characters but found 8.' ,
582
+ line : 5 ,
583
+ column : 9
584
+ } , {
585
+ message : 'Expected indentation of 12 space characters but found 14.' ,
586
+ line : 8 ,
587
+ column : 15
588
+ } ]
507
589
} ]
508
590
} ) ;
0 commit comments