Skip to content

Commit

Permalink
add tests, update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthkp committed Jul 22, 2024
1 parent 17a0922 commit ea6bc8f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
10 changes: 10 additions & 0 deletions packages/react/src/StateLabel/__tests__/StateLabel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ describe('StateLabel', () => {
it('renders children', () => {
expect(render(<StateLabel status="issueOpened">hi</StateLabel>)).toMatchSnapshot()
})

it('adds label to icon', () => {
const screen1 = HTMLRender(<StateLabel status="issueOpened">Open</StateLabel>)
expect(screen1.getByLabelText('Issue')).toBeInTheDocument() // svg
expect(screen1.getByText('Open')).toBeInTheDocument() // text

const screen2 = HTMLRender(<StateLabel status="pullMerged">Merged</StateLabel>)
expect(screen2.getByLabelText('Pull request')).toBeInTheDocument() // svg
expect(screen2.getByText('Merged')).toBeInTheDocument() // text
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ exports[`StateLabel renders children 1`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Issue"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -91,11 +92,12 @@ exports[`StateLabel respects the status prop 1`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Issue"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -149,11 +151,12 @@ exports[`StateLabel respects the status prop 2`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Issue"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -207,11 +210,12 @@ exports[`StateLabel respects the status prop 3`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Issue"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -262,11 +266,12 @@ exports[`StateLabel respects the status prop 4`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Pull request"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -317,11 +322,12 @@ exports[`StateLabel respects the status prop 5`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Pull request"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -372,11 +378,12 @@ exports[`StateLabel respects the variant prop 1`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Issue"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down Expand Up @@ -430,11 +437,12 @@ exports[`StateLabel respects the variant prop 2`] = `
className="c0"
>
<svg
aria-hidden="true"
aria-label="Issue"
className="c1"
fill="currentColor"
focusable="false"
height={16}
role="img"
style={
{
"display": "inline-block",
Expand Down

0 comments on commit ea6bc8f

Please sign in to comment.