Skip to content

Closes #503 feat:Added fireMouse and click helpers#667

Open
Yazhini74 wants to merge 3 commits into
Karanjot786:mainfrom
Yazhini74:add-mouse-click-tests
Open

Closes #503 feat:Added fireMouse and click helpers#667
Yazhini74 wants to merge 3 commits into
Karanjot786:mainfrom
Yazhini74:add-mouse-click-tests

Conversation

@Yazhini74
Copy link
Copy Markdown
Contributor

@Yazhini74 Yazhini74 commented Jun 4, 2026

Description

Implemented fireMouse and click helpers in the TestInstance returned by render() to simulate mouse interactions at terminal cell coordinates.

Changes Made

  • Added fireMouse(x, y) helper for mouse event simulation
  • Added click(x, y) helper for full click interaction testing
  • Enabled hit-grid and hover handler testing in render harness
  • Added test coverage for mouse interactions using Vitest

Related Issue

Closes #503

Summary by CodeRabbit

  • New Features
    • Added a Solarized Light built-in theme option.
    • Added a Tokyo Night theme alias for easier access.
    • Enhanced testing utilities with mouse event simulation and a click helper to simulate pointer interactions.

@Yazhini74 Yazhini74 requested a review from Karanjot786 as a code owner June 4, 2026 06:37
@github-actions github-actions Bot added type:docs +5 pts. Documentation. area:examples Example apps. area:tss @termuijs/tss type:testing +10 pts. Tests. labels Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 666d40a1-e399-462e-abf7-1451540e62cb

📥 Commits

Reviewing files that changed from the base of the PR and between db56d47 and a0c1617.

📒 Files selected for processing (3)
  • packages/testing/src/render.ts
  • packages/tss/src/named-themes.ts
  • packages/tss/src/themes.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/testing/src/render.ts
  • packages/tss/src/themes.ts

📝 Walkthrough

Walkthrough

The PR adds mouse event simulation helpers to the testing harness and extends the theme system. TestInstance gains fireMouse(x, y, init?) and click(x, y) methods to simulate and dispatch mouse events during widget tests. Simultaneously, a new Solarized Light built-in theme is introduced and Tokyo Night is registered as a named-theme alias.

Changes

Mouse Event Testing Support

Layer / File(s) Summary
Mouse event simulation implementation
packages/testing/src/render.ts
TestInstance.fireMouse(x, y, init?) normalizes mouse event fields, performs hit-testing to locate the topmost widget at the coordinates, dispatches the event via the widget's handleMouse handler or emits to its event emitter, then re-renders and redraws. TestInstance.click(x, y) issues mousedown then mouseup. An inline comment near fireKey was updated to describe re-render/flush behavior.

Theme System Extensions

Layer / File(s) Summary
Solarized Light built-in theme definition
packages/tss/src/themes.ts
Adds solarizedLight to BUILTIN_THEMES with theme variables and Gauge/Table styling; adjusts template scoping/placement for tokyo-night Table block; updates header comment from 8 to 10 built-in themes.
Tokyo Night alias registration
packages/tss/src/named-themes.ts
Adds tokyoNight alias key to NAMED_THEMES pointing at tokyoNightTheme; updates header comment from 9 to 10 curated named themes.

Sequence Diagram(s)

sequenceDiagram
  participant TestInstance
  participant Widget
  participant Renderer
  participant ScreenBuffer
  TestInstance->>Widget: hit-test coords -> select target
  TestInstance->>Widget: call handleMouse(event) or events.emit('mouse', event)
  Widget->>Renderer: update state (if any)
  Renderer->>ScreenBuffer: re-render root and redraw buffer
Loading

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Karanjot786/TermUI#545: Introduces LayerManager hit-grid APIs that relate to hit-testing used by TestInstance.fireMouse().
  • Karanjot786/TermUI#575: Also modifies packages/testing/src/render.ts’s test API surface (query helpers) and shares widget-walking/hit-testing context.
  • Karanjot786/TermUI#580: Related testing render/flush changes (adds fireResize) that intersect with re-render/redraw behavior in tests.

