-
Notifications
You must be signed in to change notification settings - Fork 0
chore: use shoehorn #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: use shoehorn #152
Changes from all commits
0b6fcf3
57b5eb2
10fd0da
d259cb7
c620e30
5069f5c
4dab0d4
2adec77
f9c4032
779b040
5b2239e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||
| import "@testing-library/jest-dom/vitest" | ||||||
| import { render, screen } from "@mcansh/remix-testing-library" | ||||||
| import { describe, expect, it } from "vitest" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Find direct imports from vite/vitest in TS/TSX files.
# Expectation: no direct imports from "vite" or "vitest"; test APIs should come from "vite-plus/test".
rg -nP 'from\s+["'\''](?:vite|vitest)(?:/[^"'\'']*)?["'\'']' --type ts --type tsx -C2Repository: mcansh/remix-wordle Length of output: 90 🏁 Script executed: # Search for direct vitest/vite imports in test files
rg 'from\s+["\'](?:vite|vitest)' app/components/keyboard.test.tsx
# Also check the specific line in context
head -20 app/components/keyboard.test.tsx | cat -nRepository: mcansh/remix-wordle Length of output: 215 🏁 Script executed: cat -n app/components/keyboard.test.tsx | head -10Repository: mcansh/remix-wordle Length of output: 457 🏁 Script executed: # Check full file for vitest imports
grep -n "vitest" app/components/keyboard.test.tsx
# Check if vite-plus is configured
cat package.json | grep -A5 -B5 "vite-plus"Repository: mcansh/remix-wordle Length of output: 636 Import test APIs from Line 3 imports directly from -import { describe, expect, it } from "vitest"
+import { describe, expect, it } from "vite-plus/test"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| import { LetterState } from "#app/utils/game.ts" | ||||||
|
|
||||||
| import { Keyboard } from "./keyboard" | ||||||
|
|
||||||
| describe("Keyboard", () => { | ||||||
| it("renders all keyboard letters as buttons", () => { | ||||||
| let Component = Keyboard() | ||||||
| render( | ||||||
| Component({ | ||||||
| board: [ | ||||||
| [ | ||||||
| { letter: "q", state: LetterState.Blank }, | ||||||
| { letter: "w", state: LetterState.Match }, | ||||||
| ], | ||||||
| [{ letter: "a", state: LetterState.Present }], | ||||||
| [{ letter: "z", state: LetterState.Miss }], | ||||||
| ], | ||||||
| }), | ||||||
| ) | ||||||
|
|
||||||
| let letters = ["q", "w", "a", "z"] | ||||||
| for (let letter of letters) { | ||||||
| let button = screen.getByRole("button", { name: `keyboard letter ${letter}` }) | ||||||
| expect(button).toHaveTextContent(letter) | ||||||
| } | ||||||
| }) | ||||||
| }) | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,13 +15,15 @@ export function Keyboard() { | |
| > | ||
| {row.map((letter) => { | ||
| return ( | ||
| <div | ||
| <button | ||
| type="button" | ||
| data-state={letter.state} | ||
| class={`flex size-10 items-center justify-center rounded text-center text-white uppercase data-[state=Blank]:bg-gray-400 data-[state=Match]:bg-green-500 data-[state=Miss]:bg-red-500 data-[state=Present]:bg-yellow-500`} | ||
| key={`keyboard-letter-${letter.letter}`} | ||
| aria-label={`keyboard letter ${letter.letter}`} | ||
| > | ||
| {letter.letter} | ||
| </div> | ||
| </button> | ||
|
Comment on lines
+18
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Inspect keyboard usage and possible delegated click handling.
# Expectation: if keyboard keys remain buttons, there should be a click/activation path that inserts the letter.
rg -n -C4 '<Keyboard|Keyboard\\(|keyboard-letter|keyboard letter|onClick|on\\("click"' --type ts --type tsxRepository: mcansh/remix-wordle Length of output: 254 🏁 Script executed: #!/bin/bash
# Fixed search for Keyboard component usage and click handlers
echo "=== Files containing Keyboard component usage ==="
rg -l "Keyboard" --type ts --type tsx
echo -e "\n=== Looking for click handlers in keyboard.tsx ==="
cat app/components/keyboard.tsx
echo -e "\n=== Searching for Keyboard component instantiation and usage ==="
rg "Keyboard\(" --type ts --type tsx -A3 -B3
echo -e "\n=== Looking for button click handlers in the file ==="
rg "onClick|on:click" app/components/keyboard.tsxRepository: mcansh/remix-wordle Length of output: 1430 🏁 Script executed: #!/bin/bash
# Find where Keyboard component is imported and used
echo "=== Searching for imports of keyboard component ==="
rg "from.*keyboard|import.*Keyboard" --type=ts --type=js
echo -e "\n=== Searching for Keyboard usage in game files ==="
rg -l "board" app/components/ | head -5 | while read f; do echo "File: $f"; head -20 "$f"; done
echo -e "\n=== Check all component files for Keyboard or keyboard usage ==="
find app/components -type f -name "*.tsx" -o -name "*.ts" | head -20
echo -e "\n=== Looking for event delegation patterns ==="
rg "delegate|addEventListener|onClickCapture" --type=ts --type=js -B2 -A2Repository: mcansh/remix-wordle Length of output: 3736 🏁 Script executed: #!/bin/bash
# Check parent component implementations
echo "=== home/page.tsx content (where Keyboard is used) ==="
cat app/controllers/home/page.tsx
echo -e "\n=== history/game.tsx content (where Keyboard is used) ==="
cat app/controllers/history/game.tsxRepository: mcansh/remix-wordle Length of output: 5584 Use non-interactive elements for keyboard status display. These buttons are focusable and announced as interactive, but clicking them does nothing. Since the keyboard serves only to display letter states (matched, missed, present), not for user input, use 🤖 Prompt for AI Agents |
||
| ) | ||
| })} | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -2,3 +2,4 @@ export const WORD_LENGTH = 5 | |||
| export const LETTER_INPUTS = [...Array(WORD_LENGTH).keys()] | ||||
| export const TOTAL_GUESSES = 6 | ||||
| export const REVEAL_WORD = "cheat" | ||||
|
||||
| export const REVEAL_WORD = "cheat" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ import type { Controller } from "remix/fetch-router" | |
| import { redirect } from "remix/response/redirect" | ||
| import { Session } from "remix/session" | ||
|
|
||
| import { REVEAL_WORD, WORD_LENGTH } from "#app/constants.ts" | ||
| import { CHEAT_SESSION_KEY, WORD_LENGTH } from "#app/constants.ts" | ||
| import { getReturnToQuery, requireAuth } from "#app/middleware/auth.ts" | ||
| import { createGuess, getFullBoard, getTodaysGame, isGameComplete } from "#app/models/game.ts" | ||
| import { routes } from "#app/routes.ts" | ||
|
|
@@ -65,7 +65,11 @@ export const home = { | |
| session.flash("error", error) | ||
| } | ||
|
|
||
| return redirect(routes.home.index.href(undefined, data.value.cheat ? { cheat: "true" } : {})) | ||
| if (data.value.cheat) { | ||
| session.set(CHEAT_SESSION_KEY, true) | ||
| } | ||
|
|
||
| return redirect(routes.home.index.href()) | ||
|
Comment on lines
+68
to
+72
|
||
| }, | ||
|
|
||
| async index(context) { | ||
|
|
@@ -81,7 +85,7 @@ export const home = { | |
|
|
||
| let showModal = isGameComplete(game.status) | ||
|
|
||
| let showWord = showModal || context.url.searchParams.has(REVEAL_WORD) ? board.word : undefined | ||
| let showWord = showModal || session.get(CHEAT_SESSION_KEY) === true ? board.word : undefined | ||
|
|
||
| let errorMessage = session.get("error") || undefined | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 90
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 479
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 1466
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 1205
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 408
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 707
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 463
🏁 Script executed:
Repository: mcansh/remix-wordle
Length of output: 392
Import test APIs from
vite-plus/testinstead ofvitest.Line 3 imports directly from
vitest, but per project guidelines, test APIs should be imported from the vite-plus wrapper.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents