Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/TreeViewNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@

if (childModel) {
this.model[this.childrenPropName].push(childModel);
this.$emit('treeViewNodeAdd', this.childModel, this.model, event);
this.$emit('treeViewNodeAdd', childModel, this.model, event);
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/TreeViewNode.interactions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ describe('TreeViewNode.vue (interactions)', () => {
expect(wrapper.emitted().treeViewNodeAdd.length).to.equal(1);
});

it('should pass the new node data to the treeViewNodeAdd event', async () => {
addChildButton.trigger('click');

await Promise.resolve(); // This just lets the callback resolve before the expect.

expect(wrapper.emitted().treeViewNodeAdd[0][0].id).to.equal('newId');
});

it('should add a subnode to the target node from the model', async () => {
addChildButton.trigger('click');

Expand Down