Suggested labels

type:feature, area:testing, area:themes

Suggested reviewers

  • Karanjot786

Poem

🐰 I hopped through code with eager paws,

Clicks and hovers, testing laws.
Solarized dawn and Tokyo night,
Widgets gleam in proper light—
Tests now dance, my whiskers twitch with glee.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning All changes appear confined to packages/testing as required. However, the raw summary indicates unexpected changes to packages/tss/src/named-themes.ts and packages/tss/src/themes.ts involving theme additions, which fall outside the #503 scope of adding mouse testing helpers. Remove theme-related changes (tokyoNight alias in named-themes.ts and solarizedLight theme in themes.ts) as they are unrelated to the fireMouse/click testing feature and violate the #503 scope constraint.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR title 'Closes #503 feat:Added fireMouse and click helpers' correctly emphasizes the main feature additions (fireMouse and click helpers) that are the primary focus of the changeset.
Description check ✅ Passed PR description includes all essential sections: a clear description of what was implemented, bullet-point summary of changes, and the related issue. However, it lacks several template sections like 'Which package(s)?', 'Type of Change', and 'Checklist'.
Linked Issues check ✅ Passed The PR successfully implements the core objectives from #503: adds fireMouse(x, y, init?) and click(x, y) to TestInstance, provides mouse event dispatching with hit-testing, re-renders after events, and includes test coverage for mouse interactions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
index.ts (1)

1-10: Consider relocating this example and adding execution infrastructure.

The code itself is functionally correct, but the placement and execution setup could be improved:

  1. Location inconsistency: This example is at the repository root, while other examples (like examples/dashboard) follow a structured pattern with their own folders and package.json files.

  2. Missing ESM configuration: The file uses top-level await (line 10), which requires either Bun or Node with "type": "module" in package.json. The root package.json doesn't specify this.

  3. No execution script: There's no script in the root package.json to run this file, making it unclear how users should execute it.

Consider either:

  • Moving this to examples/hello-world/ with its own package.json and README following the examples/dashboard pattern, or
  • Adding a "demo" or "example" script to root package.json (e.g., "demo": "bun index.ts") and adding "type": "module" if Node compatibility is desired.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@index.ts` around lines 1 - 10, This example index.ts is placed at the repo
root and uses top-level await (await app.mount()) but lacks ESM/run
infrastructure; move the example into a new examples/hello-world/ directory
(mirroring examples/dashboard) with its own package.json and README, or update
root package.json to add "type": "module" and a run script (e.g., "demo") to
execute index.ts; ensure the new package.json scripts reference the same
App/root Box usage (root, App, app.mount) so the example runs with a compatible
runtime (Node ESM or Bun).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/testing/src/render.test.tsx`:
- Around line 230-263: Add two tests to the existing suite using the same
render/screen/Clickable pattern: (1) a "move" test that calls
screen.fireMouse(x,y,{type: 'move'}) against a Clickable instance that exposes a
hover/hovered state (or add a transient hovered rendering to Clickable) and
assert the render output reflects hover (e.g., contains "HOVER") without
toggling clicked; (2) a handlerless in-bounds no-op test that renders a plain
widget/component with no mouse handlers (not Clickable), calls screen.fireMouse
for coordinates inside bounds and asserts no state changes and no exceptions
(e.g., original component output unchanged and no clickable.clicked). Use the
same helpers and identifiers: fireMouse, Clickable, render, screen, and click
for consistency.
- Around line 221-227: Change Clickable._renderSelf to match Widget's abstract
signature by importing Screen from `@termuijs/core` and replacing the loose any
type: update the method signature protected _renderSelf(screen: Screen): void
and add the import for Screen; ensure handleMouse remains the same (this.clicked
= true; this.markDirty()) and that screen.writeString usage continues to work
with the Screen type.

