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


TypeScript testing.discardPeriodicTasks函数代码示例

本文整理汇总了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;未经允许,请勿转载。