Skip to content

Commit 5136bb5

Browse files
committed
Update test
1 parent bfdbb80 commit 5136bb5

File tree

2 files changed

+98
-1
lines changed

2 files changed

+98
-1
lines changed

src/__tests__/Button.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ describe('Button', () => {
9191
})
9292

9393
it('styles icon only button to make it a square', async () => {
94-
const container = render(<IconButton icon={SearchIcon} iconLabel="Search icon only button" />)
94+
const container = render(<IconButton icon={SearchIcon} aria-label="Search button" />)
9595
const IconOnlyButton = await container.findByRole('button')
9696
expect(IconOnlyButton).toHaveStyleRule('padding-right', '8px')
97+
expect(IconOnlyButton).toMatchSnapshot()
9798
})
9899
})

src/__tests__/__snapshots__/Button.test.tsx.snap

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,102 @@ exports[`Button styles danger button appropriately 1`] = `
205205
</button>
206206
`;
207207

208+
exports[`Button styles icon only button to make it a square 1`] = `
209+
.c1 {
210+
display: inline-block;
211+
}
212+
213+
.c0 {
214+
border-radius: 2;
215+
border: 1px solid;
216+
font-family: inherit;
217+
font-weight: bold;
218+
line-height: 20px;
219+
white-space: nowrap;
220+
vertical-align: middle;
221+
cursor: pointer;
222+
-webkit-appearance: none;
223+
-moz-appearance: none;
224+
appearance: none;
225+
-webkit-user-select: none;
226+
-moz-user-select: none;
227+
-ms-user-select: none;
228+
user-select: none;
229+
-webkit-text-decoration: none;
230+
text-decoration: none;
231+
text-align: center;
232+
padding-top: 5px;
233+
padding-bottom: 5px;
234+
padding-left: 8px;
235+
padding-right: 8px;
236+
font-size: 14px;
237+
color: btn.text;
238+
background-color: btn.bg;
239+
box-shadow: undefined,undefined;
240+
}
241+
242+
.c0:focus {
243+
outline: none;
244+
}
245+
246+
.c0:disabled {
247+
cursor: default;
248+
color: primer.fg.disabled;
249+
background-color: btn.disabledBg;
250+
}
251+
252+
.c0:disabled svg {
253+
opacity: 0.6;
254+
}
255+
256+
.c0 [data-component="ButtonCounter"] {
257+
font-size: 14px;
258+
}
259+
260+
.c0:hover:not([disabled]) {
261+
background-color: btn.hoverBg;
262+
}
263+
264+
.c0:focus:not([disabled]) {
265+
box-shadow: undefined;
266+
}
267+
268+
.c0:active:not([disabled]) {
269+
background-color: btn.activeBg;
270+
border-color: btn.activeBorder;
271+
}
272+
273+
.c0[aria-expanded=true] {
274+
background-color: btn.activeBg;
275+
border-color: btn.activeBorder;
276+
}
277+
278+
<button
279+
aria-label="Search button"
280+
class="c0"
281+
>
282+
<span
283+
class="c1"
284+
>
285+
<svg
286+
aria-hidden="true"
287+
class="octicon octicon-search"
288+
fill="currentColor"
289+
height="16"
290+
role="img"
291+
style="display: inline-block; user-select: none; vertical-align: text-bottom; overflow: visible;"
292+
viewBox="0 0 16 16"
293+
width="16"
294+
>
295+
<path
296+
d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"
297+
fill-rule="evenodd"
298+
/>
299+
</svg>
300+
</span>
301+
</button>
302+
`;
303+
208304
exports[`Button styles invisible button appropriately 1`] = `
209305
.c0 {
210306
border-radius: 2;

0 commit comments

Comments
 (0)