-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: run watchers before updating component
- Loading branch information
1 parent
30659a5
commit c095221
Showing
4 changed files
with
52 additions
and
36 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 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,49 @@ | ||
import ComponentWithTransitionGroup from '~resources/components/component-with-transition-group.vue' | ||
import TransitionGroupStub from '~src/components/TransitionGroupStub' | ||
import { mount } from '~vue-test-utils' | ||
|
||
describe('TransitionGroupStub', () => { | ||
it('update synchronously when used as stubs for Transition', () => { | ||
const wrapper = mount(ComponentWithTransitionGroup, { | ||
stubs: { | ||
'transition-group': TransitionGroupStub | ||
} | ||
}) | ||
expect(wrapper.text()).contains('a') | ||
wrapper.setData({ a: 'b' }) | ||
expect(wrapper.text()).contains('b') | ||
}) | ||
|
||
it('updates watchers', () => { | ||
const TestComponent = { | ||
data: () => ({ | ||
someWatchedData: null, | ||
someData: null | ||
}), | ||
watch: { | ||
someWatchedData (newData) { | ||
console.log('asd') | ||
this.someData = newData | ||
} | ||
}, | ||
template: ` | ||
<transition-group | ||
mode="out-in" | ||
class="body" | ||
tag="div" | ||
> | ||
{{someData}} | ||
</transition-group> | ||
` | ||
} | ||
const wrapper = mount(TestComponent, { | ||
stubs: { | ||
'transition-group': TransitionGroupStub | ||
} | ||
}) | ||
wrapper.setData({ | ||
someWatchedData: 'some data' | ||
}) | ||
expect(wrapper.html()).contains('some data') | ||
}) | ||
}) |
File renamed without changes.