add test ids

This commit is contained in:
cupcakearmy 2022-07-19 16:11:24 +02:00
parent fd8fbd2e2e
commit c3bc32bb2b
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
3 changed files with 27 additions and 6 deletions

View File

@ -12,6 +12,7 @@
<div class="fields"> <div class="fields">
<TextInput <TextInput
data-testid="field-views"
type="number" type="number"
label={$t('common.views', { values: { n: 0 } })} label={$t('common.views', { values: { n: 0 } })}
bind:value={note.views} bind:value={note.views}
@ -22,9 +23,15 @@
$t('home.errors.max', { values: { n: $status?.max_views ?? 0 } })} $t('home.errors.max', { values: { n: $status?.max_views ?? 0 } })}
/> />
<div class="middle-switch"> <div class="middle-switch">
<Switch label={$t('common.mode')} bind:value={timeExpiration} color={false} /> <Switch
data-testid="switch-advanced-toggle"
label={$t('common.mode')}
bind:value={timeExpiration}
color={false}
/>
</div> </div>
<TextInput <TextInput
data-testid="field-expiration"
type="number" type="number"
label={$t('common.minutes', { values: { n: 0 } })} label={$t('common.minutes', { values: { n: 0 } })}
bind:value={note.expiration} bind:value={note.expiration}

View File

@ -34,7 +34,7 @@
<small> <small>
{label} {label}
</small> </small>
<input type="file" on:change={onInput} multiple /> <input {...$$restProps} type="file" on:change={onInput} multiple />
<div class="box"> <div class="box">
{#if files.length} {#if files.length}
<div> <div>

View File

@ -106,15 +106,29 @@
<form on:submit|preventDefault={submit}> <form on:submit|preventDefault={submit}>
<fieldset disabled={loading !== null}> <fieldset disabled={loading !== null}>
{#if isFile} {#if isFile}
<FileUpload label={$t('common.file')} bind:files /> <FileUpload data-testid="file-upload" label={$t('common.file')} bind:files />
{:else} {:else}
<TextArea label={$t('common.note')} bind:value={note.contents} placeholder="..." /> <TextArea
data-testid="text-field"
label={$t('common.note')}
bind:value={note.contents}
placeholder="..."
/>
{/if} {/if}
<div class="bottom"> <div class="bottom">
<Switch class="file" label={$t('common.file')} bind:value={isFile} /> <Switch
data-testid="switch-file"
class="file"
label={$t('common.file')}
bind:value={isFile}
/>
{#if $status?.allow_advanced} {#if $status?.allow_advanced}
<Switch label={$t('common.advanced')} bind:value={advanced} /> <Switch
data-testid="switch-advanced"
label={$t('common.advanced')}
bind:value={advanced}
/>
{/if} {/if}
<div class="grow" /> <div class="grow" />
<div class="tr"> <div class="tr">