-
Notifications
You must be signed in to change notification settings - Fork 6
fix: emoji picker and page icon design spec violations (#186) #197
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
218da21
fix: emoji picker and page icon design spec violations (#186)
zacharias-ona ec0b784
fix: [ci-fix] responsive emoji grid columns to prevent mobile overflow
zacharias-ona bb75fed
Merge branch 'main' into fix/186-emoji-picker-design-spec
zacharias-ona 4bde847
fix: [ci-fix] remove transition-opacity from hover-reveal wrapper
zacharias-ona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { readFileSync } from "fs"; | ||
| import { resolve } from "path"; | ||
|
|
||
| /** | ||
| * Regression tests for issue #186: UI does not match design spec after PR #185. | ||
| * | ||
| * These tests verify that emoji-picker and page-icon source files comply with | ||
| * the design spec constraints for touch targets, input styling, mobile | ||
| * visibility, and responsive width. | ||
| */ | ||
|
|
||
| function readSource(relativePath: string): string { | ||
| return readFileSync(resolve(__dirname, relativePath), "utf-8"); | ||
| } | ||
|
|
||
| describe("emoji-picker design spec compliance", () => { | ||
| const source = readSource("./emoji-picker.tsx"); | ||
|
|
||
| it("emoji buttons have 44px minimum touch target on mobile", () => { | ||
| // Design spec: "Touch targets: minimum 44px on mobile." | ||
| // Emoji buttons must use min-h-[44px] and min-w-[44px] for mobile. | ||
| expect(source).toContain("min-h-[44px]"); | ||
| expect(source).toContain("min-w-[44px]"); | ||
| }); | ||
|
|
||
| it("filter input has border per input spec", () => { | ||
| // Design spec: Inputs should have border-white/[0.06] border. | ||
| const precedingClass = source.match( | ||
| /className="[^"]*border border-white\/\[0\.06\][^"]*"[\s\S]*?aria-label="Filter emojis"/ | ||
| ); | ||
| expect(precedingClass).not.toBeNull(); | ||
| }); | ||
|
|
||
| it("filter input has focus ring per input spec", () => { | ||
| // Design spec: Inputs should have ring-2 ring-ring on focus. | ||
| const inputSection = source.match( | ||
| /className="[^"]*"[\s\S]*?aria-label="Filter emojis"/ | ||
| ); | ||
| expect(inputSection).not.toBeNull(); | ||
| expect(inputSection![0]).toContain("focus:ring-2"); | ||
| expect(inputSection![0]).toContain("focus:ring-ring"); | ||
| }); | ||
|
|
||
| it("picker uses responsive width to avoid mobile clipping", () => { | ||
| // Design spec: "No horizontal scroll on any breakpoint." | ||
| // The picker must not use a fixed w-72 without a mobile-responsive alternative. | ||
| expect(source).toContain("sm:w-72"); | ||
| // Must have a viewport-relative width for mobile | ||
| expect(source).toMatch(/w-\[calc\(100vw/); | ||
| }); | ||
| }); | ||
|
|
||
| describe("page-icon design spec compliance", () => { | ||
| const source = readSource("./page-icon.tsx"); | ||
|
|
||
| it("page icon button has 44px minimum touch target on mobile", () => { | ||
| // Design spec: "Touch targets: minimum 44px on mobile." | ||
| expect(source).toContain("min-h-[44px]"); | ||
| expect(source).toContain("min-w-[44px]"); | ||
| }); | ||
|
|
||
| it("add-icon button is visible on mobile (not hover-only)", () => { | ||
| // Design spec: Touch targets must be accessible on mobile. | ||
| // The button container must not rely solely on group-hover for visibility. | ||
| // It should use max-sm:opacity-100 or similar to be visible on touch devices. | ||
| expect(source).toContain("max-sm:opacity-100"); | ||
| }); | ||
|
|
||
| it("add-icon button has 44px minimum touch target on mobile", () => { | ||
| // The "Add icon" button must meet the 44px minimum on mobile. | ||
| const addIconSection = source.match( | ||
| /aria-label="Add page icon"[\s\S]{0,50}/ | ||
| ); | ||
| expect(addIconSection).not.toBeNull(); | ||
|
|
||
| const classSection = source.match( | ||
| /className="[^"]*min-h-\[44px\][^"]*"[\s\S]*?aria-label="Add page icon"/ | ||
| ); | ||
| expect(classSection).not.toBeNull(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.