Skip to content

Commit

Permalink
chore(Icon): replace data-test-id with data-testid (#1583)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz authored Sep 28, 2022
1 parent 5219ccd commit 8e85bdb
Show file tree
Hide file tree
Showing 28 changed files with 178 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ exports[`Accordion component have to match snapshot 1`] = `
<span
aria-hidden={true}
className="dnb-icon dnb-icon--medium dnb-icon--inherit-color"
data-test-id="chevron-down icon"
data-testid="chevron-down icon"
role="presentation"
>
<chevron_down_medium>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ describe('Autocomplete component', () => {
.not('.dnb-input__clear-button')
.find('.dnb-icon')
.instance()
.getAttribute('data-test-id')
.getAttribute('data-testid')
).toContain('chevron down')
})

Expand Down Expand Up @@ -1971,7 +1971,7 @@ describe('Autocomplete component', () => {
.not('.dnb-input__clear-button')
.find('.dnb-icon')
.instance()
.getAttribute('data-test-id')
.getAttribute('data-testid')
).toContain('bell')
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ describe('Avatar', () => {
render(
<Avatar.Group label="label">
<Avatar>
<Icon icon={Confetti} data-testid="confetti-icon" />
<Icon icon={Confetti} />
</Avatar>
</Avatar.Group>
)

const avatar = screen.queryByTestId('avatar')
expect(within(avatar).queryByTestId('confetti-icon')).not.toBeNull()
expect(within(avatar).queryByTestId('confetti icon')).not.toBeNull()
expect(screen.queryByTestId('avatar-label')).toBeNull()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,15 @@ describe('Badge', () => {

it('renders children as content', () => {
render(
<Badge
content={<Icon icon={Confetti} data-testid="confetti-icon" />}
>
<Badge content={<Icon icon={Confetti} />}>
<Avatar.Group label="children:">
<Avatar>A</Avatar>
</Avatar.Group>
</Badge>
)

const badgeRoot = screen.queryByTestId('badge-root')
expect(within(badgeRoot).queryByTestId('confetti-icon')).not.toBeNull()
expect(within(badgeRoot).queryByTestId('confetti icon')).not.toBeNull()
})

it('warns when notification badge content is a string', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,11 @@ describe('Breadcrumb', () => {
})

it('will render custom icon', () => {
const CustomIcon = (
<IconPrimary
data-testid="breadcrumb-item-custom-icon"
icon="bell"
/>
)
const CustomIcon = <IconPrimary icon="bell" />
render(<BreadcrumbItem text="Just text" icon={CustomIcon} />)

const element = screen.queryByTestId('breadcrumb-item-custom-icon')
const element = screen.queryByTestId('bell icon')
expect(element).not.toBeNull()
expect(element.getAttribute('data-test-id')).toBe('bell icon')
})

it('renders a skeleton if skeleton is true', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`Button component have to match default button snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -82,7 +82,7 @@ exports[`Button component have to match default button snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -166,7 +166,7 @@ exports[`Button component have to match default button snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -210,7 +210,7 @@ exports[`Button component have to match default button snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -282,7 +282,7 @@ exports[`Button component have to match default button snapshot 1`] = `
<span
aria-hidden={true}
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<question>
Expand Down Expand Up @@ -371,7 +371,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -415,7 +415,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -490,7 +490,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -543,7 +543,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -597,7 +597,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -671,7 +671,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -715,7 +715,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -787,7 +787,7 @@ exports[`Button component have to match href="..." snapshot 1`] = `
<span
aria-hidden={true}
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<question>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="calendar icon"
data-testid="calendar icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -1413,7 +1413,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="calendar icon"
data-testid="calendar icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -1485,7 +1485,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="calendar icon"
data-testid="calendar icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -1571,7 +1571,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="calendar icon"
data-testid="calendar icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -1638,7 +1638,7 @@ exports[`DatePicker component have to match snapshot 1`] = `
<span
aria-hidden={true}
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="calendar icon"
data-testid="calendar icon"
role="presentation"
>
<calendar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -220,7 +220,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -308,7 +308,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -376,7 +376,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden={true}
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<question>
Expand Down Expand Up @@ -445,7 +445,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -509,7 +509,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -550,7 +550,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -616,7 +616,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -656,7 +656,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="question icon"
data-testid="question icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -862,7 +862,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
data-testid="close icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -948,7 +948,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden="true"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
data-testid="close icon"
role="presentation"
>
<svg
Expand Down Expand Up @@ -1097,7 +1097,7 @@ exports[`Dialog component snapshot should match component snapshot 1`] = `
<span
aria-hidden={true}
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
data-testid="close icon"
role="presentation"
>
<close>
Expand Down
Loading

0 comments on commit 8e85bdb

Please sign in to comment.