@@ -6,9 +6,9 @@ import {Testimonial} from './Testimonial'
6
6
7
7
expect . extend ( toHaveNoViolations )
8
8
9
- const leftDoubleQuote = '“'
10
-
11
9
describe ( 'Testimonial' , ( ) => {
10
+ const leftDoubleQuote = '“'
11
+
12
12
const mockQuote = 'GitHub helps us ensure that we have our security controls baked into our pipelines.'
13
13
const mockName = 'David Ross'
14
14
const mockPosition = 'Staff Security Engineer'
@@ -52,7 +52,7 @@ describe('Testimonial', () => {
52
52
expect ( quoteMark ) . toHaveClass ( 'Testimonial__quoteMark--default' )
53
53
} )
54
54
55
- it ( 'applies custom className ' , ( ) => {
55
+ it ( 'allows forwarding of custom classes ' , ( ) => {
56
56
const { getByRole} = render (
57
57
< Testimonial className = "custom-testimonial" >
58
58
< Testimonial . Quote > Quote text</ Testimonial . Quote >
@@ -62,6 +62,7 @@ describe('Testimonial', () => {
62
62
63
63
const figure = getByRole ( 'figure' )
64
64
expect ( figure ) . toHaveClass ( 'custom-testimonial' )
65
+ expect ( figure ) . toHaveClass ( 'Testimonial' )
65
66
} )
66
67
67
68
it ( 'supports RefObject for Testimonial component' , ( ) => {
@@ -332,19 +333,6 @@ describe('Testimonial', () => {
332
333
expect ( avatar ) . toHaveAttribute ( 'src' , mockAvatarSrc )
333
334
} )
334
335
335
- it ( 'applies testimonial avatar class' , ( ) => {
336
- const { getByAltText} = render (
337
- < Testimonial >
338
- < Testimonial . Quote > Quote text</ Testimonial . Quote >
339
- < Testimonial . Name > Name</ Testimonial . Name >
340
- < Testimonial . Avatar src = { mockAvatarSrc } alt = { mockAvatarAlt } />
341
- </ Testimonial > ,
342
- )
343
-
344
- const avatarContainer = getByAltText ( mockAvatarAlt )
345
- expect ( avatarContainer ) . toBeInTheDocument ( )
346
- } )
347
-
348
336
it ( 'uses fixed avatar size of 48px' , ( ) => {
349
337
const { getByAltText} = render (
350
338
< Testimonial >
@@ -438,30 +426,6 @@ describe('Testimonial', () => {
438
426
expect ( quoteIndex ) . toBeLessThan ( nameIndex )
439
427
} )
440
428
441
- it ( 'renders avatar, logo, and name in media section' , ( ) => {
442
- const { container, getByRole, getByText} = render (
443
- < Testimonial >
444
- < Testimonial . Quote > Quote text</ Testimonial . Quote >
445
- < Testimonial . Avatar src = { mockAvatarSrc } alt = { mockAvatarAlt } />
446
- < Testimonial . Logo >
447
- < img src = "/logo.png" alt = "Logo" />
448
- </ Testimonial . Logo >
449
- < Testimonial . Name > { mockName } </ Testimonial . Name >
450
- </ Testimonial > ,
451
- )
452
-
453
- const mediaSection = container . querySelector ( '.Testimonial__media' )
454
- expect ( mediaSection ) . toBeInTheDocument ( )
455
-
456
- const avatar = getByRole ( 'img' , { name : mockAvatarAlt } )
457
- const logo = getByRole ( 'img' , { name : 'Logo' } )
458
- const name = getByText ( mockName )
459
-
460
- expect ( mediaSection ) . toContainElement ( avatar )
461
- expect ( mediaSection ) . toContainElement ( logo )
462
- expect ( mediaSection ) . toContainElement ( name )
463
- } )
464
-
465
429
it ( 'uses semantic HTML structure' , ( ) => {
466
430
const { getByRole, getByText} = render ( < DefaultTestimonial /> )
467
431
@@ -500,7 +464,7 @@ describe('Testimonial', () => {
500
464
expect ( name ) . toBeInTheDocument ( )
501
465
} )
502
466
503
- it ( 'handles mixed children types' , ( ) => {
467
+ it ( "filters out children that aren't part of the Testimonial namespace" , ( ) => {
504
468
const { getByText, queryByText} = render (
505
469
< Testimonial >
506
470
< div > Invalid child</ div >
0 commit comments