• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript testing.discardPeriodicTasks函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fakeAsync

    fakeAsync(() => {
      const html = `
      <carousel [keyboard]="keyboard">
        <slide>slide1</slide>
        <slide>slide2</slide>
      </carousel>
    `;

      const fixture = createTestComponent(html);
      expectActiveSlides(fixture.nativeElement, [true, false]);

      fixture.componentInstance.keyboard = false;
      fixture.detectChanges();
      fixture.debugElement
        .query(By.directive(CarouselComponent))
        .triggerEventHandler('keydown.arrowRight', {}); // prev()
      fixture.detectChanges();
      expectActiveSlides(fixture.nativeElement, [true, false]);

      fixture.componentInstance.keyboard = true;
      fixture.detectChanges();
      fixture.debugElement
        .query(By.directive(CarouselComponent))
        .triggerEventHandler('keydown.arrowRight', {}); // next()
      fixture.detectChanges();
      expectActiveSlides(fixture.nativeElement, [false, true]);

      discardPeriodicTasks();
    })
开发者ID:OlegDubrovskyi,项目名称:ngx-bootstrap,代码行数:29,代码来源:carousel.spec.ts


示例2: it

  it('should fetch HTTP endpoint once and only once', fakeAsync(() => {
    const mockFeatureTogglesMap = [
      {
        rbd: true,
        mirroring: true,
        iscsi: true,
        cephfs: true,
        rgw: true
      }
    ];

    service
      .get()
      .subscribe((featureTogglesMap) => expect(featureTogglesMap).toEqual(mockFeatureTogglesMap));
    tick();

    // Second subscription shouldn't trigger a new HTTP request
    service
      .get()
      .subscribe((featureTogglesMap) => expect(featureTogglesMap).toEqual(mockFeatureTogglesMap));

    const req = httpTesting.expectOne(service.API_URL);
    req.flush(mockFeatureTogglesMap);
    discardPeriodicTasks();
  }));
开发者ID:LenzGr,项目名称:ceph,代码行数:25,代码来源:feature-toggles.service.spec.ts


示例3: it

  it('should not wrap slide changes by when requested', fakeAsync(() => {
    const html = `
      <carousel [noWrap]="true">
        <slide>slide1</slide>
        <slide>slide2</slide>
      </carousel>
    `;

    const fixture = createTestComponent(html);

    const controlElms = fixture.nativeElement.querySelectorAll('.carousel-control');

    expectActiveSlides(fixture.nativeElement, [true, false]);

    controlElms[0].click();  // prev
    fixture.detectChanges();
    expectActiveSlides(fixture.nativeElement, [true, false]);

    controlElms[1].click();  // next
    fixture.detectChanges();
    expectActiveSlides(fixture.nativeElement, [false, true]);

    controlElms[1].click();  // next
    fixture.detectChanges();
    expectActiveSlides(fixture.nativeElement, [false, true]);

    discardPeriodicTasks();
  }));
开发者ID:yusijs,项目名称:ng2-bootstrap,代码行数:28,代码来源:carousel.spec.ts


示例4: fakeAsync

    fakeAsync(() => {
      const mockMessage = {
        items: [
          {
            id: 1,
            authorDetails: { displayName: 'Kevin' },
            snippet: { type: 'textMessageEvent', displayMessage: 'test' }
          },
          {
            id: 2,
            authorDetails: { displayName: 'Kevin' },
            snippet: { type: 'superChatEvent', displayMessage: 'test' }
          }
        ]
      };
      spyOn(service, 'queryLiveChat').and.returnValue(of(mockMessage));
      service.messages$.subscribe(message => {
        expect(message).toEqual([
          {
            id: 1,
            displayName: 'Kevin',
            displayMessage: 'test'
          },
          {
            id: 2,
            displayName: 'Kevin',
            displayMessage: 'test'
          }
        ]);
      });

      service['pollingIntervalMillis$'].next(100);
      tick(100);
      discardPeriodicTasks();
    })
开发者ID:chgc,项目名称:stream-tools,代码行数:35,代码来源:broadcast.service.spec.ts


示例5: fakeAsync

            + '\'TEXT\'. And dispatch NoteSnippetEditorInsertImageEvent when user select file.', fakeAsync(() => {
            const selectedNote = noteDummy.create();
            const content = contentDummy.create();
            content.snippets[0] = new NoteSnippetContentDummy().create(NoteSnippetTypes.TEXT);

            ensureSelectNoteAndLoadNoteContent(selectedNote, content);

            activateSnippetAtIndex(0);
            fixture.detectChanges();

            spyOn(nativeDialog, 'showOpenDialog').and.returnValue(of({
                isSelected: true,
                filePaths: ['/foo/bar/assets/some-image.png'],
            } as NativeDialogOpenResult));

            spyOn(noteEditor, 'copyAssetFile').and.returnValue(of({
                fileNameWithoutExtension: 'some-image',
                relativePathToWorkspaceDir: './some-image.png',
            } as Asset));

            menuMessages.next(MenuEvent.INSERT_IMAGE);
            flush();
            flush();
            flush();

            expect(nativeDialog.showOpenDialog).toHaveBeenCalledWith({
                message: 'Choose an image:',
                properties: NativeDialogProperties.OPEN_FILE,
                fileFilters: [nativeDialogFileFilters.IMAGES],
            } as NativeDialogConfig);

            expect(noteEditor.copyAssetFile).toHaveBeenCalledWith(
                AssetTypes.IMAGE,
                selectedNote.contentFilePath,
                '/foo/bar/assets/some-image.png',
            );

            expect(listManager.handleSnippetRefEvent).toHaveBeenCalled();

            const event = (
                listManager.handleSnippetRefEvent as Spy
            ).calls.first().args[0] as NoteSnippetEditorInsertImageEvent;

            // noinspection SuspiciousInstanceOfGuard
            expect(event instanceof NoteSnippetEditorInsertImageEvent).toBe(true);
            expect(event.payload.fileName).toEqual('some-image');
            expect(event.payload.filePath).toEqual('./some-image.png');

            discardPeriodicTasks();
        }));
开发者ID:suiruiw,项目名称:geeks-diary,代码行数:50,代码来源:note-editor.component.spec.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript testing.expect函数代码示例发布时间:2022-05-28
下一篇:
TypeScript testing.describe函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap