feat(configs/oxlint): add linter
This commit is contained in:
@@ -2,14 +2,14 @@ import { describe, it, expect, vi } from 'vitest';
|
||||
import { nextTick, ref } from 'vue';
|
||||
import { useOffsetPagination } from '.';
|
||||
|
||||
describe('useOffsetPagination', () => {
|
||||
describe(useOffsetPagination, () => {
|
||||
it('initialize with default values without options', () => {
|
||||
const { currentPage, currentPageSize, totalPages, isFirstPage } = useOffsetPagination({});
|
||||
|
||||
expect(currentPage.value).toBe(1);
|
||||
expect(currentPageSize.value).toBe(10);
|
||||
expect(totalPages.value).toBe(Infinity);
|
||||
expect(isFirstPage.value).toBe(true);
|
||||
expect(isFirstPage.value).toBeTruthy();
|
||||
});
|
||||
|
||||
it('calculate total pages correctly', () => {
|
||||
@@ -51,14 +51,14 @@ describe('useOffsetPagination', () => {
|
||||
const { currentPage, isFirstPage, isLastPage } = useOffsetPagination({ total: 20, pageSize: 10 });
|
||||
|
||||
expect(currentPage.value).toBe(1);
|
||||
expect(isFirstPage.value).toBe(true);
|
||||
expect(isLastPage.value).toBe(false);
|
||||
expect(isFirstPage.value).toBeTruthy();
|
||||
expect(isLastPage.value).toBeFalsy();
|
||||
|
||||
currentPage.value = 2;
|
||||
|
||||
expect(currentPage.value).toBe(2);
|
||||
expect(isFirstPage.value).toBe(false);
|
||||
expect(isLastPage.value).toBe(true);
|
||||
expect(isFirstPage.value).toBeFalsy();
|
||||
expect(isLastPage.value).toBeTruthy();
|
||||
});
|
||||
|
||||
it('call onPageChange callback', async () => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { VoidFunction } from '@robonen/stdlib';
|
||||
import { computed, reactive, toValue, watch, type ComputedRef, type MaybeRef, type MaybeRefOrGetter, type UnwrapNestedRefs, type WritableComputedRef } from 'vue';
|
||||
import { computed, reactive, toValue, watch } from 'vue';
|
||||
import type { ComputedRef, MaybeRef, MaybeRefOrGetter, UnwrapNestedRefs, WritableComputedRef } from 'vue';
|
||||
import { useClamp } from '@/composables/math/useClamp';
|
||||
|
||||
// TODO: sync returned refs with passed refs
|
||||
@@ -89,7 +90,7 @@ export function useOffsetPagination(options: UseOffsetPaginationOptions): UseOff
|
||||
|
||||
const next = () => currentPage.value++;
|
||||
const previous = () => currentPage.value--;
|
||||
const select = (page: number) => currentPage.value = page;
|
||||
const select = (page: number) => { currentPage.value = page; };
|
||||
|
||||
const returnValue = {
|
||||
currentPage,
|
||||
|
||||
Reference in New Issue
Block a user