Skip to content

Commit 22e1cde

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
test(emcn): consolidate bulk-action button coverage
1 parent 86af6a9 commit 22e1cde

1 file changed

Lines changed: 26 additions & 29 deletions

File tree

‎packages/emcn/src/components/bulk-action-button/bulk-action-button.test.tsx‎

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,31 @@ const PREVIOUS_GEOMETRY =
3636

3737
describe('BulkActionButton', () => {
3838
for (const surface of [undefined, 'adaptive', 'uniform'] as const) {
39-
for (const disabled of [false, true]) {
40-
it(`preserves the previous button markup for ${surface ?? 'default'} / disabled=${disabled}`, () => {
41-
const previousFill =
42-
surface === 'uniform'
43-
? 'bg-[var(--surface-5)]'
44-
: 'bg-[var(--surface-5)] dark:bg-[var(--surface-4)]'
45-
const view = mount(
46-
<>
47-
<Button
48-
variant='ghost'
49-
aria-label='Delete'
50-
disabled={disabled}
51-
className={`${previousFill} ${PREVIOUS_GEOMETRY}`}
52-
>
53-
<svg className='size-[12px]' aria-hidden='true' />
54-
</Button>
55-
<BulkActionButton aria-label='Delete' surface={surface} disabled={disabled}>
56-
<svg className='size-[12px]' aria-hidden='true' />
57-
</BulkActionButton>
58-
</>
59-
)
60-
const [previous, current] = view.querySelectorAll('button')
61-
/** Class order changes when composing recipes; the resolved utility set must not. */
62-
previous.className = previous.className.split(/\s+/).sort().join(' ')
63-
current.className = current.className.split(/\s+/).sort().join(' ')
64-
expect(current.outerHTML).toBe(previous.outerHTML)
65-
})
66-
}
39+
it(`preserves the previous button markup for ${surface ?? 'default'}`, () => {
40+
const previousFill =
41+
surface === 'uniform'
42+
? 'bg-[var(--surface-5)]'
43+
: 'bg-[var(--surface-5)] dark:bg-[var(--surface-4)]'
44+
const view = mount(
45+
<>
46+
<Button
47+
variant='ghost'
48+
aria-label='Delete'
49+
className={`${previousFill} ${PREVIOUS_GEOMETRY}`}
50+
>
51+
<svg className='size-[12px]' aria-hidden='true' />
52+
</Button>
53+
<BulkActionButton aria-label='Delete' surface={surface}>
54+
<svg className='size-[12px]' aria-hidden='true' />
55+
</BulkActionButton>
56+
</>
57+
)
58+
const [previous, current] = view.querySelectorAll('button')
59+
/** Class order changes when composing recipes; the resolved utility set must not. */
60+
previous.className = previous.className.split(/\s+/).sort().join(' ')
61+
current.className = current.className.split(/\s+/).sort().join(' ')
62+
expect(current.outerHTML).toBe(previous.outerHTML)
63+
})
6764
}
6865

6966
it('forwards the native ref, attributes and original events', () => {
@@ -99,7 +96,7 @@ describe('BulkActionButton', () => {
9996
expect(onClick).not.toHaveBeenCalled()
10097
})
10198

102-
for (const type of [undefined, 'button', 'submit'] as const) {
99+
for (const type of [undefined, 'button'] as const) {
103100
it(`preserves native form behavior for type=${type ?? 'omitted'}`, () => {
104101
const onSubmit = vi.fn((event) => event.preventDefault())
105102
mount(

0 commit comments

Comments
 (0)