Skip to content

Commit 0bcb610

Browse files
committed
chore: satisify some AI
1 parent 29a9f75 commit 0bcb610

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

app/composables/useVisibleItems.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export function useVisibleItems<T>(
1212
return showAll.value ? list : list.slice(0, limit)
1313
})
1414

15-
const hiddenCount = computed(() => Math.max(0, toValue(items).length - limit))
15+
const hiddenCount = computed(() =>
16+
showAll.value ? 0 : Math.max(0, toValue(items).length - limit),
17+
)
1618

1719
const hasMore = computed(() => !showAll.value && toValue(items).length > limit)
1820

test/unit/app/composables/use-visible-items.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ describe('useVisibleItems', () => {
4242
describe('expand()', () => {
4343
it('shows all items after expand', () => {
4444
const items = [1, 2, 3, 4, 5, 6]
45-
const { visibleItems, hasMore, expand } = useVisibleItems(items, 3)
45+
const { visibleItems, hasMore, hiddenCount, expand } = useVisibleItems(items, 3)
4646

4747
expect(visibleItems.value).toEqual([1, 2, 3])
4848

4949
expand()
5050

5151
expect(visibleItems.value).toEqual([1, 2, 3, 4, 5, 6])
5252
expect(hasMore.value).toBe(false)
53+
expect(hiddenCount.value).toBe(0)
5354
})
5455
})
5556

0 commit comments

Comments
 (0)