From 3352727aa638fcfcc6461d2aaded8ef9603acc0d Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 4 Oct 2022 00:04:19 +0800 Subject: feat: Initial setup facilitating testing --- apps/kit/src/lib/components/alert.svelte | 7 +++++-- apps/kit/src/lib/components/button.svelte | 10 ++++++++-- apps/kit/src/lib/components/checkbox.svelte | 3 +++ apps/kit/src/lib/components/input.svelte | 3 +++ apps/kit/src/lib/components/locale-switcher.svelte | 4 ++++ apps/kit/src/lib/components/switch.svelte | 8 ++++++++ apps/kit/src/lib/configuration.ts | 21 ++++++++++++++++++++- apps/kit/src/lib/helpers.ts | 4 ++++ 8 files changed, 55 insertions(+), 5 deletions(-) (limited to 'apps/kit/src/lib') diff --git a/apps/kit/src/lib/components/alert.svelte b/apps/kit/src/lib/components/alert.svelte index 31e7357..fd57105 100644 --- a/apps/kit/src/lib/components/alert.svelte +++ b/apps/kit/src/lib/components/alert.svelte @@ -2,6 +2,7 @@ import { random_string } from "$lib/helpers"; import { createEventDispatcher } from "svelte"; import { onMount } from "svelte"; + import pwKey from "$actions/pwKey"; import { Temporal } from "temporal-polyfill"; import { ExclamationTriangleIcon, CheckCircleIcon, InformationCircleIcon, XCircleIcon, XMarkIcon } from "./icons"; @@ -61,10 +62,12 @@ $: cooldownEnabled = id.indexOf(noCooldownSetting) === -1 && closeable && (closeableCooldown === "~" || parseInt(closeableCooldown) > 0); /** - * Sets this alerts visibility state, when this is false it is removed from the dom using svelte a {#if} block. + * Sets this alerts visibility state, when this is false it is removed from the dom using an {#if} block. */ export let visible = closeableCooldown === "~" || parseInt(closeableCooldown) > 0 ? false : true; + export let _pwKey: string | undefined = undefined; + const cooldownStorageKey = "lastseen--" + id; $: switch (type) { @@ -160,7 +163,7 @@ {#if visible} -
+
diff --git a/apps/kit/src/lib/components/button.svelte b/apps/kit/src/lib/components/button.svelte index d345b37..cbc09e2 100644 --- a/apps/kit/src/lib/components/button.svelte +++ b/apps/kit/src/lib/components/button.svelte @@ -4,6 +4,8 @@
+ import pwKey from "$actions/pwKey"; import { random_string } from "$lib/helpers"; import { ExclamationCircleIcon } from "./icons"; @@ -18,6 +19,7 @@ export let addon: string | undefined = undefined; export let value: string | undefined; export let wrapperClass: string | undefined = undefined; + export let _pwKey: string | undefined = undefined; $: ariaErrorDescribedBy = id + "__" + "error"; $: attributes = { @@ -70,6 +72,7 @@ {/if} + import pwKey from "$actions/pwKey"; import { browser } from "$app/environment"; import { page } from "$app/stores"; import { CookieNames } from "$lib/configuration"; @@ -8,6 +9,8 @@ import { loadLocaleAsync } from "$lib/i18n/i18n-util.async"; import Cookies from "js-cookie"; + export let _pwKey: string | undefined = undefined; + async function switch_locale(newLocale: Locales) { if (!newLocale || $locale === newLocale) return; await loadLocaleAsync(newLocale); @@ -42,6 +45,7 @@