-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
get('value')
retrieve empty array removed after update()
`get('value')` retrieve empty array removed after `update()`
- Loading branch information
1 parent
8d18b2f
commit 928cacf
Showing
7 changed files
with
50 additions
and
8 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
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import { Form } from "../../../../src"; | ||
import FormInterface from "../../../../src/models/FormInterface"; | ||
import { expect } from "chai"; | ||
|
||
const values = { pieces: [{ id: "2", blocks: [{ id: "1" }] }] }; | ||
|
||
const removeBlocks = { pieces: [{ id: "3", blocks: [] }] }; | ||
|
||
export default new Form( | ||
{ | ||
fields: [ | ||
"pieces[]", | ||
"pieces[].blocks[]", | ||
"pieces[].blocks[].id", | ||
"pieces[].id" | ||
], | ||
values, | ||
}, | ||
{ | ||
name: 'Fixes-Z', | ||
hooks: { | ||
onInit(form: FormInterface) { | ||
|
||
form.update(removeBlocks); | ||
|
||
describe("Nested udpate()", () => | ||
it('blocks should be empty array', () => | ||
expect(form.values()).to.be.deep.equal(removeBlocks))); | ||
} | ||
} | ||
} | ||
); |