component.success.subscribe((res) => {
                fixture.detectChanges();
                fixture.whenStable().then(() => {
                    expect(res).toBeDefined();
                    let event: any = element.querySelector('diagram-end-event > diagram-event > raphael-circle[ng-reflect-stroke="#2632aa"]');
                    expect(event).not.toBeNull();

                    let iconEvent: any = element.querySelector('diagram-end-event > diagram-event >' +
                        ' diagram-container-icon-event > div > div > diagram-icon-error > raphael-icon-error');
                    expect(iconEvent).not.toBeNull();
                    let tooltip: any = element.querySelector('diagram-tooltip > div');
                    expect(tooltip.textContent).toContain(res.elements[0].id);
                    expect(tooltip.textContent).toContain(res.elements[0].type);
                });
            });
Пример #2
0
    dialog.open(PizzaMsg, config).then(dialogRef => {
      viewContainerFixture.detectChanges();

      let afterCloseResult: string;
      dialogRef.afterClosed().subscribe(result => {
        afterCloseResult = result;
      });

      dialogRef.close('Charmander');

      viewContainerFixture.whenStable().then(() => {
        expect(afterCloseResult).toBe('Charmander');
        expect(overlayContainerElement.childNodes.length).toBe(0);
      });
    });
            component.success.subscribe((res) => {
                fixture.detectChanges();
                fixture.whenStable().then(() => {
                    expect(res).toBeDefined();
                    let event: any = element.querySelector('diagram-start-event');
                    expect(event).not.toBeNull();

                    let iconEvent: any = element.querySelector('diagram-start-event > diagram-event >' +
                        ' diagram-container-icon-event > div > div > diagram-icon-signal > raphael-icon-signal');
                    expect(iconEvent).not.toBeNull();
                    let tooltip: any = element.querySelector('diagram-tooltip > div');
                    expect(tooltip.textContent).toContain(res.elements[0].id);
                    expect(tooltip.textContent).toContain(res.elements[0].type);
                });
            });
 it('should render a disabled attachForm button if the user select the original formId', async(() => {
     component.taskId = 1;
     component.formId = 2;
     component.attachFormControl.setValue(3);
     fixture.detectChanges();
     spyOn(taskService, 'attachFormToATask').and.returnValue(of(true));
     fixture.detectChanges();
     fixture.whenStable().then(() => {
         fixture.detectChanges();
         component.attachFormControl.setValue(2);
         fixture.detectChanges();
         let attachButton = fixture.debugElement.query(By.css('#adf-no-form-attach-form-button'));
         expect(attachButton.nativeElement.disabled).toBeTruthy();
     });
 }));
  it('should show QUEUED if status is QUEUED', async(() => {
    component.state = ScanState.QUEUED;
    fixture.detectChanges();

    fixture.whenStable().then(() => { // wait for async getRecentLogs
      fixture.detectChanges();

      let el: HTMLElement = fixture.nativeElement.querySelector('.bar-state');
      expect(el).toBeTruthy();
      let el2: HTMLElement = el.querySelector('span');
      expect(el2).toBeTruthy();
      expect(el2.textContent).toEqual('VULNERABILITY.STATE.QUEUED');

    });
  }));
Пример #6
0
    it('on init should get all things', async () => {
        const http = TestBed.get(HttpTestingController);
        const customConfiguration = TestBed.get(Configuration);
        const expectedResponse = [{ id: 1, name: 'NetCore' }];

        const url = customConfiguration.Server + 'api/things/';

        fixture.detectChanges();

        http.expectOne(url).flush(expectedResponse);

        fixture.whenStable().then(() => {
            expect(comp.things).toEqual(expectedResponse);
        });
    })
    it('should remove form if it is present', async(() => {
        component.taskId = 1;
        component.attachFormControl.setValue(10);
        component.formKey = 12;
        spyOn(taskService, 'deleteForm').and.returnValue(of({}));

        fixture.detectChanges();
        fixture.whenStable().then(() => {
            fixture.detectChanges();
            expect(element.querySelector('#adf-no-form-remove-button')).toBeDefined();
            const el = fixture.nativeElement.querySelector('#adf-no-form-remove-button');
            el.click();
            expect(component.formId).toBeNull();
        });
    }));
