Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/sveltestrap.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sveltestrap.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sveltestrap.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sveltestrap.js.map

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions src/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
export let type = 'text';
export let valid = false;
export let value = '';
export let max = undefined;
export let min = undefined;

let classes;
let tag;
Expand Down Expand Up @@ -257,6 +259,8 @@
bind:this={inner}
{readonly}
{name}
{max}
{min}
{disabled}
{placeholder}
/>
Expand All @@ -276,6 +280,8 @@
bind:this={inner}
{disabled}
{name}
{max}
{min}
{placeholder}
{readonly}
/>
Expand All @@ -295,6 +301,8 @@
bind:this={inner}
{disabled}
{name}
{max}
{min}
{placeholder}
{readonly}
/>
Expand All @@ -314,6 +322,8 @@
{readonly}
class={classes}
{name}
{max}
{min}
{disabled}
{placeholder}
/>
Expand All @@ -333,6 +343,8 @@
bind:this={inner}
{disabled}
{name}
{max}
{min}
{placeholder}
{readonly}
/>
Expand All @@ -352,6 +364,8 @@
bind:this={inner}
{disabled}
{name}
{max}
{min}
{placeholder}
{readonly}
/>
Expand Down Expand Up @@ -390,6 +404,8 @@
{readonly}
class={classes}
{name}
{max}
{min}
{disabled}
{placeholder}
/>
Expand Down Expand Up @@ -449,6 +465,8 @@
bind:this={inner}
{disabled}
{name}
{max}
{min}
{placeholder}
{readonly}
/>
Expand Down
12 changes: 12 additions & 0 deletions src/__test__/Input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ describe('Input', () => {
expect(input.disabled).toBe(true);
});

test('should render max', () => {
const container = renderInput({ type: 'date', max: '07-01-1987' });
const input = container.querySelector('input');
expect(input.getAttribute('max')).toBe('07-01-1987');
});

test('should render min', () => {
const container = renderInput({ type: 'date', min: '07-01-1987' });
const input = container.querySelector('input');
expect(input.getAttribute('min')).toBe('07-01-1987');
});

test('should render readonly', () => {
const container = renderInput({ readonly: true });
const input = container.querySelector('input');
Expand Down