Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix vue2 global directives in component testing
- Loading branch information
Stepan Rusakov
committed
Nov 1, 2022
1 parent
a3770f2
commit 5480fca
Showing
9 changed files
with
119 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# vueclivue2-unconfigured | ||
# vueclivue2-configured | ||
|
||
## Project setup | ||
``` | ||
|
9 changes: 9 additions & 0 deletions
9
...ests/projects/vueclivue2-configured/src/components/GlobalComponentWithCustomDirective.vue
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,9 @@ | ||
<template> | ||
<div class="child" v-custom="test" /> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'GlobalComponentWithCustomDirective', | ||
} | ||
</script> |
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,9 @@ | ||
export default { | ||
name: 'custom', | ||
bind (el, binding) { | ||
el.dataset['custom'] = binding.value | ||
}, | ||
unbind (el) { | ||
el.removeAttribute('data-custom') | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
import GlobalComponentWithCustomDirective from './components/GlobalComponentWithCustomDirective.vue' | ||
import custom from './directive' | ||
|
||
Vue.config.productionTip = false | ||
Vue.component('GlobalComponentWithCustomDirective', GlobalComponentWithCustomDirective) | ||
Vue.directive('custom', custom) | ||
|
||
new Vue({ | ||
render: function (h) { return h(App) }, | ||
render (h) { | ||
return h(App) | ||
}, | ||
}).$mount('#app') |
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