From ab4f989dc9e888422de7d88be5f84f0daf6cbeb6 Mon Sep 17 00:00:00 2001 From: Andrew Ting <52696711+hollowscene@users.noreply.github.com> Date: Wed, 23 Sep 2026 23:57:17 +1000 Subject: [PATCH 1/3] fix: stop short word warning triggering on rebuses --- app/__tests__/builderReducer.test.ts | 10 ++++++++++ app/reducers/builderUtils.ts | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/__tests__/builderReducer.test.ts b/app/__tests__/builderReducer.test.ts index f33d1c63..62c3acab 100644 --- a/app/__tests__/builderReducer.test.ts +++ b/app/__tests__/builderReducer.test.ts @@ -95,6 +95,16 @@ test('home and end keyboard events are recognized', () => { expect(fromKeyString('End')).toEqual({ k: KeyK.End }); }); +test('short word warning', () => { + const state = getState(['H', 'I', '.', 'ELLO', '.', '.', '.', '.', '.'], {}); + expect(builderReducer(state, publish).publishWarnings).toMatchInlineSnapshot(` + [ + "Some words are only two letters long (HI)", + "UNCHES", + ] + `); +}); + test('basic enum warnings', () => { const state = getState(['a', 'b', 'c', 'g', '', '', 'd', 'e', 'f'], { abc: 'test with good enum (3)', diff --git a/app/reducers/builderUtils.ts b/app/reducers/builderUtils.ts index adb39ad0..8401139d 100644 --- a/app/reducers/builderUtils.ts +++ b/app/reducers/builderUtils.ts @@ -31,7 +31,7 @@ export function validateGrid(state: BuilderState) { } for (const [i, entry] of state.grid.entries.entries()) { - if (entry.cells.length <= 2) { + if (entry.completedWord && entry.completedWord.length <= 2) { hasNoShortWords = false; } for (let j = 0; j < state.grid.entries.length; j += 1) { @@ -84,7 +84,7 @@ export function getWarningStats(state: BuilderState) { const shortWords = new Set(); for (const [i, entry] of entries.entries()) { - if (entry.cells.length <= 2) { + if (entry.completedWord && entry.completedWord.length <= 2) { shortWords.add(entryWord(grid, i)); } } From 627ba2242aa76cb377543571580cbfc44fb6980b Mon Sep 17 00:00:00 2001 From: Andrew Ting <52696711+hollowscene@users.noreply.github.com> Date: Thu, 24 Sep 2026 10:03:53 +1000 Subject: [PATCH 2/3] docs: visualise test case with unicode crossword --- app/__tests__/builderReducer.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/__tests__/builderReducer.test.ts b/app/__tests__/builderReducer.test.ts index 62c3acab..ebb892bc 100644 --- a/app/__tests__/builderReducer.test.ts +++ b/app/__tests__/builderReducer.test.ts @@ -95,6 +95,13 @@ test('home and end keyboard events are recognized', () => { expect(fromKeyString('End')).toEqual({ k: KeyK.End }); }); +/* +H I █ +^ █ █ +█ █ █ + +^ This square represents the rebus 'ELLO'. +*/ test('short word warning', () => { const state = getState(['H', 'I', '.', 'ELLO', '.', '.', '.', '.', '.'], {}); expect(builderReducer(state, publish).publishWarnings).toMatchInlineSnapshot(` From 1a91f8a41b15c13ed734bcbee807647f1039a1b2 Mon Sep 17 00:00:00 2001 From: Andrew Ting <52696711+hollowscene@users.noreply.github.com> Date: Thu, 24 Sep 2026 11:26:03 +1000 Subject: [PATCH 3/3] test: update short word test to not trigger unches --- app/__tests__/builderReducer.test.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/__tests__/builderReducer.test.ts b/app/__tests__/builderReducer.test.ts index ebb892bc..0a2b53ab 100644 --- a/app/__tests__/builderReducer.test.ts +++ b/app/__tests__/builderReducer.test.ts @@ -96,18 +96,17 @@ test('home and end keyboard events are recognized', () => { }); /* -H I █ -^ █ █ +I D █ +I ^ █ █ █ █ -^ This square represents the rebus 'ELLO'. +^ This cell represents the rebus 'PAD'. */ test('short word warning', () => { - const state = getState(['H', 'I', '.', 'ELLO', '.', '.', '.', '.', '.'], {}); + const state = getState(['I', 'D', '.', 'I', 'PAD', '.', '.', '.', '.'], {}); expect(builderReducer(state, publish).publishWarnings).toMatchInlineSnapshot(` [ - "Some words are only two letters long (HI)", - "UNCHES", + "Some words are only two letters long (ID, II)", ] `); });