diff --git a/src/components/Admin/CreatedUrl.svelte b/src/components/Admin/CreatedUrl.svelte
index 7c595f2..fe98e66 100644
--- a/src/components/Admin/CreatedUrl.svelte
+++ b/src/components/Admin/CreatedUrl.svelte
@@ -5,7 +5,7 @@
import { buildUrlParams } from "../../url";
import { get } from "svelte/store";
import { buildingTests } from "../../stores/admin";
- import { testsSchema, testForModalToTestConverter } from "../../test";
+ import { testsSchemaStrip, testForModalToTestConverter } from "../../test";
let url = "";
@@ -18,8 +18,8 @@
if (tests) {
try {
- testsSchema.parse(tests);
- obj.tests = tests;
+ const stripedTests = testsSchemaStrip.parse(tests);
+ obj.tests = stripedTests;
} catch (error) {
console.log(error);
}
diff --git a/src/components/Admin/TestBuilderModal/Arguments.svelte b/src/components/Admin/TestBuilderModal/Arguments.svelte
index 53a5133..20f4cb1 100644
--- a/src/components/Admin/TestBuilderModal/Arguments.svelte
+++ b/src/components/Admin/TestBuilderModal/Arguments.svelte
@@ -2,10 +2,13 @@
import { _ } from "svelte-i18n";
import Argument from "./CTypeValue.svelte";
import { argumentsValueDeleter, currentModal } from "../../../stores/admin";
+
+ // @ts-expect-error
+ $: argumentsValues = $currentModal?.argumentsValues ?? [];
- {#each $currentModal.argumentsValues as arg, i}
+ {#each argumentsValues as arg, i}
import { _ } from "svelte-i18n";
import { Modal } from "carbon-components-svelte";
- import { TextInput, Button } from "carbon-components-svelte";
+ import { TextInput, Button, Toggle, TextArea } from "carbon-components-svelte";
import AddAlt from "carbon-icons-svelte/lib/AddAlt.svelte";
import Arguments from "./Arguments.svelte";
import ReturnValue from "./CTypeValue.svelte";
@@ -20,12 +20,15 @@
import {
buildingTestsAdder,
currentModal,
- resetCurrentModal,
+ resetCurrentModalTypeFunction,
+ resetCurrentModalTypeMain,
argumentsValueAdder,
buildingTestsDeleter
} from "../../../stores/admin";
import { ulid } from "ulid";
+ let isTestTypeAsFunction = $currentModal.type === "function";
+
const buildingTestsAdd = () => {
buildingTestsAdder({
...$currentModal,
@@ -40,12 +43,16 @@
buildingTestsDeleter(id);
}
buildingTestsAdd();
- resetCurrentModal();
+ $currentModal.type === "function"
+ ? resetCurrentModalTypeFunction()
+ : resetCurrentModalTypeMain();
closeTestBuilderModal();
};
const cancel = () => {
- resetCurrentModal();
+ $currentModal.type === "function"
+ ? resetCurrentModalTypeFunction()
+ : resetCurrentModalTypeMain();
closeTestBuilderModal();
};
@@ -55,23 +62,40 @@
modalHeading={$_("admin.form.tests.builder.create_test")}
primaryButtonText={$_("admin.modal.primary_button_text")}
secondaryButtonText={$_("admin.modal.secondary_button_text")}
+ shouldSubmitOnEnter={false}
on:click:button--primary={confirm}
on:click:button--secondary={cancel}
on:close={closeTestBuilderModal}
>
- {
+ if (e.detail.toggled) {
+ resetCurrentModalTypeFunction();
+ } else {
+ resetCurrentModalTypeMain();
+ }
+ }}
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {:else}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/if}