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
import { mount } from '@vue/test-utils' | |
import LoginForm from './LoginForm.vue' | |
describe('LoginForm', () => { | |
it('does not submit empty form', () => { | |
const wrapper = mount(LoginForm) | |
const form = wrapper.find('form') | |
form.trigger('submit') | |
expect(wrapper.emitted('submit')).toBeUndefined() | |
}) |
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
<script> | |
export default { | |
name: 'LoginForm', | |
emits: ['submit'], | |
data() { | |
return { | |
formData: { | |
username: '', | |
password: '', | |
}, |
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
describe('MyTransition.vue', () => { | |
// Make this test async | |
it('cleans styles after enter transition', async () => { | |
... | |
// Wait for async stuff to finish | |
await asyncStuff() | |
expect(foo.element.style.cssText).toEqual('') | |
}) | |
}) |
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
import { mount, config } from '@vue/test-utils' | |
import MyTransition from './my-transition.vue' | |
// Use default vue transition comp | |
config.stubs.transition = false | |
describe('MyTransition.vue', () => { | |
it('cleans styles after enter transition', () => { | |
const comp = { | |
template: `<div><my-transition><p v-show="show">foo</p></my-transition></div>`, |
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
import { mount, config } from '@vue/test-utils' | |
import MyTransition from './my-transition.vue' | |
import AwaitPromises from 'await-promises' | |
// Use default vue transition comp | |
config.stubs.transition = false | |
describe('MyTransition.vue', () => { | |
it('cleans styles after enter transition', async () => { | |
// Initialize waiter |
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
<template> | |
<transition | |
@enter="enter" | |
@after-enter="afterEnter" | |
@leave="leave" | |
@after-leave="afterLeave" | |
> | |
<slot /> | |
</transition> | |
</template> |
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
var disableBodyScroll = (function () { | |
/** | |
* Private variables | |
*/ | |
var _selector = false, | |
_element = false, | |
_clientY; | |
/** | |
* Polyfills for Element.matches and Element.closest |