当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript test-utils.shallowMount函数代码示例

本文整理汇总了TypeScript中@vue/test-utils.shallowMount函数的典型用法代码示例。如果您正苦于以下问题:TypeScript shallowMount函数的具体用法?TypeScript shallowMount怎么用?TypeScript shallowMount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了shallowMount函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('renders props.msg when passed', () => {
   const msg = 'new message';
   const wrapper = shallowMount(HelloWorld, {
     propsData: { msg },
   });
   expect(wrapper.text()).to.include(msg);
 });
开发者ID:USEPA,项目名称:E-Enterprise-Portal,代码行数:7,代码来源:HelloWorld.spec.ts

示例2: it

 it('should work', () => {
   const wrapper = shallowMount(TaskListItem, {
     propsData: {
       task: {
         id: 'task-one',
         text: 'the task one'
       }
     }
   });
   expect(wrapper.text()).to.contain('id=task-one');
   expect(wrapper.text()).to.contain('text=the task one');
 });
开发者ID:loki2302,项目名称:html5-experiment,代码行数:12,代码来源:TaskListItem.spec.ts

示例3: test

  test('renders component with loader', () => {
    const wrapper: any = shallowMount(VueAutocomplete, {
      localVue,
      i18n,
      propsData: {
        placeholder: 'Type something',
        options:     AutocompleteOptionsFixture,
        isLoading:   true,
      },
    });

    expect(wrapper.findAll(VueLoader)).toHaveLength(1);
  });
开发者ID:trungx,项目名称:vue-starter,代码行数:13,代码来源:VueAutocomplete.spec.ts

示例4: it

    it ('should render correct contents', (done) => {
        const wrapper = shallowMount(Home, {
            propsData: { name: 'Vue' },
        });
        const vm = wrapper.vm as any;
        expect(vm.name).toBe('Vue');
        expect(vm.$el.querySelector('input')!.type).toBe('text');
        expect(vm.$el.querySelector('h3.result')!.textContent).toBe('');

        vm.result = 'Bye Vue';

        expect(vm.$el.querySelector('h3.result')!.textContent).toBe('Bye Vue');
        done();
    });
开发者ID:ServiceStack,项目名称:ServiceStackVS,代码行数:14,代码来源:Home.spec.ts

示例5: test

  test('renders onSubmit', (done) => {
    const wrapper = shallowMount(FormExample,
                          {
                            i18n,
                            localVue,
                          },
    ) as any;

    wrapper.vm.onSubmit();
    expect(wrapper.vm.isLoading).toBeTruthy();

    setTimeout(() => {
      expect(wrapper.vm.isLoading).toBeFalsy();
      done();
    }, 550);
  });
开发者ID:trungx,项目名称:vue-starter,代码行数:16,代码来源:FormExample.spec.ts

示例6: test

  test('renders component', () => {
    const store = new Vuex.Store({
                                   state: {
                                     app: {
                                       config: {
                                         features: {
                                           disableParticles: false,
                                         },
                                       },
                                     },
                                   },
                                 });
    const wrapper = shallowMount(Home, {
      store,
      localVue,
      i18n,
    });

    expect(wrapper.findAll(Stage)).toHaveLength(1);
    expect(wrapper.findAll(DevEx)).toHaveLength(1);
    expect(wrapper.findAll(EnterpriseReady)).toHaveLength(1);
    expect(wrapper.findAll(UserExperience)).toHaveLength(1);
    expect(wrapper.findAll(QuickStart)).toHaveLength(1);
  });
开发者ID:trungx,项目名称:vue-starter,代码行数:24,代码来源:Home.spec.ts

示例7: it

 it ('should render correct contents', () => {
     const wrapper = shallowMount(View1) as any;
     expect(wrapper.vm.$el.querySelector('h3')!.textContent).toBe('This is View 1');
 });
开发者ID:ServiceStack,项目名称:ServiceStackVS,代码行数:4,代码来源:View1.spec.ts


注:本文中的@vue/test-utils.shallowMount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。