How to use the vue-test-utils.createLocalVue function in vue-test-utils

To help you get started, we’ve selected a few vue-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github a62527776a / vue-floating-action-button / test / unit / specs / fab-container.spec.js View on Github external
describe('fab-cantainer.vue', () => {
  const localVue = createLocalVue()
  localVue.use(index)
  let wrapper = null

  beforeEach(() => {
    // 初始化wrapper
    wrapper = mount(FabCantainer, {
      localVue
    })
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 999999;
  })

  it('startAnimate', (done) => {
    let timeout = new Timeout()
    expect(wrapper.vm.touching).toBe(false)
    expect(wrapper.vm.animating).toBe(false)
    expect(wrapper.vm.mousedown).toBe(false)
github re-fort / vue-webpack-boilerplate / tests / unit / specs / pages / TopPage.spec.js View on Github external
import { mount, createLocalVue } from 'vue-test-utils'
import assert from 'assert'
import sinon from 'sinon'

import TopPage from 'src/pages/TopPage'

const localVue = createLocalVue()

describe('TopPage', function () {
  const $router = { push: () => sinon.stub() }

  it('renders button(s)', function () {
    const wrapper = mount(TopPage, { localVue })
    const buttons = wrapper.vm.buttons
    const wrapperArray = wrapper.findAll('.button')
    for (let [index, element] of wrapperArray.wrappers.entries()) {
      assert(element.text() === buttons[index].text)
    }
  })

  describe('push()', function () {
    it('adds "is-loading" class on clicked button', function () {
      const wrapper = mount(TopPage, { localVue, mocks: { $router } })
github staskobzar / amiws_queue / test / unit / specs / QueueData.spec.js View on Github external
import 'babel-polyfill'
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import Vuetify from 'vuetify'

import QueueData from '@/components/QueueData'
import * as mtype from '@/store/mutation-types'
import store from '@/store'
import Fixtures from './fixtures/QueueData'

const localVue = createLocalVue()

localVue.use(Vuex)
localVue.use(Vuetify)

describe('QueueData', () => {
  beforeEach(() => {
    store.commit(mtype.CLEAR_QUEUES_LIST)
    store.commit(mtype.SET_SELECTED_QUEUE, '')
  })

  it('shows message when not selected', () => {
    const comp = mount(QueueData, { store, localVue })
    expect(comp.contains('.members')).to.equal(false)
    expect(comp.contains('.callers')).to.equal(false)
    expect(comp.contains('.block-header')).to.equal(false)
  })
github wemake-services / wemake-vue-template / tests / unit / components / counter.spec.js View on Github external
import Vuex from 'vuex'
import { mount, createLocalVue } from 'vue-test-utils'
import Counter from 'components/Counter'
import createStore from 'store'
import * as types from 'store/types'

const localVue = createLocalVue()
localVue.use(Vuex)

describe('Counter component unit tests', () => {
  let store

  beforeEach(() => {
    store = createStore()
  })

  it('should have three buttons', () => {
    const wrapper = mount(Counter, { store, localVue })

    expect(wrapper.findAll('button').length).toBe(3)
  })

  it('should have 0 as a default counter value', () => {
github re-fort / vue-webpack-boilerplate / tests / unit / specs / pages / SearchPage.spec.js View on Github external
import { mount, createLocalVue } from 'vue-test-utils'
import assert from 'assert'
import sinon from 'sinon'

import SearchPage from 'src/pages/SearchPage'

const localVue = createLocalVue()

describe('SearchPage', function () {
  const $router = { push: () => sinon.stub() }

  it('renders button(s)', function () {
    const wrapper = mount(SearchPage, { localVue })
    const buttons = wrapper.vm.buttons
    const wrapperArray = wrapper.findAll('.button')
    for (let [index, element] of wrapperArray.wrappers.entries()) {
      assert(element.text() === buttons[index].text)
    }
  })

  describe('push()', function () {
    it('adds "is-loading" class on clicked button', function () {
      const wrapper = mount(SearchPage, { localVue, mocks: { $router } })
github staskobzar / amiws_queue / test / unit / specs / MenuPanel.spec.js View on Github external
import 'babel-polyfill'
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import Vuetify from 'vuetify'
import sinon from 'sinon'

import * as mtype from '@/store/mutation-types'
import store from '@/store'
import Fixtures from './fixtures/MenuPanel'
import MenuPanel from '@/components/MenuPanel'

const localVue = createLocalVue()

localVue.use(Vuex)
localVue.use(Vuetify)

describe('MenuPanel', () => {
  beforeEach(() => {
    store.commit(mtype.CLEAR_QUEUES_LIST)
    store.commit(mtype.CLEAR_AMISRV_LIST)
  })

  it('show only one pagination when less queues then perPage param', () => {
    Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg))
    const comp = mount(MenuPanel, { store, localVue })
    expect(comp.findAll('.pagination__item').length).to.equal(1)
  })
github jplhomer / lifeboat / test / specs / Settings.spec.js View on Github external
import { createLocalVue, shallow } from "vue-test-utils";
import Vuex from "vuex";
import Settings from "@/components/Settings";
import Grid from "@/components/Grid";
import * as fs from "fs";

const localVue = createLocalVue();
localVue.use(Vuex);

describe("Settings.vue", () => {
  let store;
  let wrapper;
  let mutations;
  let actions;

  beforeEach(() => {
    mutations = {
      UPDATE_SETTING: sinon.stub()
    };

    actions = {
      addProject: sinon.spy()
    };
github re-fort / vue-webpack-boilerplate / tests / unit / specs / pages / SearchUserPage.spec.js View on Github external
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import assert from 'assert'
import sinon from 'sinon'

import { Xhr } from 'api/index'
import SearchUserPage from 'src/pages/SearchUserPage'

const localVue = createLocalVue()
localVue.use(Vuex)

describe('SearchUserPage', function () {
  const store = new Vuex.Store({
    modules: {
      Auth: {
        namespaced: true,
        state: { token: '' },
      },
    },
  })

  const users = [
    {
      avatar_url: 'https://avatars2.githubusercontent.com/u/3705391?v=4',
      login: 're-fort',
github re-fort / vue-webpack-boilerplate / tests / unit / specs / App.spec.js View on Github external
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import assert from 'assert'

import App from 'src/App'
import AuthModule from 'src/store/modules/Auth'
import { stubComponent } from 'tests/unit/stubs/component'

const localVue = createLocalVue()
localVue.use(Vuex)

describe('App', function () {
  const routerView = stubComponent.create('router-view')
  const routerLink = stubComponent.create('router-link')

  Vue.component(routerView.name, routerView)
  Vue.component(routerLink.name, routerLink)

  //delete mounted hook, because it contains methods to need a stub
  delete App.created

  const authStore = {
    namespaced: true,
    mutations: AuthModule.mutations,
    getters: AuthModule.getters,
github jplhomer / lifeboat / test / specs / ProjectService.spec.js View on Github external
import { shallow, createLocalVue } from "vue-test-utils";
import ProjectService from "@/components/Dashboard/ProjectService";
import Vuex from "vuex";

const localVue = createLocalVue();
localVue.use(Vuex);

describe("ProjectService.vue", () => {
  let wrapper;
  let store;

  beforeEach(() => {
    store = new Vuex.Store({
      state: {},
      getters: {
        projectLogFilters: () => () => [],
        projectActiveTab: () => () => "logs"
      }
    });

    wrapper = shallow(ProjectService, {

vue-test-utils

Utilities for testing Vue components.

MIT
Latest version published 7 years ago

Package Health Score

59 / 100
Full package analysis