diff --git a/src/lib/elements/forms/inputText.svelte b/src/lib/elements/forms/inputText.svelte
index e8e7b0b0aa..17f00f89b2 100644
--- a/src/lib/elements/forms/inputText.svelte
+++ b/src/lib/elements/forms/inputText.svelte
@@ -53,7 +53,9 @@
content: tooltip
}} />
{/if}
-
{optionalText}
+ {#if optionalText}
+
{optionalText}
+ {/if}
diff --git a/tests/unit/elements/inputText.test.ts b/tests/unit/elements/inputText.test.ts
index a6d927fb36..c1f67eb3e6 100644
--- a/tests/unit/elements/inputText.test.ts
+++ b/tests/unit/elements/inputText.test.ts
@@ -72,13 +72,13 @@ test('shows text input - maxlength', () => {
});
test('state', async () => {
- const { component, getByLabelText } = render(InputText, {
+ const { component, container } = render(InputText, {
id: 'input',
label: 'input',
value: ''
});
- const input = getByLabelText('input');
+ const input = container.querySelector('input');
expect(component.value).toEqual('');
await userEvent.type(input, 'lorem');
expect(component.value).toEqual('lorem');
diff --git a/tests/unit/helpers/object.test.ts b/tests/unit/helpers/object.test.ts
index 75777aa6eb..fe0991de89 100644
--- a/tests/unit/helpers/object.test.ts
+++ b/tests/unit/helpers/object.test.ts
@@ -1,4 +1,4 @@
-import { isObjectType, objectEntries } from '$lib/helpers/object';
+import { objectEntries } from '$lib/helpers/object';
test('objectEntries', () => {
const object = {
@@ -9,66 +9,3 @@ test('objectEntries', () => {
expect(objectEntries(object)).toEqual(Object.entries(object));
});
-
-test('isObjectType', () => {
- type TestType = {
- a: string;
- b: number;
- c: string | number;
- d: string[];
- e: {
- f: string;
- g: number;
- };
- h: undefined | null | string;
- };
-
- const valid_type = {
- a: '1',
- b: 1,
- c: '1',
- d: ['1', '2'],
- e: {
- f: '1',
- g: 1
- },
- h: null
- };
-
- const invalid_type = {
- a: 1,
- b: '1',
- c: true
- };
-
- const invalid_type_2 = {
- ...valid_type,
- d: [1, '2']
- };
-
- const invalid_type_3 = {
- ...valid_type,
- c: null
- };
-
- const isTestType = (value: unknown): value is TestType => {
- return isObjectType(value, {
- a: 'string',
- b: 'number',
- c: ['string', 'number'],
- d: (v) => Array.isArray(v) && v.every((v) => typeof v === 'string'),
- e: (v) =>
- isObjectType(v, {
- f: 'string',
- g: 'number'
- }),
- h: (v) => v === null || v === undefined || typeof v === 'string'
- });
- };
-
- expect(isTestType(valid_type)).toBe(true);
- expect(isTestType(invalid_type)).toBe(false);
- expect(isTestType(invalid_type_2)).toBe(false);
- expect(isTestType(invalid_type_3)).toBe(false);
- expect(isTestType('12331')).toBe(false);
-});
From 7bb99a913134932d788183c91ada074f33bd0603 Mon Sep 17 00:00:00 2001
From: tglide <26071571+TGlide@users.noreply.github.com>
Date: Thu, 9 Feb 2023 15:17:38 +0000
Subject: [PATCH 9/9] refactor: change some anys to unknown
---
.../collection-[collection]/[[page]]/+page.svelte | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/[[page]]/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/[[page]]/+page.svelte
index 7e05ce4d4d..9b479eb830 100644
--- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/[[page]]/+page.svelte
+++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/[[page]]/+page.svelte
@@ -35,7 +35,7 @@
}))
];
- function formatArray(array: any[]) {
+ function formatArray(array: unknown[]) {
if (array.length === 0) return '[ ]';
let formattedFields: string[] = [];
@@ -50,7 +50,7 @@
return `[${formattedFields.join(', ')}]`;
}
- function formatColumn(column: any) {
+ function formatColumn(column: unknown) {
let formattedColumn: string;
if (typeof column === 'string') {