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


TypeScript testing.flushMicrotasks函数代码示例

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


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

示例1: it

    it('should open multiple overlays', fakeAsyncTest(() => {
      let pizzaOverlayRef: OverlayRef;
      let cakeOverlayRef: OverlayRef;

      overlay.create().then(ref => {
        pizzaOverlayRef = ref;
        pizzaOverlayRef.attach(componentPortal);
      });

      flushMicrotasks();

      overlay.create().then(ref => {
        cakeOverlayRef = ref;
        cakeOverlayRef.attach(templatePortal);
      });

      flushMicrotasks();

      expect(overlayContainerElement.childNodes.length).toBe(2);
      expect(overlayContainerElement.textContent).toContain('Pizza');
      expect(overlayContainerElement.textContent).toContain('Cake');

      pizzaOverlayRef.dispose();
      expect(overlayContainerElement.childNodes.length).toBe(1);
      expect(overlayContainerElement.textContent).toContain('Cake');

      cakeOverlayRef.dispose();
      expect(overlayContainerElement.childNodes.length).toBe(0);
      expect(overlayContainerElement.textContent).toBe('');
    }));
开发者ID:9590,项目名称:material2,代码行数:30,代码来源:overlay.spec.ts

示例2: it

    it('should default the element to position: absolute', fakeAsyncTest(() => {
      strategy.apply(element);

      flushMicrotasks();

      expect(element.style.position).toBe('absolute');
    }));
开发者ID:marangor,项目名称:material2,代码行数:7,代码来源:global-position-strategy.spec.ts

示例3: beforeEach

    beforeEach(inject(deps, fakeAsync((tcb: TestComponentBuilder, o: Overlay) => {
      builder = tcb;
      overlay = o;

      builder.createAsync(TestComponentWithTemplatePortals).then(fixture => {
        fixture.detectChanges();
        templatePortal = fixture.componentInstance.templatePortal;
        componentPortal = new ComponentPortal(PizzaMsg, fixture.componentInstance.elementRef);
      });

      flushMicrotasks();
    })));
开发者ID:9590,项目名称:material2,代码行数:12,代码来源:overlay.spec.ts

示例4: it

    it('should apply the aria-live value polite by default', fakeAsyncTest(() => {
      let appFixture: ComponentFixture = null;

      builder.createAsync(TestApp).then(fixture => {
        appFixture = fixture;
      });

      flushMicrotasks();

      live.announce('Hey Google');

      // This flushes our 100ms timeout for the screenreaders.
      tick(100);

      expect(liveEl.textContent).toBe('Hey Google');
      expect(liveEl.getAttribute('aria-live')).toBe('polite');
    }));
开发者ID:AlmeroSteyn,项目名称:material2,代码行数:17,代码来源:live-announcer.spec.ts


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