Files
log-lottery/__test__/ElementPosition.test.ts
xiaoshi-jiang 1b983d2a2e 抽中卡片增加>30 <40的卡片排列生成规则
* Update defaultTitle for the lottery event

* Update style.scss

* Update style.scss

* feat: set single-time max person count to 40

* fix: support totalCount > 30 in useElementPosition with dynamic rule and add test

* chore: ✏️ 处理eslint报错和恢复默认标题 #240

---------

Co-authored-by: heldenti <heldenti@users.noreply>
Co-authored-by: LOG1997 <2694233102@qq.com>
2026-01-31 20:52:53 +08:00

19 lines
687 B
TypeScript

import { describe, it, expect } from 'vitest'
import { useElementPosition } from '@/hooks/useElement'
describe('useElementPosition', () => {
it('works for totalCount = 40 without throwing', () => {
const element = {} as any
const count = 10
const totalCount = 40
const cardSize = { width: 140, height: 200 }
const windowSize = { width: 800, height: 600 }
const cardIndex = 0
const result = useElementPosition(element, count, totalCount, cardSize, windowSize, cardIndex)
expect(result).toHaveProperty('xTable')
expect(result).toHaveProperty('yTable')
expect(result).toHaveProperty('scale')
expect(typeof result.scale).toBe('number')
})
})