-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(toggle-group): migrate single and multiple groups to a singl…
…e component (#318) * refactor: toggle group single and multiple to one component * fix: test * fix: ariaChecked
- Loading branch information
1 parent
480b68e
commit 5286457
Showing
14 changed files
with
234 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
184 changes: 0 additions & 184 deletions
184
packages/components/roving-focus/src/roving-focus.test.ts
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
packages/components/roving-focus/tests/__snapshots__/roving-focus.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`OkuRovingFocusGroup > OkuRovingFocusGroupItem aschild > empty 1`] = ` | ||
<div | ||
data-v-app="" | ||
> | ||
<div | ||
style="outline-color: none; outline-style: none; outline-width: initial;" | ||
tabindex="-1" | ||
> | ||
<!----> | ||
<!----> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`OkuRovingFocusGroup > OkuRovingFocusGroupItem aschild > one button 1`] = ` | ||
<div | ||
data-v-app="" | ||
> | ||
<div | ||
style="outline-color: none; outline-style: none; outline-width: initial;" | ||
tabindex="-1" | ||
> | ||
<button | ||
data-oku-collection-item="" | ||
tabindex="-1" | ||
> | ||
button | ||
</button> | ||
</div> | ||
</div> | ||
`; |
47 changes: 47 additions & 0 deletions
47
packages/components/roving-focus/tests/roving-focus.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
|
||
import type { Component } from 'vue' | ||
import { h } from 'vue' | ||
import { OkuRovingFocusGroup, OkuRovingFocusGroupItem } from '../src' | ||
|
||
const component = { | ||
setup(props, { slots, attrs }) { | ||
return () => h(OkuRovingFocusGroup, attrs, slots) | ||
}, | ||
} as Component | ||
|
||
describe('OkuRovingFocusGroup', () => { | ||
describe('OkuRovingFocusGroupItem aschild', () => { | ||
it('empty', () => { | ||
const com = mount(component, { | ||
slots: { | ||
default: () => [ | ||
h(OkuRovingFocusGroupItem, { | ||
asChild: true, | ||
}), | ||
h(OkuRovingFocusGroupItem, { | ||
asChild: true, | ||
}), | ||
], | ||
}, | ||
}) | ||
expect(com.element).toMatchSnapshot() | ||
}) | ||
|
||
it('one button', async () => { | ||
const com = mount(component, { | ||
slots: { | ||
default: () => [ | ||
h(OkuRovingFocusGroupItem, { | ||
asChild: true, | ||
}, { | ||
default: () => h('button', {}, 'button'), | ||
}), | ||
], | ||
}, | ||
}) | ||
expect(com.element).toMatchSnapshot() | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.