From fc0f1654a56d2247728a766f43e72ff169704888 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Sat, 15 Feb 2025 15:17:03 -0500 Subject: Hoist global state access out of individual components. Access to "global" (maybe "external?") state is now handled at the top level of the component hierarchy, in `+page.svelte`, `+layout.svelte`, and their associated scripts. State is otherwise passed down through props, and changes are passed up through callbacks. This is - hopefully - groundwork for refactoring state management a bit. I wanted to move access to state out to a smaller number of places, so that I have fewer places to update to implement reconnect logic. My broader goal is to make it easier to refactor these kinds of external side effects, as well, though no such changes are in this branch. This change also makes testing a mile easier, since tests can interact with props and callbacks instead of emulating the whole HTTP request stack and the Pilcrow API. This change removes do-very-little tests. --- package.json | 2 ++ 1 file changed, 2 insertions(+) (limited to 'package.json') diff --git a/package.json b/package.json index f4d78ac..a43e01e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "@sveltejs/adapter-static": "^3.0.8", "@sveltejs/kit": "^2.17.2", "@sveltejs/vite-plugin-svelte": "^5.0.3", + "@testing-library/svelte": "^5.2.7", + "@testing-library/user-event": "^14.6.1", "@types/eslint": "^9.6.1", "@vitest/coverage-v8": "^3.0.6", "autoprefixer": "^10.4.20", -- cgit v1.2.3