How to use vue-test-utils - 10 common examples

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 nsftx / chameleon-bundle-material / tests / unit / specs / BaseClass.spec.js View on Github external
each(components, (component, key) => {
    const localVue = createLocalVue();
    localVue.use(component, options);

    const cmpName = Object.keys(localVue.options.components)[0];
    const cmp = localVue.options.components[cmpName];
    const wrapper = shallow(cmp, {
      // Required prop definition
      propsData: {
        definition: {},
      },
      // Some components require global validators
      mocks: {
        $chameleon: {
          validators: {},
        },
        form: {},
      },
    });

    it(`Check if ${cmpName} contains base class c-element`, async () => {
      const resolvingPromise = new Promise((resolve) => {
        resolve();
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 Semantic-UI-Vue / Semantic-UI-Vue / test / specs / views / Card / CardDescription.spec.js View on Github external
it('should create a SUI CardDescription with default slot', () => {
    const cardContent = shallow(CardDescription, {
      slots: {
        default: '<span>Default slot</span>',
      },
    });
    expect(cardContent.is('div')).to.equal(true);
    expect(cardContent.classes()).to.include('description');
    expect(cardContent.text()).to.equal('Default slot');
  });
});
github Semantic-UI-Vue / Semantic-UI-Vue / test / specs / elements / Loader / Loader.spec.js View on Github external
it('should create a SUI Loader', () => {
    const loader = shallow(Loader);
    expect(loader.is('div')).to.equal(true);
    expect(loader.classes()).to.include('ui');
    expect(loader.classes()).to.include('loader');
  });
github Semantic-UI-Vue / Semantic-UI-Vue / test / specs / elements / Segment / Segment.spec.js View on Github external
it('should have content', () =&gt; {
    const segment = shallow(Segment, { slots: { default: '<span>bar</span>' } });
    expect(segment.text()).to.equal('bar');
  });
});
github Semantic-UI-Vue / Semantic-UI-Vue / test / specs / elements / Loader / Loader.spec.js View on Github external
it('should be able to set active', () => {
    const loader1 = shallow(Loader, { propsData: { active: true } });
    expect(loader1.classes()).to.include('active');

    const loader2 = shallow(Loader, { propsData: { active: false } });
    expect(loader2.classes()).to.not.include('active');
  });
github Semantic-UI-Vue / Semantic-UI-Vue / test / specs / elements / Button / Button.spec.js View on Github external
it('should be disabled when the Disabled property is true ', () => {
    const button = shallow(Button, { propsData: { content: 'foo', disabled: true } });
    expect(button.classes()).to.include('disabled');
  });
});
github eddyerburgh / vue-unit-test-perf-comparison / ava / Basic.spec.js View on Github external
test('Basic.vue', t => {
  const wrapper = shallow(Basic)
  t.is(wrapper.find('.hello h1').text(), 'Welcome to Your Vue.js App')
})
github eddyerburgh / vue-unit-test-perf-comparison / tape / Parent.spec.js View on Github external
test('Parent.vue renders 3 Child components', t => {
  t.plan(1)
  const wrapper = shallow(Parent)
  t.equal(wrapper.findAll(Child).length, 3)
})
github ktsn / vue-form-builder / test / unit / Helpers.spec.ts View on Github external
it('should update its value with changing model', () =&gt; {
      const wrapper = mount(create(``))

      const checkbox = q(wrapper, 'input')
      assert(checkbox.checked === true)
      wrapper.vm.user.hasPhone = false
      return Vue.nextTick().then(() =&gt; {
        assert(checkbox.checked === false)
      })
    })

vue-test-utils

Utilities for testing Vue components.

MIT
Latest version published 7 years ago

Package Health Score

59 / 100
Full package analysis