Also exclude . and update tests

This commit is contained in:
ernstmul
2024-10-18 14:19:47 +02:00
parent 65dab15013
commit 440b608daa
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
let element: HTMLInputElement;
let icon = 'info';
const pattern = String.raw`^[a-zA-Z0-9][a-zA-Z0-9.\-]*$`;
const pattern = String.raw`^[a-zA-Z0-9][a-zA-Z0-9\-]*$`;
onMount(() => {
if (element && autofocus) {
+2 -2
View File
@@ -3,9 +3,9 @@ import { render } from '@testing-library/svelte';
import userEvent from '@testing-library/user-event';
import { InputId } from '../../../src/lib/elements/forms';
const validStrings = ['valid_string', 'valid-string', 'valid.string', 'validstring123', 'valid_'];
const validStrings = ['valid-string', 'validstring', 'validstring123', 'valid-'];
const invalidStrings = ['-invalid', '.invalid', '_invalid'];
const invalidStrings = ['-invalid', '.invalid', 'in_valid', 'in.va.lid'];
test('shows id input', () => {
const { getByPlaceholderText } = render(InputId);