unocss-preset-primitives
unocss-preset-primitives copied to clipboard
feat(autocomplete): add autocomplete
I was interested what this preset does and so I looked at the source code. I saw that there was no autocomplete so I added it. Currently only tested in the playground. Might test it later on a project with Kobalte
thank you @FlorianDevPhynix, it's possible to
- [ ] lint
- [ ] add some tests
thank you @FlorianDevPhynix, it's possible to
- [ ] lint
- [ ] add some tests
Not sure what to test here. All of this is just for the editor.
The default preset also has no tests and lints for the autocomplete https://github.com/unocss/unocss/tree/main/packages/preset-mini/src/_variants
autocomplete test example
https://github.com/unocss/unocss/blob/main/test/autocomplete-fuzzy.test.ts
lint
npm run lint --fix
Ok, I did lint fix and it added a single semicolon. I definitely can write some tests based on this
https://github.com/unocss/unocss/blob/main/test/autocomplete-fuzzy.test.ts
I will have to added @unocss/autocomplete as a dev dependency.
Should I wrap all the different preset describe's in autocomplete-fuzzy?
describe('autocomplete-fuzzy', () => {
describe('unocss-preset-headlessui', () => { ... })
...
})
yep
add the test file to the test folder
test/autocomplte.test.ts
OK, the test are done. Let me know what I should improve.
How about we try a more straightforward method?
describe('unocss-preset-kobalte', async () => {
const uno = createGenerator({
rules: [['foo', { name: 'foo' }], ['bar', { name: 'bar' }]],
presets: [presetKobalte()],
})
const ac = createAutocomplete(uno, {
matchType: 'fuzzy',
})
it('check against impl', async () => {
expect(await ac.suggest('uicl'))
.include('ui-closed:')
expect(await ac.suggest('uincl'))
.include('ui-not-closed:')
})
})
thank you @FlorianDevPhynix take a look at the new release