다른 사람 자리 줄: PC·태블릿에서 옆 스크롤 대신 여러 줄로 고르게 쌓기 (구십구·원카드·도블)
- lib/seat-rows.ts: 게임 칸 실제 폭으로 한 줄 칸 수를 정하고 줄마다 고르게 나눔(9 → 5 + 4) - 720px 이상에서만 적용, 휴대폰은 한 줄 옆 밀기 그대로 - docs/07 3.5에 규칙 추가 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
19
apps/web/src/lib/seat-rows.test.ts
Normal file
19
apps/web/src/lib/seat-rows.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { expect, test } from 'bun:test';
|
||||
import { seatCols, seatsPerRow } from './seat-rows';
|
||||
|
||||
test('seatCols keeps one row when it fits and balances rows when it wraps', () => {
|
||||
expect(seatCols(0, 8)).toBe(1);
|
||||
expect(seatCols(3, 8)).toBe(3);
|
||||
expect(seatCols(8, 8)).toBe(8);
|
||||
expect(seatCols(9, 8)).toBe(5);
|
||||
expect(seatCols(9, 5)).toBe(5);
|
||||
expect(seatCols(6, 5)).toBe(3);
|
||||
expect(seatCols(7, 5)).toBe(4);
|
||||
});
|
||||
|
||||
test('seatsPerRow counts whole seats including gaps', () => {
|
||||
expect(seatsPerRow(1000, 118, 8)).toBe(8);
|
||||
expect(seatsPerRow(999, 118, 8)).toBe(7);
|
||||
expect(seatsPerRow(652, 118, 8)).toBe(5);
|
||||
expect(seatsPerRow(50, 118, 8)).toBe(1);
|
||||
});
|
||||
Reference in New Issue
Block a user