Skip to content

Commit d8a3680

Browse files
author
Larry Botha
committed
test($modified): fix failing test for objects, add array test
1 parent 331a93a commit d8a3680

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

test/library.spec.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('createForm', () => {
127127
expect($modified.xs).toBe(false);
128128
});
129129

130-
it.only('is true for changed values', async () => {
130+
it('sets changed values to true', async () => {
131131
const name = 'foo';
132132
const street = 'bar';
133133
const xFoo = 'baz';
@@ -140,10 +140,24 @@ describe('createForm', () => {
140140
address: {street: '', city: '', country: ''},
141141
xs: [{foo: 'bar'}],
142142
},
143+
validationSchema: yup.object().shape({
144+
name: yup.string(),
145+
address: yup.object().shape({
146+
street: yup.string(),
147+
city: yup.string(),
148+
country: yup.string(),
149+
}),
150+
xs: yup.array().of(
151+
yup.object().shape({
152+
foo: yup.string(),
153+
}),
154+
),
155+
}),
143156
});
144157
let $modified;
145158

146159
await instance.handleChange(nameEvent);
160+
const $form = await subscribeOnce(instance.form);
147161
$modified = await subscribeOnce(instance.modified);
148162

149163
expect($modified.name).toBe(true);
@@ -156,6 +170,13 @@ describe('createForm', () => {
156170
expect($modified.name).toBe(true);
157171
expect($modified.address).toBe(true);
158172
expect($modified.xs).toBe(false);
173+
174+
await instance.handleChange(xEvent);
175+
$modified = await subscribeOnce(instance.modified);
176+
177+
expect($modified.name).toBe(true);
178+
expect($modified.address).toBe(true);
179+
expect($modified.xs).toBe(true);
159180
});
160181
});
161182

0 commit comments

Comments
 (0)