Skip to content

Commit e24e64d

Browse files
committed
apply PR feedback
1 parent 469c8ee commit e24e64d

File tree

1 file changed

+5
-41
lines changed

1 file changed

+5
-41
lines changed

packages/react/src/Testimonial/Testimonial.test.tsx

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {Testimonial} from './Testimonial'
66

77
expect.extend(toHaveNoViolations)
88

9-
const leftDoubleQuote = '“'
10-
119
describe('Testimonial', () => {
10+
const leftDoubleQuote = '“'
11+
1212
const mockQuote = 'GitHub helps us ensure that we have our security controls baked into our pipelines.'
1313
const mockName = 'David Ross'
1414
const mockPosition = 'Staff Security Engineer'
@@ -52,7 +52,7 @@ describe('Testimonial', () => {
5252
expect(quoteMark).toHaveClass('Testimonial__quoteMark--default')
5353
})
5454

55-
it('applies custom className', () => {
55+
it('allows forwarding of custom classes', () => {
5656
const {getByRole} = render(
5757
<Testimonial className="custom-testimonial">
5858
<Testimonial.Quote>Quote text</Testimonial.Quote>
@@ -62,6 +62,7 @@ describe('Testimonial', () => {
6262

6363
const figure = getByRole('figure')
6464
expect(figure).toHaveClass('custom-testimonial')
65+
expect(figure).toHaveClass('Testimonial')
6566
})
6667

6768
it('supports RefObject for Testimonial component', () => {
@@ -332,19 +333,6 @@ describe('Testimonial', () => {
332333
expect(avatar).toHaveAttribute('src', mockAvatarSrc)
333334
})
334335

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-
348336
it('uses fixed avatar size of 48px', () => {
349337
const {getByAltText} = render(
350338
<Testimonial>
@@ -438,30 +426,6 @@ describe('Testimonial', () => {
438426
expect(quoteIndex).toBeLessThan(nameIndex)
439427
})
440428

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-
465429
it('uses semantic HTML structure', () => {
466430
const {getByRole, getByText} = render(<DefaultTestimonial />)
467431

@@ -500,7 +464,7 @@ describe('Testimonial', () => {
500464
expect(name).toBeInTheDocument()
501465
})
502466

503-
it('handles mixed children types', () => {
467+
it("filters out children that aren't part of the Testimonial namespace", () => {
504468
const {getByText, queryByText} = render(
505469
<Testimonial>
506470
<div>Invalid child</div>

0 commit comments

Comments
 (0)