#19976·kestra

Add unit tests for useThemeCycle

Author: MilosPaunovicCreated Sep 30, 2026Updated Sep 30, 2026
Labelsarea/frontendkind/cooldowngood first issue

What

ui/src/composables/useThemeCycle.ts has no test yet.

It registers the global Ctrl+Shift+L shortcut that cycles the three themes. A listener that is not removed on unmount leaks, which is the kind of thing only a test catches.

What to do

Create ui/tests/unit/composables/useThemeCycle.spec.ts covering:

  • Ctrl+Shift+L advances light to dark-2, dark-2 to dark, and dark back to light
  • the key check is case-insensitive, so L and l both work
  • the shortcut does nothing without Ctrl, without Shift, or with a different key
  • an unset theme is treated as light
  • the keydown listener is removed on unmount

Mount a host component that calls the composable with a stub misc store, then dispatch KeyboardEvents on window.

Reference

ui/tests/unit/composables/useTenant.spec.ts is an existing test of the same shape to copy from.

How to run

Install once, then run the whole suite:

bash
cd ui && npm install && npm run test:unit

While writing the test, run just this file so the feedback loop stays fast:

bash
cd ui && npm run test:unit -- tests/unit/composables/useThemeCycle.spec.ts

Proof required in the PR

[!IMPORTANT] The PR that closes this issue must include a screenshot of the test passing, pasted into the PR description. Pasted text output is not enough.

To produce it, run the single-file command above and screenshot the terminal. The capture should show the command, the test file, and the green summary lines (Test Files 1 passed (1) and Tests N passed (N)). Then drag the image straight into the PR description field on GitHub, which uploads and embeds it.