当前位置: 首页>>代码示例>>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;未经允许,请勿转载。