Пример #8
0
 it('should open to edit existing endpoint', async(()=>{
   fixture.detectChanges();
   fixture.whenStable().then(()=>{
     let de: DebugElement = fixture.debugElement.query(del=>del.classes['action-item']);
     expect(de).toBeTruthy();
     fixture.detectChanges();
     click(de);
     fixture.detectChanges();
     let deInput: DebugElement = fixture.debugElement.query(By.css('input'));
     expect(deInput).toBeTruthy();
     let elInput: HTMLElement = deInput.nativeElement;
     expect(elInput).toBeTruthy();
     expect(elInput.textContent).toEqual('target_01');
   });
 }));
  it('should show QUEUED if status is QUEUED', async(() => {
    component.summary.scan_status = VULNERABILITY_SCAN_STATUS.pending;
    fixture.detectChanges();

    fixture.whenStable().then(() => {
      fixture.detectChanges();

      let el: HTMLElement = fixture.nativeElement.querySelector('.bar-state');
      expect(el).toBeTruthy();
      let el2: HTMLElement = el.querySelector('span');
      expect(el2).toBeTruthy();
      expect(el2.textContent).toEqual('VULNERABILITY.STATE.QUEUED');

    });
  }));
    it('should update the property value after a successful update attempt', async(() => {
        component.editable = true;
        component.property.editable = true;
        component.property.value = null;
        const expectedDate = moment('Jul 10 2017', 'MMM DD YY');
        fixture.detectChanges();

        component.onDateChanged({ value: expectedDate });

        fixture.whenStable().then(
            (updateNotification) => {
                expect(component.property.value).toEqual(expectedDate.toDate());
            }
        );
    }));
Пример #11
0
   async(inject([], () => {
     let fixture: ComponentFixture<any> = TestBed.createComponent(TdFileInputBasicTestComponent);
     let component: TdFileInputBasicTestComponent = fixture.debugElement.componentInstance;
     component.multiple = false;
     component.disabled = false;
     fixture.detectChanges();
     fixture.whenStable().then(() => {
       fixture.debugElement.query(By.directive(TdFileInputComponent)).componentInstance.handleSelect([{}]);
       component.disabled = true;
       fixture.detectChanges();
       fixture.whenStable().then(() => {
         expect(fixture.debugElement.query(By.directive(TdFileInputComponent)).componentInstance.value).toBeUndefined();
       });
     });
 })));
 fixture.whenStable().then(() => {
   expect(fixture.debugElement.query(By.css('td-file-input'))).toBeTruthy();
   expect(fixture.debugElement.query(By.css('.td-file-upload'))).toBeFalsy();
   fixture.debugElement.query(By.directive(TdFileUploadComponent)).componentInstance.handleSelect([{}]);
   fixture.detectChanges();
   fixture.whenStable().then(() => {
     expect(component.selectFiles).toBeTruthy();
     expect(eventSpy.calls.count()).toBe(0);
     fixture.debugElement.query(By.css('.td-file-upload-cancel')).triggerEventHandler('click', new Event('click'));
     fixture.detectChanges();
     fixture.whenStable().then(() => {
       expect(eventSpy.calls.count()).toBe(1);
     });
   });
 });
            component.success.subscribe((res) => {
                fixture.detectChanges();
                fixture.whenStable().then(() => {
                    expect(res).not.toBeNull();
                    let shapeLane: any = element.querySelector('diagram-lanes > div > div > diagram-lane');
                    expect(shapeLane).not.toBeNull();

                    let shapeRect: any = element.querySelector('diagram-lanes > div > div > diagram-lane > raphael-rect');
                    expect(shapeRect).not.toBeNull();

                    let shapeText: any = element.querySelector('diagram-lanes > div > div > diagram-lane > raphael-text');
                    expect(shapeText).not.toBeNull();
                    expect(shapeText.attributes[2].value).toEqual('Backend');
                });
            });
    it('should create default component instance', (done) => {
        let field = new FormFieldModel(form, {
            type: FormFieldTypes.TEXT,
            id: 'FAKE-TXT-WIDGET'
        });

        component.field = field;
        fixture.detectChanges();

        fixture.whenStable().then(() => {
            expect(component.componentRef).toBeDefined();
            expect(component.componentRef.instance instanceof TextWidgetComponent).toBeTruthy();
            done();
        });
    });
