當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。