-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
809335a
commit 095678d
Showing
4 changed files
with
27 additions
and
3 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
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 |
---|---|---|
|
@@ -20,6 +20,7 @@ describe('vue-form', function () { | |
<input v-model="model.k" v-form-ctrl name="k" type="number" max="10" /> | ||
<input v-model="model.l" v-form-ctrl name="l" type="url" /> | ||
<input v-model="model.m" v-form-ctrl name="m" type="text" :pattern="'[A-Za-z]{3}'" /> | ||
<input v-model="model.n" v-form-ctrl name="n" type="email" required minlength="8" /> | ||
<input v-model="model.o" v-form-ctrl name="o" type="text" custom-validator="customValidator" /> | ||
<input type="checkbox" value="Jack" v-model="multicheck" v-form-ctrl required name="multicheck"/> | ||
|
@@ -44,6 +45,7 @@ describe('vue-form', function () { | |
k: 5, | ||
l: 'non url', | ||
m: 'x', | ||
n: '', | ||
o: 'abc', | ||
multicheck: [] | ||
} | ||
|
@@ -178,6 +180,28 @@ describe('vue-form', function () { | |
Vue.nextTick(done); | ||
}); | ||
}); | ||
|
||
it('should validate multiple validators', function (done) { | ||
expect(vm.myform.n.$valid).toBe(false); | ||
// pass required | ||
vm.model.n = 'abc'; | ||
Vue.nextTick(function () { | ||
// email will be invalid | ||
expect(vm.myform.n.$valid).toBe(false); | ||
// pass email | ||
vm.model.n = '[email protected]'; | ||
Vue.nextTick(function () { | ||
// minlength will be invalid | ||
expect(vm.myform.n.$valid).toBe(false); | ||
// pass minlength | ||
vm.model.n = '[email protected]'; | ||
Vue.nextTick(function () { | ||
expect(vm.myform.n.$valid).toBe(true); | ||
Vue.nextTick(done); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should validate custom-validator', function (done) { | ||
expect(vm.myform.o.$valid).toBe(false); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.