當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript react-testing-library.wait函數代碼示例

本文整理匯總了TypeScript中react-testing-library.wait函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript wait函數的具體用法?TypeScript wait怎麽用?TypeScript wait使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wait函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

it('posts "unselectFixture" renderer requests', async () => {
  registerTestPlugins();

  const request = jest.fn();
  onRendererCore({ request });

  loadTestPlugins();
  emitRouterFixtureChange();

  await wait(() =>
    expect(request).toBeCalledWith(expect.any(Object), {
      type: 'unselectFixture',
      payload: {
        rendererId: 'mockRendererId1'
      }
    })
  );

  await wait(() =>
    expect(request).toBeCalledWith(expect.any(Object), {
      type: 'unselectFixture',
      payload: {
        rendererId: 'mockRendererId2'
      }
    })
  );
});
開發者ID:skidding,項目名稱:cosmos,代碼行數:27,代碼來源:onRouterFixtureChangeUnselect.ts

示例2: it

it('posts "selectFixture" renderer requests', async () => {
  registerTestPlugins();

  const request = jest.fn();
  onRendererCore({ request });

  loadTestPlugins();
  emitRouterFixtureChange();

  await wait(() =>
    expect(request).toBeCalledWith(expect.any(Object), {
      type: 'selectFixture',
      payload: {
        rendererId: 'mockRendererId1',
        fixtureId: { path: 'zwei.js', name: null },
        fixtureState: {}
      }
    })
  );

  await wait(() =>
    expect(request).toBeCalledWith(expect.any(Object), {
      type: 'selectFixture',
      payload: {
        rendererId: 'mockRendererId2',
        fixtureId: { path: 'zwei.js', name: null },
        fixtureState: {}
      }
    })
  );
});
開發者ID:skidding,項目名稱:cosmos,代碼行數:31,代碼來源:onRouterFixtureChangeSelect.ts

示例3: it

it('sends renderer response to renderer core', async () => {
  register();
  mockCore();
  pluginMocks.mockMessageHandler({ postRendererRequest: () => {} });

  const receiveResponse = jest.fn();
  pluginMocks.mockRendererCore({ receiveResponse });

  loadPlugins();

  const rendererReadyRes: RendererReadyResponse = {
    type: 'rendererReady',
    payload: {
      rendererId: 'mockRendererId',
      fixtures: { 'ein.js': null, 'zwei.js': null, 'drei.js': null }
    }
  };
  pluginMocks
    .getMessageHandlerContext()
    .emit('rendererResponse', rendererReadyRes);

  await wait(() =>
    expect(receiveResponse).toBeCalledWith(expect.any(Object), rendererReadyRes)
  );
});
開發者ID:skidding,項目名稱:cosmos,代碼行數:25,代碼來源:messages.ts

示例4: it

it('returns fixture state', async () => {
  registerTestPlugins();
  loadTestPlugins();
  await wait(() =>
    expect(getRendererCoreMethods().getFixtureState()).toEqual(fixtureState)
  );
});
開發者ID:skidding,項目名稱:cosmos,代碼行數:7,代碼來源:rendererReadyMultiRenderers.ts

示例5: it

it('sets URL params', async () => {
  register();
  loadTestPlugins();
  getRouterMethods().unselectFixture();

  await wait(() => expect(getUrlParams()).toEqual({}));
});
開發者ID:skidding,項目名稱:cosmos,代碼行數:7,代碼來源:unselectFixture.ts

示例6: it

it('updates fullscreen state', async () => {
  register();
  loadPlugins();
  const router = getRouterMethods();
  router.selectFixture(fixtureId, false);

  await wait(() => expect(router.isFullScreen()).toBe(false));
});
開發者ID:skidding,項目名稱:cosmos,代碼行數:8,代碼來源:selectFixture.ts


注:本文中的react-testing-library.wait函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。