Пример #15
0
  beforeEach((done) => {
    jasmine.MAX_PRETTY_PRINT_DEPTH = 10;
    jasmine.clock().uninstall();
    jasmine.clock().install();
    fixture = TestBed.createComponent(BanModalComponent);
    clientMock.response = {};

    comp = fixture.componentInstance;

    //set the user
    comp.data = {
      'guid': '1',
      'type': 'user',
      'name': 'test',
      'username': 'test',
      'language': 'en',
      'banned': 'no',
      'city': 'Parana',
      'merchant': false,
      'boostProPlus': false,
      'fb': false,
      'mature': 1,
      'monetized': '',
      'signup_method': false,
      'feature_flags': false,
      'programs': [],
      'plus': false,
      'verified': true,
      'disabled_boost': false,
      'wire_rewards': null,
      'chat': true,
      'subscribed': false,
      'subscriber': false,
      'subscribers_count': 73,
      'subscriptions_count': 29,
      'impressions': 14761,
      'boost_rating': '2'
    };
    fixture.detectChanges();

    if (fixture.isStable()) {
      done();
    } else {
      fixture.whenStable().then(() => {
        done();
      });
    }
  });
    it('should increase the number of likes when clicked', async(() => {
        spyOn(service, 'postRating').and.returnValue(of({
            entry: {
                id: 'likes',
                aggregate: { numberOfRatings: 3 }
            }
        }));

        let likeButton: any = element.querySelector('#adf-like-test-id');
        likeButton.click();

        fixture.whenStable().then(() => {
            fixture.detectChanges();
            expect(element.querySelector('#adf-like-counter').innerHTML).toBe('3');
        });
    }));
      it('should update list state search text on component apply', () => {
        let stateChecked = false;
        initializeToolbar();
        fixture.whenStable().then(() => {
          fixture.detectChanges();

          component.toolbar.searchComponent.applySearchText('something');
          fixture.detectChanges();
          state.take(1).subscribe((s) => {
            expect(s.search.searchText).toBe('something');
            stateChecked = true;
          });
          fixture.detectChanges();
          expect(stateChecked).toBe(true);
        });
      });
 it('should be un input para el IBAN en datos pago', fakeAsync (() => {
     comp.goToDatosPago();
     fixture.detectChanges();
     let inputEl = fixture.nativeElement.querySelectorAll('ion-input')[0];
     expect(inputEl).toBeUndefined();
     comp.cliente.formaPago = "RCB";
     fixture.detectChanges();
     inputEl = fixture.nativeElement.querySelectorAll('ion-input')[0];
     expect(inputEl).toBeDefined();
     tick();
     fixture.detectChanges();
     fixture.whenStable().then(() => {
         let elementWithFocus = document.activeElement;
         expect(elementWithFocus).toEqual(inputEl);                
     });
 }))
            it('should show unknown view when sharedLink file not found', (done) => {
                spyOn(alfrescoApiService.getInstance().core.sharedlinksApi, 'getSharedLink')
                    .and.returnValue(Promise.reject({}));

                component.sharedLinkId = 'the-Shared-Link-id';
                component.urlFile = null;
                component.mimeType = null;

                component.ngOnChanges(null);
                fixture.whenStable().then(() => {
                    fixture.detectChanges();
                    expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
                    done();
                });

            });
    it('should not display remove action if attachments are read only', () => {
        let change = new SimpleChange(null, '123', true);
        component.ngOnChanges({ 'processInstanceId': change });
        component.disabled = true;

        fixture.detectChanges();
        let actionButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="action_menu_0"]');
        actionButton.click();
        fixture.whenStable().then(() => {
            fixture.detectChanges();
            let actionMenu = fixture.debugElement.nativeElement.querySelectorAll('button.mat-menu-item').length;
            expect(fixture.debugElement.nativeElement.querySelector('[data-automation-id="View"]')).not.toBeNull();
            expect(fixture.debugElement.nativeElement.querySelector('[data-automation-id="Remove"]')).toBeNull();
            expect(actionMenu).toBe(2);
        });
    });
    it('should show the empty list component when the attachments list is empty for completed process', async(() => {
        getProcessRelatedContentSpy.and.returnValue(Observable.of({
            'size': 0,
            'total': 0,
            'start': 0,
            'data': []
        }));
        let change = new SimpleChange(null, '123', true);
        component.ngOnChanges({'processInstanceId': change});
        component.disabled = true;

        fixture.whenStable().then(() => {
            fixture.detectChanges();
            expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]').innerText.trim()).toEqual('PROCESS-ATTACHMENT.EMPTY.HEADER');
        });
    }));
 it('should display the filters', async(() => {
     spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
     let change = new SimpleChange(undefined, 'my-app-1', true);
     component.ngOnChanges({'appName': change});
     fixture.detectChanges();
     component.showIcons = true;
     fixture.whenStable().then(() => {
         fixture.detectChanges();
         let filters = fixture.debugElement.queryAll(By.css('mat-list-item[class*="adf-filters__entry"]'));
         expect(component.filters.length).toBe(3);
         expect(filters.length).toBe(3);
         expect(filters[0].nativeElement.innerText).toContain('FakeInvolvedTasks');
         expect(filters[1].nativeElement.innerText).toContain('FakeMyTasks1');
         expect(filters[2].nativeElement.innerText).toContain('FakeMyTasks2');
     });
 }));
        it('should create editProcessFilter form', async(() => {
            fixture.detectChanges();
            fixture.whenStable().then(() => {
                const stateController = component.editProcessFilterForm.get('status');
                const sortController = component.editProcessFilterForm.get('sort');
                const orderController = component.editProcessFilterForm.get('order');
                expect(component.editProcessFilterForm).toBeDefined();
                expect(stateController).toBeDefined();
                expect(sortController).toBeDefined();
                expect(orderController).toBeDefined();

                expect(stateController.value).toEqual('RUNNING');
                expect(sortController.value).toEqual('id');
                expect(orderController.value).toEqual('ASC');
            });
        }));
 it('should attach specific icon for each filter if hasIcon is true', async(() => {
     spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
     let change = new SimpleChange(undefined, 'my-app-1', true);
     component.ngOnChanges({'appName': change});
     fixture.detectChanges();
     component.showIcons = true;
     fixture.whenStable().then(() => {
         fixture.detectChanges();
         expect(component.filters.length).toBe(3);
         let filters = fixture.nativeElement.querySelectorAll('.adf-filters__entry-icon');
         expect(filters.length).toBe(3);
         expect(filters[0].innerText).toContain('adjust');
         expect(filters[1].innerText).toContain('done');
         expect(filters[2].innerText).toContain('inbox');
     });
 }));
    it('should can not change minutes value with the arrow keys', () => {
      const methodSpy = spyOn(component, 'changeMinutes').and.callThrough();
      component.minuteStep = 3;
      component.arrowkeys = false;

      component.writeValue(testTime(6,2,3));
      fixture.detectChanges();

      inputDebugMinutes.triggerEventHandler('keydown.ArrowUp', null);
      fixture.detectChanges();

      fixture.whenStable().then(() => {
        expect(inputMinutes.value).toEqual('02');
        expect(methodSpy).toHaveBeenCalledWith(component.minuteStep, 'key');
      });
    });
    it('should be possible to enter values', () => {
      expect(inputHours.getAttribute('readonly')).toBeFalsy();
      expect(inputMinutes.getAttribute('readonly')).toBeFalsy();

      component.showSeconds = true;
      component.writeValue(testTime());

      fixture.detectChanges();
      fixture.whenStable()
        .then(() => {
          fixture.detectChanges();
          inputSeconds = getInputElements(fixture)[2];

          expect(inputSeconds.getAttribute('readonly')).toBeFalsy();
        });
    });
        it('should call service to start process with the variables setted', async(() => {
            let inputProcessVariable: RestVariable[] = [];

            let variable: RestVariable = {};
            variable.name = 'nodeId';
            variable.value = 'id';

            inputProcessVariable.push(variable);

            component.variables = inputProcessVariable;
            component.onProcessDefChange('my:process1');
            component.startProcess();
            fixture.whenStable().then(() => {
                expect(startProcessSpy).toHaveBeenCalledWith('my:process1', 'My new process', undefined, undefined, inputProcessVariable);
            });
        }));