In `@packages/testing/src/render.ts`:
- Line 55: The public API currently types fireMouse as init?:
Partial<MouseEvent> and internally emits 'mousedown'/'mouseup'; change the
signature of fireMouse (and any public click wrapper) to accept init?:
MouseEventInit where MouseEventInit.type is a union 'down' | 'up' | 'move'
(default 'down') and init.button defaults to 'left'; inside the implementation
map these logical types to DOM event names ('down' -> 'mousedown', 'up' ->
'mouseup', 'move' -> 'mousemove') and ensure callers using { type: 'move' }
work, including updating the related call sites that construct events in the
methods referenced (fireMouse, click) to use the new MouseEventInit contract and
apply defaults when type/button are omitted.
- Around line 327-329: Replace the casted call "(target as
any).handleMouse(event)" with a safe runtime lookup/call: get the property by
name from target (e.g. const fn = (target as unknown as Record<string,
unknown>)['handleMouse']), check if typeof fn === 'function', and then invoke it
with fn.call(target, event) to preserve the receiver; this removes the use of
"as any" while still allowing optional handleMouse invocation on target.

In `@packages/tss/src/index.ts`:
- Around line 26-30: The package export list is missing gruvboxTheme causing
root imports to fail; update the re-export in index.ts to include gruvboxTheme
from './named-themes.js' alongside the other symbols (e.g., draculaTheme,
NAMED_THEMES, getNamedTheme) so the documented public API matches the actual
exports.

---

Nitpick comments:
In `@index.ts`:
- Around line 1-10: This example index.ts is placed at the repo root and uses
top-level await (await app.mount()) but lacks ESM/run infrastructure; move the
example into a new examples/hello-world/ directory (mirroring
examples/dashboard) with its own package.json and README, or update root
package.json to add "type": "module" and a run script (e.g., "demo") to execute
index.ts; ensure the new package.json scripts reference the same App/root Box
usage (root, App, app.mount) so the example runs with a compatible runtime (Node
ESM or Bun).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 731e95bf-5a33-4ae5-903e-74baadb5b91f

📥 Commits

Reviewing files that changed from the base of the PR and between c36cc8c and c6f65a5.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • examples/dashboard/package.json
  • index.ts
  • package.json
  • packages/testing/src/render.test.tsx
  • packages/testing/src/render.ts
  • packages/tss/README.md
  • packages/tss/src/index.ts
  • packages/tss/src/named-themes.ts
  • packages/tss/src/themes.test.ts
  • packages/tss/src/themes.ts

Comment thread packages/testing/src/render.test.tsx Outdated
Comment thread packages/testing/src/render.test.tsx Outdated
Comment on lines +230 to +263
it("fireMouse invokes handleMouse and re-renders", () => {
const clickable = new Clickable()
const App = () => clickable
const screen = render(<App />)

expect(screen.renderToString()).toContain("IDLE")

screen.fireMouse(0, 0)

expect(screen.renderToString()).toContain("CLICKED")
})

it("click(x, y) simulates a full click", () => {
const clickable = new Clickable()
const App = () => clickable
const screen = render(<App />)

expect(screen.renderToString()).toContain("IDLE")

screen.click(0, 0)

expect(screen.renderToString()).toContain("CLICKED")
})

it("fireMouse is a no-op if out of bounds", () => {
const clickable = new Clickable()
const App = () => clickable
const screen = render(<App />)

screen.fireMouse(50, 50)

expect(clickable.clicked).toBe(false)
})
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add tests for type: 'move' and handlerless in-bounds no-op.

