How to use the vue-test-utils.shallow 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 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 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 CarvueJS / carbon-components-vue / components / CaToggle / CaToggle.spec.js View on Github external
test('Mathes snapshot', () => {
    const wrapper = shallow(CaToggle);
    expect(wrapper.html()).toMatchSnapshot()
  });
})
github CarvueJS / carbon-components-vue / components / CaModal / CaModal.spec.js View on Github external
test('is a Vue instance', () => {
    const wrapper = shallow(CaModal);
    expect(wrapper.isVueInstance()).toBeTruthy();
  });
})

vue-test-utils

Utilities for testing Vue components.

MIT
Latest version published 7 years ago

Package Health Score

59 / 100
Full package analysis