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
context.app.$hello = 'world' | |
Vue.prototype.$hello = 'world' |
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
export default (context, inject) => { | |
inject('hello', 'world') | |
} |
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 Vue from 'vue' | |
Vue.prototype.$hello = 'world' |
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 Vue from 'vue' | |
const myVuePlugin = { | |
install(Vue, options) { | |
Vue.prototype.$hello = 'world' | |
}, | |
} | |
Vue.use(myVuePlugin) | |
myVueInstance = new 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
import { shallowMount } from '@vue/test-utils' | |
import LoginForm from '@/components/LoginForm.vue' | |
import { BootstrapVue, BModal } from 'bootstrap-vue' | |
describe('LoginForm', () => { | |
let wrapper | |
beforeAll(() => { | |
Vue.use(BootstrapVue) | |
const container = document.createElement('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
<template> | |
<div> | |
<b-modal @shown="focusUsername"> | |
<b-form-input | |
ref="username" | |
v-model="username" | |
:placeholder="Username" | |
></b-form-input> | |
</b-modal> | |
</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 LoginForm from '@/components/LoginForm.vue' | |
import axios from 'axios' | |
describe('LoginForm', () => { | |
let wrapper | |
beforeAll(() => { | |
wrapper = mount(LoginForm, { | |
mocks: { | |
$axios: axios, |
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 { rest } from 'msw' | |
import { setupServer } from 'msw/node' | |
describe('LoginForm', () => { | |
let server | |
beforeAll(() => { | |
server = setupServer( | |
rest.post('/auth/login/', (request, response, context) => { | |
const username = request.body.username |
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 Navbar from '@/components/Navbar.vue' | |
describe('Navbar', () => { | |
test('gets loggedOnUser from store', () => { | |
const wrapper = mount(Navbar, { | |
mocks: { | |
$store: { state: { loggedOnUser: 'alice' } }, | |
}, | |
}) | |
expect(wrapper.vm.loggedOnUser).toBe('alice') |
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
export default { | |
computed: { | |
loggedOnUser() { | |
return this.$store.state.loggedOnUser | |
}, | |
}, | |
// ... | |
} |
NewerOlder