-
Notifications
You must be signed in to change notification settings - Fork 85
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 (#1041)
- Loading branch information
1 parent
eb42fc5
commit 9d724c2
Showing
4 changed files
with
76 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,55 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>vaadin-combo-box validation tests</title> | ||
|
||
<script src="../../web-component-tester/browser.js"></script> | ||
<script src='../../webcomponentsjs/webcomponents-lite.js'></script> | ||
<link rel="import" href="../src/vaadin-combo-box.html"> | ||
<link rel="import" href="helpers.html"> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
describe('initial validation', () => { | ||
let comboBox; | ||
let validateSpy; | ||
|
||
beforeEach(() => { | ||
comboBox = document.createElement('vaadin-combo-box'); | ||
comboBox.allowCustomValue = true; | ||
validateSpy = sinon.spy(comboBox, 'validate'); | ||
}); | ||
|
||
afterEach(() => { | ||
comboBox.remove(); | ||
}); | ||
|
||
it('should not validate by default', async() => { | ||
document.body.appendChild(comboBox); | ||
await nextRender(); | ||
expect(validateSpy.called).to.be.false; | ||
}); | ||
|
||
it('should not validate when the field has an initial value', async() => { | ||
comboBox.value = 'foo'; | ||
document.body.appendChild(comboBox); | ||
await nextRender(); | ||
expect(validateSpy.called).to.be.false; | ||
}); | ||
|
||
it('should not validate when the field has an initial value and invalid', async() => { | ||
comboBox.value = 'foo'; | ||
comboBox.invalid = true; | ||
document.body.appendChild(comboBox); | ||
await nextRender(); | ||
expect(validateSpy.called).to.be.false; | ||
}); | ||
}); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |