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
14 changes: 1 addition & 13 deletions frontend/__tests__/test/events/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let wordIndex = 0;
function insert(
chars: string,
inputType: InsertInputType = "insertText",
overrides: Partial<{ inputStopped: boolean }> = {},
overrides: { inputStopped?: true } = {},
): InputEvent[] {
return [...chars].map((char) => {
nextMs += 10;
Expand All @@ -35,8 +35,6 @@ function insert(
inputType,
data: char,
correct: true,
isCompositionEnding: false,
inputStopped: false,
...overrides,
},
};
Expand Down Expand Up @@ -278,8 +276,6 @@ describe("getInputFromDom", () => {
charIndex: 2,
wordIndex: 0,
correct: true,
isCompositionEnding: false,
inputStopped: false,
inputValue: "abc",
},
},
Expand All @@ -294,8 +290,6 @@ describe("getInputFromDom", () => {
charIndex: 3,
wordIndex: 0,
correct: true,
isCompositionEnding: false,
inputStopped: false,
},
},
];
Expand Down Expand Up @@ -324,8 +318,6 @@ describe("findInputValueMismatches", () => {
charIndex: 0,
wordIndex: 0,
correct: true,
isCompositionEnding: false,
inputStopped: false,
inputValue: "a",
},
},
Expand All @@ -339,8 +331,6 @@ describe("findInputValueMismatches", () => {
charIndex: 1,
wordIndex: 0,
correct: true,
isCompositionEnding: false,
inputStopped: false,
inputValue: "ab",
},
},
Expand All @@ -360,8 +350,6 @@ describe("findInputValueMismatches", () => {
charIndex: 0,
wordIndex: 0,
correct: true,
isCompositionEnding: false,
inputStopped: false,
inputValue: "DIFFERENT",
},
},
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/ts/commandline/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import {
showFpsCounter,
} from "../components/layout/overlays/FpsCounter";
import { applyConfigFromJson } from "../config/lifecycle";
import { getAllTestEvents } from "../test/events/data";
import * as TestWords from "../test/test-words";

const challengesPromise = JSONData.getChallengeList();
challengesPromise
Expand Down Expand Up @@ -304,6 +306,28 @@ export const commands: CommandsSubgroup = {
});
},
},
{
id: "copyResultData",
display: "Copy result data",
alias: "stats events",
icon: "fa-cog",
visible: false,
exec: async (): Promise<void> => {
navigator.clipboard
.writeText(
JSON.stringify({
events: getAllTestEvents(),
words: TestWords.words.list,
}),
)
.then(() => {
showSuccessNotification("Copied to clipboard");
})
.catch((e: unknown) => {
showErrorNotification("Failed to copy to clipboard", { error: e });
});
},
},
{
id: "fpsCounter",
display: "FPS counter...",
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/ts/components/dev/DevTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ if (import.meta.env.DEV) {
default: m.DevOptionsModal,
})),
);
const LazyTestDataPreviewModal = lazy(async () =>
import("../modals/TestDataPreviewModal").then((m) => ({
default: m.TestDataPreviewModal,
})),
);

const LazySolidDevtoolsOverlay = lazy(async () =>
import("@solid-devtools/overlay").then((m) => ({
Expand All @@ -33,6 +38,7 @@ if (import.meta.env.DEV) {
<Suspense>
<LazyTanstackDevtools />
<LazyDevOptionsModal />
<LazyTestDataPreviewModal />
<LazySolidDevtoolsOverlay />
</Suspense>
);
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/ts/components/modals/DevOptionsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export function DevOptionsModal(): JSXElement {
label: () => "Disable Slow Timer Fail",
onClick: disableSlowTimerFail,
},
{
icon: "fa-vials",
label: () => "Test Data Preview",
onClick: () => showModal("TestDataPreview"),
},
];

const addDebugInboxItem = (rewardType: "xp" | "badge" | "none"): void => {
Expand Down
Loading
Loading