-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #351 from suusan2go/fix-105
Fix #105 label slot for children nodes not working
- Loading branch information
Showing
8 changed files
with
288 additions
and
140 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 was deleted.
Oops, something went wrong.
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,85 @@ | ||
import Vue from "vue"; | ||
import Vuetify from "vuetify"; | ||
import { mount } from "@vue/test-utils"; | ||
import DraggableTreeview from "../src/DraggableTreeview.vue"; | ||
|
||
describe("DraggableTreeview", () => { | ||
test("renders correctly", () => { | ||
const wrapper = mount(DraggableTreeview, { | ||
vuetify: new Vuetify({ | ||
mocks: { | ||
$vuetify: { | ||
theme: { | ||
isDark: false, | ||
}, | ||
}, | ||
}, | ||
}), | ||
propsData: { | ||
value: [ | ||
{ | ||
id: 1, | ||
name: "test", | ||
children: [ | ||
{ | ||
id: 101, | ||
name: "test-children", | ||
children: [{ id: 201, name: "test-children-children" }], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}); | ||
expect(wrapper.element).toMatchSnapshot(); | ||
wrapper.find(".v-treeview-node__root").trigger("click"); | ||
Vue.nextTick().then(() => { | ||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
test("renders correctly with slot", () => { | ||
const wrapper = mount(DraggableTreeview, { | ||
vuetify: new Vuetify({ | ||
mocks: { | ||
$vuetify: { | ||
theme: { | ||
isDark: false, | ||
}, | ||
}, | ||
}, | ||
}), | ||
scopedSlots: { | ||
label({ item }: any) { | ||
return this.$createElement( | ||
"span", | ||
{ | ||
attrs: { class: "primary--text" }, | ||
}, | ||
[item.name] | ||
); | ||
}, | ||
}, | ||
propsData: { | ||
value: [ | ||
{ | ||
id: 1, | ||
name: "test", | ||
children: [ | ||
{ | ||
id: 101, | ||
name: "test-children", | ||
children: [{ id: 201, name: "test-children-children" }], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}); | ||
expect(wrapper.element).toMatchSnapshot(); | ||
wrapper.find(".v-treeview-node__root").trigger("click"); | ||
Vue.nextTick().then(() => { | ||
expect(wrapper.element).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.