Пример #28
0
    it('should render empty', async(() => {

      let fixture: ComponentFixture<any> = TestBed.createComponent(TdHighlightEmptyStaticTestRenderingComponent);
      let component: TdHighlightEmptyStaticTestRenderingComponent = fixture.debugElement.componentInstance;
      let element: HTMLElement = fixture.nativeElement;

      expect(fixture.debugElement.query(By.css('td-highlight')).nativeElement.textContent.trim())
      .toBe(``);
      expect(fixture.debugElement.query(By.css('td-highlight pre code'))).toBeFalsy();
      fixture.detectChanges();
      fixture.whenStable().then(() => {
        fixture.detectChanges();
        expect(fixture.debugElement.query(By.css('td-highlight pre code'))).toBeFalsy();
        expect(fixture.debugElement.query(By.css('td-highlight')).nativeElement.textContent.trim()).toBe('');
      });
    }));
Пример #29
0
 it('should filter data by keyword', async(() => {
   fixture.detectChanges();
   fixture.whenStable().then(() => {
     fixture.detectChanges();
     comp.doSearchRepoNames('nginx');
     fixture.detectChanges();
     let de: DebugElement[] = fixture.debugElement.queryAll(By.css('datagrid-cell'));
     fixture.detectChanges();
     expect(de).toBeTruthy();
     expect(de.length).toEqual(1);
     let el: HTMLElement = de[0].nativeElement;
     fixture.detectChanges();
     expect(el).toBeTruthy();
     expect(el.textContent).toEqual('library/nginx');
   });
 }));
 it('should send correct data onSubmission',() => {
   component.selectedLoc={}
   component.postData={}
   component.selectedLoc.vicinity='Gainesville'
   component.selectedLoc.geometry={}
   component.selectedLoc.geometry.location={}
   component.selectedLoc.geometry.location.lat=98.5
   component.selectedLoc.geometry.location.lng=53.5
   component.name='SE'
   component.onSubmit();
   component=fixture.componentInstance
   fixture.detectChanges();
   fixture.whenStable().then(() => {
     expect(component.postData.meetUpName).toBe('SE');
   });
 });