當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。