-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
766 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const handlers: Array<() => void> = [] | ||
|
||
export function triggerScroll () { | ||
for (const handler of handlers) | ||
handler() | ||
} | ||
|
||
export function onScrollBottom (_: unknown, handler: () => void): void { | ||
handlers.push(handler) | ||
} |
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,88 @@ | ||
import { SelectProps, SelectItem } from '../use-select' | ||
import { useOptionsProp } from './adapter' | ||
|
||
it('should be able to convert Array of String into Array of SelectItem', () => { | ||
const props: SelectProps = { | ||
modelValue: undefined, | ||
selected : undefined, | ||
options : [ | ||
'Apple', | ||
'Grape', | ||
'Orange', | ||
], | ||
} | ||
|
||
const result = useOptionsProp(props) | ||
const expected: SelectItem[] = [ | ||
{ | ||
text : 'Apple', | ||
value: 'Apple', | ||
}, | ||
{ | ||
text : 'Grape', | ||
value: 'Grape', | ||
}, | ||
{ | ||
text : 'Orange', | ||
value: 'Orange', | ||
}, | ||
] | ||
|
||
expect(result.value).toBeArray() | ||
expect(result.value).toStrictEqual(expected) | ||
}) | ||
|
||
it('should be return as is if options is already an Array of SelectItem', () => { | ||
const props: SelectProps = { | ||
modelValue: undefined, | ||
selected : undefined, | ||
options : [ | ||
{ | ||
text : 'Apple', | ||
value: 'Apple', | ||
}, | ||
{ | ||
text : 'Grape', | ||
value: 'Grape', | ||
}, | ||
{ | ||
text : 'Orange', | ||
value: 'Orange', | ||
}, | ||
], | ||
} | ||
|
||
const result = useOptionsProp(props) | ||
const expected: SelectItem[] = [ | ||
{ | ||
text : 'Apple', | ||
value: 'Apple', | ||
}, | ||
{ | ||
text : 'Grape', | ||
value: 'Grape', | ||
}, | ||
{ | ||
text : 'Orange', | ||
value: 'Orange', | ||
}, | ||
] | ||
|
||
expect(result.value).toBeArray() | ||
expect(result.value).toStrictEqual(expected) | ||
}) | ||
|
||
it('should return empty array if props is not valid array', () => { | ||
const props: SelectProps = { | ||
modelValue: undefined, | ||
selected : undefined, | ||
// @ts-expect-error | ||
options : {}, | ||
} | ||
|
||
const result = useOptionsProp(props) | ||
const expected: SelectItem[] = [] | ||
|
||
expect(result.value).toBeArray() | ||
expect(result.value).toStrictEqual(expected) | ||
}) |
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
Oops, something went wrong.