Skip to content

Commit

Permalink
update naming to get area content by name
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurtil committed May 17, 2020
1 parent f45bf98 commit 229a6e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@
},
}).$mount('#app');

areas = vm.$refs.areas;
areas.getComponentByName("comp1").cfg.props.text = "Youhou ! =D"; // This is reactive !
// areas = vm.$refs.areas;
// areas.getAreaContentByName("comp1").cfg.props.text = "Youhou ! =D"; // This is reactive !

</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/Areas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default {
this.$nextTick(this.reattachTeleports);
},
getComponentByName(name) {
getAreaContentByName(name) {
return this.areasContent
.filter(Boolean)
.filter(areaContent => areaContent.name)
Expand Down
4 changes: 2 additions & 2 deletions unitTest/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('Areas', () => {
},
],
layout: {
name: 'targetComponent',
name: 'targetArea',
componentIndex: 0,
cfg: {
props: {
Expand All @@ -179,7 +179,7 @@ describe('Areas', () => {
const wrapper = shallowMount(Areas, { propsData: { cfg } });
expect(wrapper.html()).toMatchSnapshot();

wrapper.vm.getComponentByName("targetComponent").cfg.props.text = "text updated";
wrapper.vm.getAreaContentByName("targetArea").cfg.props.text = "text updated";
await Vue.nextTick();
expect(wrapper.html()).toMatchSnapshot();
});
Expand Down

0 comments on commit 229a6e4

Please sign in to comment.