Skip to content

Commit

Permalink
feat: make rules watchable
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed May 14, 2020
1 parent 88bf28e commit 90530cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/Provider.ts
Expand Up @@ -42,6 +42,8 @@ export const ValidationProvider = defineComponent({
const $form = inject('$_veeObserver', undefined) as FormController | undefined;
// FIXME: is this right?
const disabled = computed(() => props.disabled as boolean);
const rules = computed(() => props.rules);

const {
errors,
failedRules,
Expand All @@ -52,7 +54,7 @@ export const ValidationProvider = defineComponent({
onBlur,
reset,
meta,
} = useField(fieldName, props.rules, {
} = useField(fieldName, rules, {
form: $form,
immediate: props.immediate as boolean,
bails: props.bails as boolean,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/provider.spec.ts
Expand Up @@ -90,7 +90,7 @@ test('validates initially with immediate prop', async () => {
expect(error.textContent).toContain(DEFAULT_REQUIRED_MESSAGE('field'));
});

test.skip('watches rules and re-validates', async () => {
test('watches rules and re-validates', async () => {
const wrapper = mountWithHoc({
setup() {
return {
Expand Down

0 comments on commit 90530cd

Please sign in to comment.