-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: make sure no initial validation happens (#205)
- Loading branch information
1 parent
d44eaa3
commit 3b4144c
Showing
4 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
|
||
<head> | ||
<link rel="import" href="../../polymer/polymer.html"> | ||
</head> | ||
<body> | ||
<script> | ||
window.nextRender = (element) => { | ||
return new Promise(resolve => { | ||
Polymer.RenderStatus.afterNextRender(element, resolve); | ||
}); | ||
}; | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!doctype html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>vaadin-time-picker validation tests</title> | ||
<script src='../../web-component-tester/browser.js'></script> | ||
<script src='../../webcomponentsjs/webcomponents-lite.js'></script> | ||
<link rel="import" href="../src/vaadin-time-picker.html"> | ||
<link rel="import" href="helpers.html"> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
describe('initial validation', () => { | ||
let timePicker, validateSpy; | ||
|
||
beforeEach(() => { | ||
timePicker = document.createElement('vaadin-time-picker'); | ||
validateSpy = sinon.spy(timePicker, 'validate'); | ||
}); | ||
|
||
afterEach(() => { | ||
timePicker.remove(); | ||
}); | ||
|
||
it('should not validate by default', async() => { | ||
document.body.appendChild(timePicker); | ||
await nextRender(); | ||
expect(validateSpy.called).to.be.false; | ||
}); | ||
|
||
it('should not validate when the field has an initial value', async() => { | ||
timePicker.value = '12:00'; | ||
document.body.appendChild(timePicker); | ||
await nextRender(); | ||
expect(validateSpy.called).to.be.false; | ||
}); | ||
|
||
it('should not validate when the field has an initial value and invalid', async() => { | ||
timePicker.value = '12:00'; | ||
timePicker.invalid = true; | ||
document.body.appendChild(timePicker); | ||
await nextRender(); | ||
expect(validateSpy.called).to.be.false; | ||
}); | ||
}); | ||
</script> | ||
</body> |