Skip to content

Commit 6c2feed

Browse files
committed
add tests for input type url
1 parent 434c0a9 commit 6c2feed

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

packages/uui-input/lib/uui-input.test.ts

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,50 @@ describe('UuiInput in Form', () => {
215215
});
216216

217217
describe('native validation', () => {
218-
beforeEach(async () => {
219-
element.setAttribute('type', 'email');
220-
await elementUpdated(element);
221-
});
218+
describe('email', () => {
219+
beforeEach(async () => {
220+
element.setAttribute('type', 'email');
221+
await elementUpdated(element);
222+
});
222223

223-
it('sets element to valid when value is empty', async () => {
224-
expect(element.checkValidity()).to.be.true;
225-
});
224+
it('sets element to valid when value is empty', async () => {
225+
expect(element.checkValidity()).to.be.true;
226+
});
226227

227-
it('email element is invalid when it has a none compliant value', async () => {
228-
element.value = 'new value';
229-
await elementUpdated(element);
230-
expect(element.checkValidity()).to.be.false;
228+
it('email element is invalid when it has a none compliant value', async () => {
229+
element.value = 'new value';
230+
await elementUpdated(element);
231+
expect(element.checkValidity()).to.be.false;
232+
});
233+
234+
it('email element is valid when it has a email value', async () => {
235+
element.value = '[email protected]';
236+
await elementUpdated(element);
237+
expect(element.checkValidity()).to.be.true;
238+
});
231239
});
232240

233-
it('email element is valid when it has a email value', async () => {
234-
element.value = '[email protected]';
235-
await elementUpdated(element);
236-
expect(element.checkValidity()).to.be.true;
241+
describe('url', () => {
242+
beforeEach(async () => {
243+
element.setAttribute('type', 'url');
244+
await elementUpdated(element);
245+
});
246+
247+
it('sets element to valid when value is empty', async () => {
248+
expect(element.checkValidity()).to.be.true;
249+
});
250+
251+
it('url element is invalid when it has a none compliant value', async () => {
252+
element.value = 'new value';
253+
await elementUpdated(element);
254+
expect(element.checkValidity()).to.be.false;
255+
});
256+
257+
it('url element is valid when it has a email value', async () => {
258+
element.value = 'http://umbraco.com';
259+
await elementUpdated(element);
260+
expect(element.checkValidity()).to.be.true;
261+
});
237262
});
238263
});
239264
});

0 commit comments

Comments
 (0)