From ce48c48bda76472e54e8559ebb4c7a6bf37dd0c2 Mon Sep 17 00:00:00 2001 From: Kevin Deng Date: Thu, 20 Aug 2026 21:03:06 +0900 Subject: [PATCH] Include fifth-form patterns in the default filter (#31) --- scripts/tests/patterns.test.ts | 12 ++++++++++++ shared/patterns.ts | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/tests/patterns.test.ts b/scripts/tests/patterns.test.ts index f85ef3d..e26aba3 100644 --- a/scripts/tests/patterns.test.ts +++ b/scripts/tests/patterns.test.ts @@ -33,6 +33,7 @@ describe('broad difference-pattern choices', () => { expect(patternChoicesMatch('0001', DEFAULT_PATTERN_CHOICES)).toBe(true) expect(patternChoicesMatch('0112', DEFAULT_PATTERN_CHOICES)).toBe(true) expect(patternChoicesMatch('0123', DEFAULT_PATTERN_CHOICES)).toBe(true) + expect(patternChoicesMatch('01234', DEFAULT_PATTERN_CHOICES)).toBe(true) }) it('lets an exact pattern replace its broad group', () => { @@ -40,6 +41,7 @@ describe('broad difference-pattern choices', () => { '0001', 'v3', 'v4', + 'v5', ]) }) @@ -66,6 +68,16 @@ describe('pattern choices and hidden columns', () => { }) describe('pattern choice URL encoding', () => { + it('includes five-form rows in the serialized default', () => { + expect(serializePatternChoices(DEFAULT_PATTERN_CHOICES)).toBe('v2,v3,v4,v5') + }) + + it('keeps an explicit five-form opt-out in the URL', () => { + const value = ['v2', 'v3', 'v4'] + expect(serializePatternChoices(value)).toBe('v2,v3,v4') + expect(parsePatternChoices(serializePatternChoices(value))).toEqual(value) + }) + it('round-trips broad and exact choices', () => { const value = ['v3', '0001', 'v2'] expect(parsePatternChoices(serializePatternChoices(value))).toEqual([ diff --git a/shared/patterns.ts b/shared/patterns.ts index c4a6c9b..4918a00 100644 --- a/shared/patterns.ts +++ b/shared/patterns.ts @@ -7,7 +7,12 @@ import { varietyOf } from './row.ts' */ const VARIETY_CHOICE = /^v([1-9]\d*)$/ -export const DEFAULT_PATTERN_CHOICES = ['v2', 'v3', 'v4'] as const +/** + * Every non-identical variety is on by default, including the fifth form that + * becomes applicable when the opt-in Korean column is shown. Choices that need + * more columns than are currently visible stay serialized but do not filter. + */ +export const DEFAULT_PATTERN_CHOICES = ['v2', 'v3', 'v4', 'v5'] as const export const ALL_PATTERN_CHOICES = 'all' export const varietyChoice = (variety: number): string => `v${variety}` -- 2.51.2