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


TypeScript ITimeoutService.flush方法代码示例

本文整理汇总了TypeScript中angular.ITimeoutService.flush方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ITimeoutService.flush方法的具体用法?TypeScript ITimeoutService.flush怎么用?TypeScript ITimeoutService.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular.ITimeoutService的用法示例。


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

示例1: function

    function () {
      let $scope = $rootScope.$new()

      let ganttApi
      let ready = false
      $scope.api = function (api) {
        ganttApi = api

        ganttApi.core.on.ready($scope, function () {
          ready = true
        })
      }

      $compile('<div gantt api="api"></div>')($scope)
      $scope.$digest()
      $timeout.flush()

      expect(ganttApi).to.be.not.undefined
      expect(ready).to.be.ok

      ganttApi = undefined
      ready = false

      $compile('<div gantt api="api"></div>')($scope)
      $scope.$digest()
      $timeout.flush()

      expect(ganttApi).to.be.not.undefined
      expect(ready).to.be.ok
    }
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:30,代码来源:gantt.factory.spec.ts

示例2: it

    it('polls until the execution matches, then resolves', () => {
      const executionId = 'abc';
      const url = [SETTINGS.gateUrl, 'pipelines', executionId].join('/');
      let succeeded = false;

      $httpBackend.expectGET(url).respond(200, { thingToMatch: false });

      executionService.waitUntilExecutionMatches(executionId, (execution) => (execution as any).thingToMatch)
        .then(() => succeeded = true);

      expect(succeeded).toBe(false);

      $httpBackend.flush();
      expect(succeeded).toBe(false);

      // no match, retrying
      $httpBackend.expectGET(url).respond(200, { thingToMatch: false });
      timeout.flush();
      $httpBackend.flush();

      expect(succeeded).toBe(false);

      // still no match, retrying again
      $httpBackend.expectGET(url).respond(200, { thingToMatch: true });
      timeout.flush();
      $httpBackend.flush();

      expect(succeeded).toBe(true);
    });
开发者ID:robfletcher,项目名称:deck,代码行数:29,代码来源:execution.service.spec.ts

示例3: it

    it('limits executions per pipeline', function () {
      const application: Application = modelBuilder.createApplication({key: 'executions', lazy: true}, {key: 'pipelineConfigs', lazy: true});
      application.getDataSource('executions').data = [
        { pipelineConfigId: '1', name: 'pipeline 1', endTime: 1, stages: [] },
        { pipelineConfigId: '1', name: 'pipeline 1', endTime: 2, stages: [] },
        { pipelineConfigId: '1', name: 'pipeline 1', endTime: 3, stages: [] },
        { pipelineConfigId: '2', name: 'pipeline 2', endTime: 1, stages: [] },
      ];
      application.getDataSource('pipelineConfigs').data = [
        { name: 'pipeline 1', pipelineConfigId: '1' },
        { name: 'pipeline 2', pipelineConfigId: '2' },
      ];

      model.sortFilter.count = 2;
      model.sortFilter.groupBy = 'none';

      service.updateExecutionGroups(application);
      $timeout.flush();

      expect(model.groups.length).toBe(1);
      expect(model.groups[0].executions.length).toBe(3);
      expect(model.groups[0].executions.filter((ex: IExecution) => ex.pipelineConfigId === '1').length).toBe(2);
      expect(model.groups[0].executions.filter((ex: IExecution) => ex.pipelineConfigId === '2').length).toBe(1);

      model.sortFilter.groupBy = 'name';
      service.updateExecutionGroups(application);
      $timeout.flush();

      expect(model.groups.length).toBe(2);
      expect(model.groups[0].executions.length).toBe(2);
      expect(model.groups[1].executions.length).toBe(1);

    });
开发者ID:brujoand,项目名称:deck,代码行数:33,代码来源:executionFilter.service.spec.ts

示例4: it

    it('should wait until task is gone, then resolve', () => {
      const taskId = 'abc';
      const deleteUrl = [API.baseUrl, 'tasks', taskId].join('/');
      const checkUrl = [API.baseUrl, 'tasks', taskId].join('/');
      let completed = false;

      $httpBackend.expectDELETE(deleteUrl).respond(200, []);

      taskWriter.deleteTask(taskId).then(() => completed = true);

      // first check: task is still present
      $httpBackend.expectGET(checkUrl).respond(200, [{id: taskId}]);
      $httpBackend.flush();
      expect(completed).toBe(false);

      // second check: task retrieval returns some error, try again
      $httpBackend.expectGET(checkUrl).respond(500, null);
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(false);

      // third check: task is not present, should complete
      $httpBackend.expectGET(checkUrl).respond(404, null);
      timeout.flush();
      $httpBackend.flush();
      expect(completed).toBe(true);
    });
开发者ID:jcwest,项目名称:deck,代码行数:27,代码来源:task.write.service.spec.ts

示例5: it

        it('should add empty option to a new arriving array', () => {
            // given
            data = [{ id: 1, title: 'A' }];
            $compile(elem)($scope);
            $scope.$digest();
            $timeout.flush();

            // when
            $scope.$column.data = () => $timeout(() => [{ id: 1, title: 'B' }], 10);
            $scope.$digest();
            $timeout.flush();

            // then
            expect($scope.$selectData).toEqual([{ id: '', title: '' }, { id: 1, title: 'B' }]);
        });
开发者ID:QuBaR,项目名称:ng-table,代码行数:15,代码来源:selectFilterDs.spec.ts

示例6: it

        it("should initialise and load loading page when template cache is not ready", () => {
            pageRouterService.templateLoadingState = TemplateState.NotReady;
            spyOn(pageRouterService, "getPageTitle").and.returnValue("Test Page");
            spyOn($templateCache, "get").and.callFake(page => {
                if (page === "page/testpage.html") {
                    return "<div>some template</div>";
                } else if (page === "page/disclaimmain.html") {
                    return "<div>disclaimer</div>";
                }
            });

            initController();

            expect(ctrl.pageData).toEqual([
                {PageContent: `<div id="loader"></div>`, PageTitle: "CA London"}
            ]);
            expect(ctrl.pageName).toEqual("testpage");
            expect($window.document.title).toEqual("Cocaine Anonymous London");

            pageRouterService.templateLoadingState = TemplateState.Ready;
            $timeout.flush();

            expect(ctrl.pageData).toEqual([
                {PageContent: "<div>some template</div>"},
                {PageContent: "<div>disclaimer</div>"}
            ]);
            expect(ctrl.pageName).toEqual("testpage");
            expect($window.document.title).toEqual("Test Page | Cocaine Anonymous London");
        });
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:29,代码来源:page-router.controller.spec.ts

示例7: function

        function () {
          let $scope = $rootScope.$new()

          $scope.data = angular.copy(mockData)
          let ganttElement = $compile('<div gantt data="data"><gantt-tree></gantt-tree></div>')($scope)
          $scope.$digest()
          $timeout.flush()

          // Set the data in tree view ordering
          let orderedData = $scope.data.slice()
          let indices = {}

          angular.forEach($scope.data, function (rowModel, i) {
            if (rowModel.name) {
              indices[rowModel.name] = i
            }
          })

          /*jshint sub:true */
          let configRow = orderedData[indices['Config']]
          let setupRow = orderedData[indices['Setup']]
          let serverRow = orderedData[indices['Server']]

          orderedData[indices['Setup']] = serverRow
          orderedData[indices['Config']] = setupRow
          orderedData[indices['Server']] = configRow
          /*jshint sub:false */

          checkLabels(orderedData, ganttElement)
        }
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:30,代码来源:plugins.spec.ts


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