Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 1a2175b

Browse files
author
Kent C. Dodds
committed
test(formly-field): Fix skipped tests
I had a crazy key that didn't make any sense. I changed that. Also updated the tests to be everything that needs to happen for the feature to be implemented. ref #468
1 parent af99394 commit 1a2175b

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/directives/formly-field.test.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -449,15 +449,12 @@ describe('formly-field', function() {
449449
});
450450

451451
describe(`defaultValue`, () => {
452-
const key = '♪┏(・o・)┛♪┗ ( ・o・) ┓♪';
452+
const key = 'foo';
453453
const defaultValue = '~=[,,_,,]:3';
454-
const nested = 'nested';
455-
const nestedKey = 'nested.field';
456454

457455
beforeEach(() => {
458456
scope.fields = [
459-
{template: input, key, defaultValue},
460-
{template: input, key: nestedKey, defaultValue}
457+
{template: input, key, defaultValue}
461458
];
462459
scope.model = {};
463460
});
@@ -503,12 +500,22 @@ describe('formly-field', function() {
503500
expect(scope.fields[0].initialValue).to.eq(defaultValue);
504501
});
505502

506-
it.skip(`should set the default value for nested keys`, () => {
507-
compileAndDigest();
508-
// This should pass
509-
expect(scope.model[nested].field).to.equal(defaultValue);
510-
// This should not pass
511-
expect(scope.model[nestedKey]).to.equal(defaultValue);
503+
describe(`nested keys`, () => {
504+
const nestedObject = 'foo.bar';
505+
const nestedArray = 'baz[0]';
506+
beforeEach(() => {
507+
const firstField = scope.fields[0];
508+
firstField.key = nestedObject;
509+
510+
const secondField = {template: input, key: nestedArray, defaultValue};
511+
scope.fields.push(secondField);
512+
});
513+
514+
it.skip(`should set the default value for nested keys`, () => {
515+
compileAndDigest();
516+
expect(scope.model.foo.bar).to.equal(defaultValue);
517+
expect(scope.model.baz[0]).to.equal(defaultValue);
518+
});
512519
});
513520
});
514521

0 commit comments

Comments
 (0)