Current suite validates down/up and out-of-bounds, but it misses two explicit acceptance cases: fireMouse(..., { type: 'move' }) hover behavior without click, and safe no-op when coordinates are in bounds but no handler-bearing widget should handle the event.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/testing/src/render.test.tsx` around lines 230 - 263, Add two tests
to the existing suite using the same render/screen/Clickable pattern: (1) a
"move" test that calls screen.fireMouse(x,y,{type: 'move'}) against a Clickable
instance that exposes a hover/hovered state (or add a transient hovered
rendering to Clickable) and assert the render output reflects hover (e.g.,
contains "HOVER") without toggling clicked; (2) a handlerless in-bounds no-op
test that renders a plain widget/component with no mouse handlers (not
Clickable), calls screen.fireMouse for coordinates inside bounds and asserts no
state changes and no exceptions (e.g., original component output unchanged and
no clickable.clicked). Use the same helpers and identifiers: fireMouse,
Clickable, render, screen, and click for consistency.

Comment thread packages/testing/src/render.ts Outdated
* Simulate a mouse event at the given coordinates.
* Hit-tests the widget tree and dispatches to the top-most widget.
*/
fireMouse(x: number, y: number, init?: Partial<MouseEvent>): void;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Align fireMouse/click with the agreed MouseEventInit contract.

Line 55 currently exposes init?: Partial<MouseEvent>, and Lines 312/347-348 use 'mousedown'/'mouseup'. The PR contract requires a public MouseEventInit with 'down' | 'up' | 'move' (default 'down') and button default 'left'. As-is, callers using { type: 'move' } per acceptance criteria won’t match the public API.

Suggested patch
+export interface MouseEventInit {
+    type?: 'down' | 'up' | 'move';
+    button?: 'left' | 'right' | 'middle';
+}
+
 export interface TestInstance {
@@
-    fireMouse(x: number, y: number, init?: Partial<MouseEvent>): void;
+    fireMouse(x: number, y: number, init?: MouseEventInit): void;
@@
-        fireMouse(x: number, y: number, init?: Partial<MouseEvent>) {
+        fireMouse(x: number, y: number, init?: MouseEventInit) {
             // Normalize the mouse event
             const event: MouseEvent = {
                 x,
                 y,
-                type: init?.type ?? 'mousedown',
+                type: init?.type === 'up'
+                    ? 'mouseup'
+                    : init?.type === 'move'
+                        ? 'mousemove'
+                        : 'mousedown',
                 button: init?.button ?? 'left',
             };
@@
         click(x: number, y: number) {
-            this.fireMouse(x, y, { type: 'mousedown' });
-            this.fireMouse(x, y, { type: 'mouseup' });
+            this.fireMouse(x, y, { type: 'down' });
+            this.fireMouse(x, y, { type: 'up' });
         },

Also applies to: 307-313, 346-348

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/testing/src/render.ts` at line 55, The public API currently types
fireMouse as init?: Partial<MouseEvent> and internally emits
'mousedown'/'mouseup'; change the signature of fireMouse (and any public click
wrapper) to accept init?: MouseEventInit where MouseEventInit.type is a union
'down' | 'up' | 'move' (default 'down') and init.button defaults to 'left';
inside the implementation map these logical types to DOM event names ('down' ->
'mousedown', 'up' -> 'mouseup', 'move' -> 'mousemove') and ensure callers using
{ type: 'move' } work, including updating the related call sites that construct
events in the methods referenced (fireMouse, click) to use the new
MouseEventInit contract and apply defaults when type/button are omitted.

