-
-
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.
feat(roving-focus): new package roving-focus (#275)
* feat: focus * feat: usecomposeEventHanders * feat: usecomposeEventHanders * fix: focus group * fix: focus * fix: export type * fix: ts * fix: imports * chore: add collection test * fix: primitive * fix: child * fix: event * fix: tab index * fix: roving * fix: collection index * chore: change mounted * fix: test * chore: delete useComposeEventHandlers * chore: add more stories * chore: add playground
- Loading branch information
1 parent
b52e436
commit fdcbf96
Showing
61 changed files
with
1,558 additions
and
314 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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { mount } from '@vue/test-utils' | ||
import { describe, expect, it } from 'vitest' | ||
import { h, ref, watchEffect } from 'vue' | ||
import { createCollection } from './collection' | ||
|
||
describe('collection', () => { | ||
it('renders the component correctly', () => { | ||
type ItemData = { disabled?: boolean } | ||
|
||
const { CollectionSlot, CollectionItemSlot, CollectionProvider, useCollection } = createCollection<HTMLLIElement, ItemData>('List', { | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}) | ||
const TestComponent = { | ||
components: { | ||
CollectionSlot, | ||
}, | ||
setup() { | ||
function LogsItem() { | ||
const data = useCollection('List') | ||
const refData = ref() | ||
watchEffect(() => { | ||
if (data.value) | ||
refData.value = data.value | ||
}) | ||
if (refData.value?.[2]?.disabled) | ||
expect('disabled').toBe('disabled') | ||
} | ||
|
||
return () => h(CollectionProvider, {}, { | ||
default: () => h(CollectionSlot, {}, { | ||
default: () => h('ul', { class: 'w-20' }, { | ||
default: () => [ | ||
h(CollectionItemSlot, {}, { | ||
default: () => h('li', {}, 'Item 1'), | ||
}), | ||
h(CollectionItemSlot, {}, { | ||
default: () => h('li', {}, 'Item 2'), | ||
}), | ||
h(CollectionItemSlot, { disabled: true }, { | ||
default: () => h('li', {}, 'Item 3'), | ||
}), | ||
h(LogsItem), | ||
], | ||
}), | ||
}), | ||
}) | ||
}, | ||
} | ||
const wrapper = mount(TestComponent) | ||
|
||
expect(wrapper.html()).toBe(`<ul class="w-20"> | ||
<li data-oku-collection-item="">Item 1</li> | ||
<li data-oku-collection-item="">Item 2</li> | ||
<li data-oku-collection-item="">Item 3</li> | ||
<!----> | ||
</ul>`, | ||
) | ||
}) | ||
}) |
Oops, something went wrong.