Skip to content
This repository was archived by the owner on Dec 25, 2017. It is now read-only.

Commit f4fcd64

Browse files
committed
feat(reset): change meta method name
BREAKING CHANGE: `$validatorReset` to `$resetValidation`
1 parent 6678a53 commit f4fcd64

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ setTimeout(function () {
372372

373373
# Reset validation results
374374

375-
You can reset the validation results with `$validatorReset()` Vue instance meta method that defined with validator dynamically. the below the exmpale:
375+
You can reset the validation results with `$resetValidation()` Vue instance meta method that defined with validator dynamically. the below the exmpale:
376376

377377
```html
378378
<div id="app">
@@ -391,7 +391,7 @@ You can reset the validation results with `$validatorReset()` Vue instance meta
391391
<p v-if="$validation1.comment.maxlength">Your comment is too long.</p>
392392
</div>
393393
<input type="submit" value="send" v-if="$validation1.valid">
394-
<button type="button" @click="onReset">Validation Reset</button>
394+
<button type="button" @click="onReset">Reset Validation</button>
395395
</form>
396396
<pre>{{ $validation1 | json }}</pre>
397397
</validator>
@@ -403,7 +403,7 @@ new Vue({
403403
el: '#app',
404404
methods: {
405405
onReset: function () {
406-
this.$validatorReset()
406+
this.$resetValidation()
407407
}
408408
}
409409
})

example/reset/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title>validation result reset example</title>
5+
<title>validation result resetting example</title>
66
<script src="../../node_modules/vue/dist/vue.min.js"></script>
77
<script src="../../dist/vue-validator.min.js"></script>
88
<style>
@@ -26,7 +26,7 @@
2626
<p v-if="$validation1.comment.maxlength">Your comment is too long.</p>
2727
</div>
2828
<input type="submit" value="send" v-if="$validation1.valid">
29-
<button type="button" @click="onReset">Validation Reset</button>
29+
<button type="button" @click="onReset">Reset Validation</button>
3030
</form>
3131
<pre>{{ $validation1 | json }}</pre>
3232
</validator>
@@ -36,7 +36,7 @@
3636
el: '#app',
3737
methods: {
3838
onReset: function () {
39-
this.$validatorReset()
39+
this.$resetValidation()
4040
}
4141
}
4242
})

src/validator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export default class Validator {
3737
util.Vue.util.defineReactive(this._dir.vm, this.name, this._scope)
3838
this._dir.vm._validatorMaps[this.name] = this
3939

40-
// define the validation reset meta method to vue instance
41-
this._dir.vm.$validatorReset = () => {
40+
// define the validation resetting meta method to vue instance
41+
this._dir.vm.$resetValidation = () => {
4242
this.resetValidation()
4343
}
4444

test/specs/reset.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('reset', () => {
5151
trigger(field2, 'input')
5252
trigger(field2, 'blur')
5353
vm.$nextTick(() => {
54-
vm.$validatorReset()
54+
vm.$resetValidation()
5555

5656
assert(vm.$validator1.field1.required === false)
5757
assert(vm.$validator1.field1.min === false)
@@ -111,7 +111,7 @@ describe('reset', () => {
111111
trigger(checkbox2, 'change')
112112
trigger(checkbox2, 'blur')
113113
vm.$nextTick(() => {
114-
vm.$validatorReset()
114+
vm.$resetValidation()
115115

116116
assert(vm.$validator1.field1.required === false)
117117
assert(vm.$validator1.field1.minlength === false)
@@ -180,7 +180,7 @@ describe('reset', () => {
180180
trigger(radio3, 'change')
181181
trigger(radio3, 'blur')
182182
vm.$nextTick(() => {
183-
vm.$validatorReset()
183+
vm.$resetValidation()
184184

185185
assert(vm.$validator1.field1.required === false)
186186
assert(vm.$validator1.field1.valid === true)
@@ -245,7 +245,7 @@ describe('reset', () => {
245245
trigger(select, 'change')
246246
trigger(select, 'blur')
247247
vm.$nextTick(() => {
248-
vm.$validatorReset()
248+
vm.$resetValidation()
249249

250250
assert(vm.$validator1.lang.required === false)
251251
assert(vm.$validator1.lang.minlength === false)

0 commit comments

Comments
 (0)