Comment on lines +327 to +329
if (typeof (target as any).handleMouse === 'function') {
(target as any).handleMouse(event);
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the relevant section around the reported lines
sed -n '280,380p' packages/testing/src/render.ts | nl -ba

# Find all uses of "as any" in the repo (to see if this is an isolated case)
rg -n "as any" packages/testing/src/render.ts packages/testing/src -S || true

# Inspect the declaration/type of "target" in this file (best-effort search)
rg -n "target" packages/testing/src/render.ts | head -n 80

# Show any type assertions in the file to compare with guidelines
rg -n "as [A-Za-z_][A-Za-z0-9_]*" packages/testing/src/render.ts -S || true

Repository: Karanjot786/TermUI

Length of output: 105


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="packages/testing/src/render.ts"

# Show the relevant section around the reported lines with line numbers (no nl dependency)
sed -n '280,380p' "$FILE" | awk '{print (NR+279) "\t" $0}'

# Search for "as any" in the file and nearby scope
rg -n "as any" "$FILE" -S || true
rg -n "as any" packages/testing/src -S || true

# Inspect how `target` is typed/declared in this file (best-effort)
rg -n "target" "$FILE" | head -n 120

# Inspect other type assertions in this file
rg -n " as [A-Za-z_][A-Za-z0-9_]*" "$FILE" -S || true

Repository: Karanjot786/TermUI

Length of output: 9009


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find all occurrences of handleMouse
rg -n "handleMouse" packages -S

# Locate Widget type definition (interface/class) used by packages/testing/src/render.ts
rg -n "export (interface|type|class) Widget|interface Widget|type Widget|class Widget" packages -S

# Open the most relevant Widget definition file(s)
# (Use head/tail to avoid huge outputs; adjust if multiple hits)
FILES=$(rg -l "interface Widget|type Widget|class Widget" packages -S | tr '\n' ' ')
echo "Widget-related files: $FILES" | head -n 5

for f in $FILES; do
  echo "---- $f ----"
  # print a small window around "handleMouse" if present; else print first ~120 lines
  if rg -n "handleMouse" "$f" -S >/dev/null; then
    # show around handleMouse
    line=$(rg -n "handleMouse" "$f" -S | head -n1 | cut -d: -f1)
    start=$((line-20)); end=$((line+20))
    sed -n "${start},${end}p" "$f" | nl -ba | head -n 120
  else
    sed -n '1,160p' "$f" | nl -ba | head -n 160
  fi
done

Repository: Karanjot786/TermUI

Length of output: 1043


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE_WIDGET="packages/widgets/src/base/Widget.ts"
FILE_TEST="packages/testing/src/render.test.tsx"
FILE_RENDER="packages/testing/src/render.ts"

echo "---- handleMouse occurrences ----"
rg -n "handleMouse" "$FILE_WIDGET" "$FILE_TEST" "$FILE_RENDER" -S || true

echo
echo "---- packages/widgets/src/base/Widget.ts (around handleMouse) ----"
if rg -n "handleMouse" "$FILE_WIDGET" -S >/dev/null; then
  line=$(rg -n "handleMouse" "$FILE_WIDGET" -S | head -n1 | cut -d: -f1)
  start=$((line-40)); end=$((line+60))
  sed -n "${start},${end}p" "$FILE_WIDGET" | awk '{print (NR+ '"$start"'-1)"\t"$0}'
else
  sed -n '1,220p' "$FILE_WIDGET" | awk '{print NR"\t"$0}'
fi

echo
echo "---- packages/testing/src/render.test.tsx (around handleMouse) ----"
line=$(rg -n "handleMouse" "$FILE_TEST" -S | head -n1 | cut -d: -f1)
start=$((line-40)); end=$((line+80))
sed -n "${start},${end}p" "$FILE_TEST" | awk '{print (NR+ '"$start"'-1)"\t"$0}'

echo
echo "---- packages/testing/src/render.ts (full fireMouse block) ----"
# print from fireMouse start to end of block
start=$(rg -n "fireMouse\\(" "$FILE_RENDER" -S | head -n1 | cut -d: -f1)
# rough end
end=$((start+60))
sed -n "${start},${end}p" "$FILE_RENDER" | awk '{print (NR+ '"$start"'-1)"\t"$0}'

Repository: Karanjot786/TermUI

Length of output: 11522


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="packages/testing/src/render.ts"

# Show the exact fireMouse section (reported area)
sed -n '300,360p' "$FILE" | cat -n

# Also show surrounding helper types/signatures in the same file (to understand MouseEvent type, target types, etc.)
sed -n '1,120p' "$FILE" | cat -n

# Show Widget/MouseEvent imports at top (avoid whole file)
sed -n '1,70p' "$FILE" | cat -n

Repository: Karanjot786/TermUI

Length of output: 9907


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate eslint / tsconfig configs that might enforce no-explicit-any / no-explicit-any in ts
ls -la
rg -n "no-explicit-any|explicit-any|ban-types|`@typescript-eslint/no-explicit-any`" -S .eslintrc* .eslint* eslint.* package.json tsconfig.json tsconfig.* 2>/dev/null || true

# Show relevant tsconfig settings if present
if [ -f tsconfig.json ]; then
  echo "---- tsconfig.json ----"
  cat tsconfig.json
fi

# Search for tsconfig that might be used by packages
for f in $(ls -1 **/tsconfig*.json 2>/dev/null || true); do
  echo "---- $f ----"
  rg -n "noImplicitAny|strict" "$f" || true
done

# Search for eslint config in packages
rg -n "no-explicit-any|`@typescript-eslint/no-explicit-any`" -S packages . 2>/dev/null || true

Repository: Karanjot786/TermUI

Length of output: 2940


Remove as any from the mouse dispatch path.

packages/widgets/src/base/Widget.ts doesn’t declare handleMouse, so packages/testing/src/render.ts currently uses (target as any) to call an optional method. Replace this with a safe runtime lookup/call that avoids as any.

Suggested patch
-                if (typeof (target as any).handleMouse === 'function') {
-                    (target as any).handleMouse(event);
+                const handleMouse = Reflect.get(target, 'handleMouse');
+                if (typeof handleMouse === 'function') {
+                    handleMouse.call(target, event);
                 } else {
                     target.events.emit('mouse', event);
                 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (typeof (target as any).handleMouse === 'function') {
(target as any).handleMouse(event);
} else {
const handleMouse = Reflect.get(target, 'handleMouse');
if (typeof handleMouse === 'function') {
handleMouse.call(target, event);
} else {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/testing/src/render.ts` around lines 327 - 329, Replace the casted
call "(target as any).handleMouse(event)" with a safe runtime lookup/call: get
the property by name from target (e.g. const fn = (target as unknown as
Record<string, unknown>)['handleMouse']), check if typeof fn === 'function', and
then invoke it with fn.call(target, event) to preserve the receiver; this
removes the use of "as any" while still allowing optional handleMouse invocation
on target.

Comment thread packages/tss/src/index.ts
Comment on lines 26 to 30
export {
draculaTheme, nordTheme, catppuccinTheme, monokaiTheme,
solarizedTheme, tokyoNightTheme, oneDarkTheme, highContrastTheme,
solarizedTheme, solarizedLightTheme, tokyoNightTheme, oneDarkTheme, highContrastTheme,
NAMED_THEMES, getNamedTheme,
} from './named-themes.js';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Re-export gruvboxTheme to keep the documented public API consistent.

gruvboxTheme exists in packages/tss/src/named-themes.ts and is documented in packages/tss/README.md (Line 106), but it’s missing from this package-level export list, so root imports for it fail.

Proposed fix
 export {
   draculaTheme, nordTheme, catppuccinTheme, monokaiTheme,
-  solarizedTheme, solarizedLightTheme, tokyoNightTheme, oneDarkTheme, highContrastTheme,
+  solarizedTheme, solarizedLightTheme, tokyoNightTheme, oneDarkTheme, gruvboxTheme, highContrastTheme,
   NAMED_THEMES, getNamedTheme,
 } from './named-themes.js';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export {
draculaTheme, nordTheme, catppuccinTheme, monokaiTheme,
solarizedTheme, tokyoNightTheme, oneDarkTheme, highContrastTheme,
solarizedTheme, solarizedLightTheme, tokyoNightTheme, oneDarkTheme, highContrastTheme,
NAMED_THEMES, getNamedTheme,
} from './named-themes.js';
export {
draculaTheme, nordTheme, catppuccinTheme, monokaiTheme,
solarizedTheme, solarizedLightTheme, tokyoNightTheme, oneDarkTheme, gruvboxTheme, highContrastTheme,
NAMED_THEMES, getNamedTheme,
} from './named-themes.js';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/tss/src/index.ts` around lines 26 - 30, The package export list is
missing gruvboxTheme causing root imports to fail; update the re-export in
index.ts to include gruvboxTheme from './named-themes.js' alongside the other
symbols (e.g., draculaTheme, NAMED_THEMES, getNamedTheme) so the documented
public API matches the actual exports.

@Karanjot786 Karanjot786 force-pushed the add-mouse-click-tests branch from c6f65a5 to db56d47 Compare June 4, 2026 16:00
@Karanjot786 Karanjot786 added gssoc:approved Approved PR. Earns +50 base points. quality:clean x 1.2 multiplier. Clean implementation. level:intermediate +35 pts. Moderate task. type:feature +10 pts. New feature. labels Jun 4, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/tss/src/named-themes.ts`:
- Around line 72-83: Update the package metadata and tests to reflect the two
new themes: change the package description/count in packages/tss/package.json
from “eight built-in themes” to “ten built-in themes” (or equivalent wording) so
it matches README, and add test assertions in
packages/tss/src/named-themes.test.ts that reference the new exported symbols
solarizedLightTheme and tokyoNightTheme (or their exact export names) to ensure
the named-themes test suite checks for those themes' presence and expected
tokens.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 06f23fdc-77d0-461a-92a0-271471774a38

📥 Commits

Reviewing files that changed from the base of the PR and between c6f65a5 and db56d47.

📒 Files selected for processing (3)
  • packages/testing/src/render.ts
  • packages/tss/src/named-themes.ts
  • packages/tss/src/themes.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/tss/src/themes.ts
  • packages/testing/src/render.ts

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/tss/src/named-themes.ts`:
- Around line 72-83: Update the package metadata and tests to reflect the two
new themes: change the package description/count in packages/tss/package.json
from “eight built-in themes” to “ten built-in themes” (or equivalent wording) so
it matches README, and add test assertions in
packages/tss/src/named-themes.test.ts that reference the new exported symbols
solarizedLightTheme and tokyoNightTheme (or their exact export names) to ensure
the named-themes test suite checks for those themes' presence and expected
tokens.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 06f23fdc-77d0-461a-92a0-271471774a38

📥 Commits

Reviewing files that changed from the base of the PR and between c6f65a5 and db56d47.

📒 Files selected for processing (3)
  • packages/testing/src/render.ts
  • packages/tss/src/named-themes.ts
  • packages/tss/src/themes.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/tss/src/themes.ts
  • packages/testing/src/render.ts
🛑 Comments failed to post (1)
packages/tss/src/named-themes.ts (1)

72-83: ⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify package.json and README.md mention the new solarizedLight theme

echo "=== Checking package.json for theme count or solarizedLight reference ==="
fd -t f '^package\.json$' packages/tss --exec cat {}

echo ""
echo "=== Checking README.md for theme count or solarizedLight reference ==="
fd -t f '^README\.md$' packages/tss --exec cat {}

echo ""
echo "=== Checking test coverage for solarizedLight and tokyoNight ==="
rg -n "solarizedLight|tokyoNight" packages/tss/src/named-themes.test.ts

Repository: Karanjot786/TermUI

Length of output: 4674


Fix theme-count metadata and align tests with new built-in themes

  • packages/tss/package.json still describes the package as having “eight built-in themes”, while packages/tss/README.md lists 10 themes including solarizedLight and tokyo-night; update the package.json theme count/description to match.
  • Ensure the layer/PR description and named-themes test coverage include the newly added solarizedLightTheme (searching packages/tss/src/named-themes.test.ts shows no solarizedLight/tokyoNight matches).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/tss/src/named-themes.ts` around lines 72 - 83, Update the package
metadata and tests to reflect the two new themes: change the package
description/count in packages/tss/package.json from “eight built-in themes” to
“ten built-in themes” (or equivalent wording) so it matches README, and add test
assertions in packages/tss/src/named-themes.test.ts that reference the new
exported symbols solarizedLightTheme and tokyoNightTheme (or their exact export
names) to ensure the named-themes test suite checks for those themes' presence
and expected tokens.

@Rish-2006
Copy link
Copy Markdown
Contributor

hey u have submitted the pr for wrong issue #502

@Karanjot786 Karanjot786 force-pushed the add-mouse-click-tests branch from db56d47 to a0c1617 Compare June 4, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:examples Example apps. area:tss @termuijs/tss gssoc:approved Approved PR. Earns +50 base points. level:intermediate +35 pts. Moderate task. quality:clean x 1.2 multiplier. Clean implementation. type:docs +5 pts. Documentation. type:feature +10 pts. New feature. type:testing +10 pts. Tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(testing): add fireMouse and click helpers

3 participants