Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/__tests__/controllers/preset-controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ describe("PresetController", () => {
vi.mock("../../src/ts/test/test-logic", () => ({
restart: vi.fn(),
}));
vi.mock("../../src/ts/test/pace-caret", () => ({
//
}));
const dbGetSnapshotMock = vi.spyOn(DB, "getSnapshot");
const configApplyMock = vi.spyOn(UpdateConfig, "apply");
const configSaveFullConfigMock = vi.spyOn(
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"eslint-plugin-compat": "6.0.2",
"firebase-tools": "13.15.1",
"fontawesome-subset": "4.4.0",
"happy-dom": "20.0.0",
"happy-dom": "20.0.2",
"madge": "8.0.0",
"magic-string": "0.30.17",
"normalize.css": "8.0.1",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/html/popups.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<button class="showRealWordsInput">show real words input</button>
<button class="xpBarTest">xp bar test</button>
<button class="toggleFakeChartData">toggle fake chart data</button>
<button class="toggleCaretDebug">toggle caret debug</button>
</div>
</dialog>

Expand Down
13 changes: 10 additions & 3 deletions frontend/src/styles/caret.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@

#caret,
#paceCaret {
&.debug {
outline: 1px solid white;
&.hidden {
opacity: 0.5 !important;
display: block !important;
}
}

&.off {
width: 0;
}
Expand Down Expand Up @@ -50,20 +58,19 @@
width: 0.5em;
border-radius: 0;
z-index: -1;
border-radius: calc(var(--roundness) / 4);
border-radius: 0.05em;
}

&.outline {
@extend #caret, .block;
animation-name: none;
background: transparent;
border: 0.05em solid var(--caret-color);
border-radius: calc(var(--roundness) / 4);
border-radius: 0.05em;
}

&.underline {
height: 0.1em;
width: 0.5em;
margin-top: 1.2em;
}
}
9 changes: 9 additions & 0 deletions frontend/src/styles/test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@
}
}

&.debugCaret {
outline: 1px solid var(--sub-color);
}
&.debugCaretTarget {
outline: 2px solid red;
}
&.debugCaretTarget2 {
outline: 2px solid yellow;
}
&.correct {
color: var(--correct-letter-color);
animation: var(--correct-letter-animation);
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/ts/controllers/input-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function backspaceToPrevious(): void {
}
}

void Caret.updatePosition();
Caret.updatePosition();
Replay.addReplayEvent("backWord");
}

Expand Down Expand Up @@ -258,7 +258,7 @@ async function handleSpace(): Promise<void> {
dontInsertSpace = false;
Replay.addReplayEvent("incorrectLetter", "_");
void TestUI.updateActiveWordLetters();
void Caret.updatePosition();
Caret.updatePosition();
}
return;
}
Expand Down Expand Up @@ -346,7 +346,7 @@ async function handleSpace(): Promise<void> {
}
} //end of line wrap

void Caret.updatePosition();
Caret.updatePosition();

// enable if i decide that auto tab should also work after a space
// if (
Expand Down Expand Up @@ -565,7 +565,7 @@ async function handleChar(
) {
TestInput.input.current = resultingWord;
void TestUI.updateActiveWordLetters();
void Caret.updatePosition();
Caret.updatePosition();
return;
}

Expand Down Expand Up @@ -768,7 +768,7 @@ async function handleChar(
}, 0);

if (char !== "\n") {
void Caret.updatePosition();
Caret.updatePosition();
}
}

Expand Down Expand Up @@ -1377,7 +1377,7 @@ $("#wordsInput").on("input", async (event) => {
}

void TestUI.updateActiveWordLetters();
void Caret.updatePosition();
Caret.updatePosition();
if (!CompositionState.getComposing()) {
const keyStroke = event?.originalEvent as InputEvent;
if (keyStroke.inputType === "deleteWordBackward") {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/ts/modals/dev-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { signIn } from "../auth";
import * as Loader from "../elements/loader";
import { update } from "../elements/xp-bar";
import { toggleUserFakeChartData } from "../test/result";
import { toggleCaretDebug } from "../utils/caret";

let mediaQueryDebugLevel = 0;

Expand Down Expand Up @@ -89,6 +90,9 @@ async function setup(modalEl: HTMLElement): Promise<void> {
?.addEventListener("click", () => {
toggleUserFakeChartData();
});
modalEl.querySelector(".toggleCaretDebug")?.addEventListener("click", () => {
toggleCaretDebug();
});
}

const modal = new AnimatedModal({
Expand Down
Loading
Loading