beforeEach(() => {
   fixture = TestBed.createComponent(BookingErrorComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(TofaDataComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(ListSurveyComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
Example #4
0
 afterEach(() => {
   fixture.destroy();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(ComponentDeleteDialogComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
Example #6
0
describe('RbdListComponent', () => {
  let fixture: ComponentFixture<RbdListComponent>;
  let component: RbdListComponent;
  let summaryService: SummaryService;
  let rbdService: RbdService;

  const refresh = (data) => {
    summaryService['summaryDataSource'].next(data);
  };

  configureTestBed({
    imports: [
      SharedModule,
      BsDropdownModule.forRoot(),
      TabsModule.forRoot(),
      ModalModule.forRoot(),
      TooltipModule.forRoot(),
      ToastModule.forRoot(),
      AlertModule.forRoot(),
      ComponentsModule,
      RouterTestingModule,
      HttpClientTestingModule
    ],
    declarations: [RbdListComponent, RbdDetailsComponent, RbdSnapshotListComponent],
    providers: [SummaryService, TaskListService, RbdService]
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(RbdListComponent);
    component = fixture.componentInstance;
    summaryService = TestBed.get(SummaryService);
    rbdService = TestBed.get(RbdService);

    // this is needed because summaryService isn't being reset after each test.
    summaryService['summaryDataSource'] = new BehaviorSubject(null);
    summaryService['summaryData$'] = summaryService['summaryDataSource'].asObservable();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  describe('after ngOnInit', () => {
    beforeEach(() => {
      fixture.detectChanges();
      spyOn(rbdService, 'list').and.callThrough();
    });

    it('should load images on init', () => {
      refresh({});
      expect(rbdService.list).toHaveBeenCalled();
    });

    it('should not load images on init because no data', () => {
      refresh(undefined);
      expect(rbdService.list).not.toHaveBeenCalled();
    });

    it('should call error function on init when summary service fails', () => {
      spyOn(component.table, 'reset');
      summaryService['summaryDataSource'].error(undefined);
      expect(component.table.reset).toHaveBeenCalled();
      expect(component.viewCacheStatusList).toEqual([{ status: ViewCacheStatus.ValueException }]);
    });
  });

  describe('handling of executing tasks', () => {
    let images: RbdModel[];

    const addImage = (name) => {
      const model = new RbdModel();
      model.id = '-1';
      model.name = name;
      model.pool_name = 'rbd';
      images.push(model);
    };

    const addTask = (name: string, image_name: string) => {
      const task = new ExecutingTask();
      task.name = name;
      task.metadata = {
        pool_name: 'rbd',
        image_name: image_name,
        child_pool_name: 'rbd',
        child_image_name: 'd',
        dest_pool_name: 'rbd',
        dest_image_name: 'd'
      };
      summaryService.addRunningTask(task);
    };

    const expectImageTasks = (image: RbdModel, executing: string) => {
      expect(image.cdExecuting).toEqual(executing);
    };

    beforeEach(() => {
      images = [];
      addImage('a');
      addImage('b');
      addImage('c');
      component.images = images;
      refresh({ executing_tasks: [], finished_tasks: [] });
      spyOn(rbdService, 'list').and.callFake(() =>
        of([{ poool_name: 'rbd', status: 1, value: images }])
      );
      fixture.detectChanges();
    });

    it('should gets all images without tasks', () => {
      expect(component.images.length).toBe(3);
      expect(component.images.every((image) => !image.cdExecuting)).toBeTruthy();
    });

    it('should add a new image from a task', () => {
      addTask('rbd/create', 'd');
      expect(component.images.length).toBe(4);
      expectImageTasks(component.images[0], undefined);
      expectImageTasks(component.images[1], undefined);
      expectImageTasks(component.images[2], undefined);
      expectImageTasks(component.images[3], 'Creating');
    });

    it('should show when a image is being cloned', () => {
      addTask('rbd/clone', 'd');
      expect(component.images.length).toBe(4);
      expectImageTasks(component.images[0], undefined);
      expectImageTasks(component.images[1], undefined);
      expectImageTasks(component.images[2], undefined);
      expectImageTasks(component.images[3], 'Cloning');
    });

    it('should show when a image is being copied', () => {
      addTask('rbd/copy', 'd');
      expect(component.images.length).toBe(4);
      expectImageTasks(component.images[0], undefined);
      expectImageTasks(component.images[1], undefined);
      expectImageTasks(component.images[2], undefined);
      expectImageTasks(component.images[3], 'Copying');
    });

    it('should show when an existing image is being modified', () => {
      addTask('rbd/edit', 'a');
      addTask('rbd/delete', 'b');
      addTask('rbd/flatten', 'c');
      expect(component.images.length).toBe(3);
      expectImageTasks(component.images[0], 'Updating');
      expectImageTasks(component.images[1], 'Deleting');
      expectImageTasks(component.images[2], 'Flattening');
    });
  });

  describe('show action buttons and drop down actions depending on permissions', () => {
    let tableActions: TableActionsComponent;
    let scenario: { fn; empty; single };
    let permissionHelper: PermissionHelper;

    const getTableActionComponent = (): TableActionsComponent => {
      fixture.detectChanges();
      return fixture.debugElement.query(By.directive(TableActionsComponent)).componentInstance;
    };

    beforeEach(() => {
      permissionHelper = new PermissionHelper(component.permission, () =>
        getTableActionComponent()
      );
      scenario = {
        fn: () => tableActions.getCurrentButton().name,
        single: 'Edit',
        empty: 'Add'
      };
    });

    describe('with all', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(1, 1, 1);
      });

      it(`shows 'Edit' for single selection else 'Add' as main action`, () =>
        permissionHelper.testScenarios(scenario));

      it('shows all actions', () => {
        expect(tableActions.tableActions.length).toBe(6);
        expect(tableActions.tableActions).toEqual(component.tableActions);
      });
    });

    describe('with read, create and update', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(1, 1, 0);
      });

      it(`shows 'Edit' for single selection else 'Add' as main action`, () =>
        permissionHelper.testScenarios(scenario));

      it(`shows all actions except for 'Delete' and 'Move'`, () => {
        expect(tableActions.tableActions.length).toBe(4);
        component.tableActions.pop();
        component.tableActions.pop();
        expect(tableActions.tableActions).toEqual(component.tableActions);
      });
    });

    describe('with read, create and delete', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(1, 0, 1);
      });

      it(`shows 'Copy' for single selection else 'Add' as main action`, () => {
        scenario.single = 'Copy';
        permissionHelper.testScenarios(scenario);
      });

      it(`shows 'Add', 'Copy', 'Delete' and 'Move' action`, () => {
        expect(tableActions.tableActions.length).toBe(4);
        expect(tableActions.tableActions).toEqual([
          component.tableActions[0],
          component.tableActions[2],
          component.tableActions[4],
          component.tableActions[5]
        ]);
      });
    });

    describe('with read, edit and delete', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(0, 1, 1);
      });

      it(`shows always 'Edit' as main action`, () => {
        scenario.empty = 'Edit';
        permissionHelper.testScenarios(scenario);
      });

      it(`shows 'Edit', 'Flatten', 'Delete' and 'Move' action`, () => {
        expect(tableActions.tableActions.length).toBe(4);
        expect(tableActions.tableActions).toEqual([
          component.tableActions[1],
          component.tableActions[3],
          component.tableActions[4],
          component.tableActions[5]
        ]);
      });
    });

    describe('with read and create', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(1, 0, 0);
      });

      it(`shows 'Copy' for single selection else 'Add' as main action`, () => {
        scenario.single = 'Copy';
        permissionHelper.testScenarios(scenario);
      });

      it(`shows 'Copy' and 'Add' actions`, () => {
        expect(tableActions.tableActions.length).toBe(2);
        expect(tableActions.tableActions).toEqual([
          component.tableActions[0],
          component.tableActions[2]
        ]);
      });
    });

    describe('with read and edit', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(0, 1, 0);
      });

      it(`shows always 'Edit' as main action`, () => {
        scenario.empty = 'Edit';
        permissionHelper.testScenarios(scenario);
      });

      it(`shows 'Edit' and 'Flatten' actions`, () => {
        expect(tableActions.tableActions.length).toBe(2);
        expect(tableActions.tableActions).toEqual([
          component.tableActions[1],
          component.tableActions[3]
        ]);
      });
    });

    describe('with read and delete', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(0, 0, 1);
      });

      it(`shows always 'Delete' as main action`, () => {
        scenario.single = 'Delete';
        scenario.empty = 'Delete';
        permissionHelper.testScenarios(scenario);
      });

      it(`shows 'Delete' and 'Move' actions`, () => {
        expect(tableActions.tableActions.length).toBe(2);
        expect(tableActions.tableActions).toEqual([
          component.tableActions[4],
          component.tableActions[5]
        ]);
      });
    });

    describe('with only read', () => {
      beforeEach(() => {
        tableActions = permissionHelper.setPermissionsAndGetActions(0, 0, 0);
      });

      it('shows no main action', () => {
        permissionHelper.testScenarios({
          fn: () => tableActions.getCurrentButton(),
          single: undefined,
          empty: undefined
        });
      });

      it('shows no actions', () => {
        expect(tableActions.tableActions.length).toBe(0);
        expect(tableActions.tableActions).toEqual([]);
      });
    });
  });
});
 beforeEach(() => {
     fixture = TestBed.createComponent(CategorySortComponent);
     component = fixture.componentInstance;
     fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(NewClusterComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
describe('AskDialogService', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [MdDialogModule, DialogTestModule],
      providers: [AskDialogService],
    });
  });

  let service;
  let testViewContainerRef: ViewContainerRef;
  let viewContainerFixture: ComponentFixture<ChildViewContainerComponent>;

  beforeEach(inject([AskDialogService], (s: AskDialogService) => { service = s; }));

  beforeEach(() => {
    viewContainerFixture = TestBed.createComponent(ChildViewContainerComponent);

    viewContainerFixture.detectChanges();
    testViewContainerRef = viewContainerFixture.componentInstance.childViewContainer;
  });

  it('exists', () => { expect(service).toBeTruthy(); });

  describe('open', () => {
    let dialog;
    let dialogRef;
    beforeEach(() => {
      dialog = viewContainerFixture.debugElement.injector.get(MdDialog);
      dialogRef = {
        componentInstance: {
          title: '',
          message: ''
        },
        afterClosed: () => Observable.empty()
      };
      spyOn(dialog, 'open').and.returnValue(dialogRef);
    });

    it('opens the dialog', () => {
      service.open('title', 'message', testViewContainerRef);
      expect(dialog.open).toHaveBeenCalledTimes(1);
    });

    it('sets the title', () => {
      service.open('title', 'message', testViewContainerRef);
      expect(dialogRef.componentInstance.title).toEqual('title');
    });

    it('sets the message', () => {
      service.open('title', 'message', testViewContainerRef);
      expect(dialogRef.componentInstance.message).toEqual('message');
    });

    it('returns the after closed observable', () => {
      dialogRef.afterClosed = () => Observable.of('toast');
      let result: string;
      service.open('title', 'message', null).subscribe(res => result = res);
      expect(result).toEqual('toast');
    });
  });
});
 state.skip(1).take(1).subscribe(() => fixture.detectChanges());
 beforeEach(() => {
   fixture = TestBed.createComponent(CurrentAccountComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
describe('List column selector action', () => {
  let state: ListState,
    dispatcher: ListStateDispatcher,
    component: ListColumnSelectorActionTestComponent,
    fixture: ComponentFixture<ListColumnSelectorActionTestComponent>,
    nativeElement: HTMLElement;

  beforeEach(async(() => {
    dispatcher = new ListStateDispatcher();
    state = new ListState(dispatcher);

    TestBed.configureTestingModule({
      declarations: [
        ListColumnSelectorActionTestComponent

      ],
      imports: [
        SkyListColumnSelectorActionModule,
        SkyListModule,
        SkyListToolbarModule,
        SkyListSecondaryActionsModule,
        SkyGridModule,
        SkyListViewGridModule,
        SkyColumnSelectorModule
      ]
    })
    .overrideComponent(SkyListComponent, {
        set: {
          providers: [
            { provide: ListState, useValue: state },
            { provide: ListStateDispatcher, useValue: dispatcher }
          ]
        }
      });

    fixture = TestBed.createComponent(ListColumnSelectorActionTestComponent);
    nativeElement = fixture.nativeElement as HTMLElement;
    component = fixture.componentInstance;
    fixture.detectChanges();

    // always skip the first update to ListState, when state is ready
    // run detectChanges once more then begin tests
    state.skip(1).take(1).subscribe(() => fixture.detectChanges());
    fixture.detectChanges();
  }));

  beforeEach(
    inject(
      [
        SkyModalService
      ],
      (
        _modalService: SkyModalService
      ) => {
        _modalService.dispose();
      }
    )
  );

  it('should show an action in the secondary actions dropdown', fakeAsync(() => {
    tick();
    fixture.detectChanges();
    tick();
    /* tslint:disable */
    let query =
      '.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action';
    /* tslint:enable */
    expect(nativeElement.querySelector(query)).toHaveText('Choose columns');
  }));

  function getChooseColumnsAction() {
    /* tslint:disable */
    return nativeElement.querySelector('.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action button') as HTMLElement;
    /* tslint:enable */
  }

  it('should open the appropriate modal on click and apply column changes on save',
    fakeAsync(() => {
    tick();
    fixture.detectChanges();
    tick();

    getChooseColumnsAction().click();
    tick();
    fixture.detectChanges();

    let checkboxLabelEl =
      document.querySelector('.sky-modal .sky-list-view-checklist-item input') as HTMLElement;
    checkboxLabelEl.click();

    tick();
    fixture.detectChanges();

    let submitButtonEl =
      document.querySelector('.sky-modal .sky-btn-primary') as HTMLButtonElement;

    submitButtonEl.click();
    fixture.detectChanges();
    tick();

    component.grid.gridState.take(1).subscribe((gridState) => {
      expect(gridState.displayedColumns.items.length).toBe(2);
    });
    fixture.detectChanges();
    tick();

  }));

  it('should keep previous columns on cancel', fakeAsync(() => {
    tick();
    fixture.detectChanges();
    tick();

    getChooseColumnsAction().click();
    tick();
    fixture.detectChanges();

    let checkboxLabelEl =
      document.querySelector('.sky-modal .sky-list-view-checklist-item input') as HTMLElement;
    checkboxLabelEl.click();

    tick();
    fixture.detectChanges();

    let cancelButtonEl =
      document.querySelector('.sky-modal [sky-cmp-id="cancel"]') as HTMLButtonElement;

    cancelButtonEl.click();

    fixture.detectChanges();
    tick();

    component.grid.gridState.take(1).subscribe((gridState) => {
      expect(gridState.displayedColumns.items.length).toBe(3);
    });
    fixture.detectChanges();
    tick();

  }));

  it('should not appear if not in grid view', fakeAsync(() => {
    tick();
    fixture.detectChanges();
    tick();

    dispatcher.viewsSetActive('other');
    tick();
    fixture.detectChanges();
    tick();
    /* tslint:disable */
    let query =
      '.sky-list-toolbar-container .sky-toolbar-item .sky-list-secondary-actions .sky-dropdown .sky-dropdown-menu sky-list-secondary-action';
    /* tslint:enable */
    expect(nativeElement.querySelector(query)).toBeNull();
  }));
});
 it('should display updated title after detectChanges', () => {
   comp.title = 'Test Title';
   fixture.detectChanges(); // detect changes explicitly
   expect(h1.textContent).toContain(comp.title);
 });
    it('should compile', () => {
        fixture.detectChanges();

        expect(fixture).toMatchSnapshot();
    });
    beforeEach(inject([ScrollDispatcher], (s: ScrollDispatcher) => {
      scroll = s;

      fixture = TestBed.createComponent(NestedScrollingComponent);
      fixture.detectChanges();
    }));
  beforeEach(() => {
    viewContainerFixture = TestBed.createComponent(ChildViewContainerComponent);

    viewContainerFixture.detectChanges();
    testViewContainerRef = viewContainerFixture.componentInstance.childViewContainer;
  });
Example #17
0
 const getTableActionComponent = (): TableActionsComponent => {
   fixture.detectChanges();
   return fixture.debugElement.query(By.directive(TableActionsComponent)).componentInstance;
 };
describe('Test ng2-alfresco-viewer Text View component', () => {

    let component: TxtViewerComponent;
    let fixture: ComponentFixture<TxtViewerComponent>;
    let debug: DebugElement;
    let element: HTMLElement;

    beforeEach(async(() => {
        TestBed.configureTestingModule({
            imports: [
                CoreModule
            ],
            declarations: [TxtViewerComponent],
            providers: [
                AlfrescoSettingsService,
                AlfrescoAuthenticationService,
                AlfrescoApiService
            ]
        }).compileComponents();
    }));

    beforeEach(() => {
        fixture = TestBed.createComponent(TxtViewerComponent);

        debug = fixture.debugElement;
        element = fixture.nativeElement;
        component = fixture.componentInstance;
    });

    describe('View', () => {

        it('Should text container be present with urlfile', (done) => {
            fixture.detectChanges();
            let urlFile = require('../assets/fake-test-file.txt');
            let change = new SimpleChange(null, urlFile, true);

            component.ngOnChanges({ 'urlFile': change }).then(() => {
                fixture.detectChanges();
                fixture.whenStable().then(() => {
                    expect(element.querySelector('.adf-txt-viewer-content').textContent).toContain('example');
                    done();
                });
            });
        });

        it('Should text container be present with Blob file', (done) => {
            let blobFile = new Blob(['text example'], {type: 'text/txt'});

            let change = new SimpleChange(null, blobFile, true);

            component.ngOnChanges({ 'blobFile': change }).then(() => {
                fixture.detectChanges();
                fixture.whenStable().then(() => {
                    expect(element.querySelector('.adf-txt-viewer-content').textContent).toContain('example');
                    done();
                });
            });
        });

    });
});
Example #19
0
 beforeEach(() => {
   fixture.detectChanges();
   spyOn(rbdService, 'list').and.callThrough();
 });
Example #20
0
describe('SplitButton', () => {
  
    let splitbutton: SplitButton;
    let fixture: ComponentFixture<SplitButton>;
    
    beforeEach(() => {
      TestBed.configureTestingModule({
        imports: [
          NoopAnimationsModule,
          RouterTestingModule,
          ButtonModule
        ],
        declarations: [
          SplitButton,
        ],
      });
      
      fixture = TestBed.createComponent(SplitButton);
      splitbutton = fixture.componentInstance;
    });
    
    it('should open dropdown menu when click dropdown button and call onDropdownButtonClick', () => {
      const dropDownEl = fixture.debugElement.query(By.css('.ui-splitbutton-menubutton')).nativeElement;
      const dropdownClickSpy = spyOn(splitbutton, 'onDropdownButtonClick').and.callThrough();
      const showSpy = spyOn(splitbutton, 'show').and.callThrough();
      dropDownEl.click();
      fixture.detectChanges();

      const dropdownMenuEl=fixture.debugElement.query(By.css('.ui-menu-dynamic')).nativeElement;
      expect(splitbutton.dropdownClick).toEqual(true);
      expect(splitbutton.overlayVisible).toEqual(true);
      expect (dropdownClickSpy).toHaveBeenCalled();
      expect (showSpy).toHaveBeenCalled();
      expect(dropdownMenuEl).toBeTruthy();
    });

    it('should close dropdown menu when click dropdown button and call onDropdownButtonClick', () => {
      const dropDownEl = fixture.debugElement.query(By.css('.ui-splitbutton-menubutton')).nativeElement;
      const dropdownClickSpy = spyOn(splitbutton, 'onDropdownButtonClick').and.callThrough();
      const showSpy = spyOn(splitbutton, 'show').and.callThrough();
      dropDownEl.click();
      dropDownEl.click();
      fixture.detectChanges();

      const dropdownMenuEl=fixture.debugElement.query(By.css('.ui-menu-dynamic'));
      expect(splitbutton.dropdownClick).toEqual(true);
      expect(splitbutton.overlayVisible).toEqual(false);
      expect (dropdownClickSpy).toHaveBeenCalledTimes(2);
      expect (showSpy).toHaveBeenCalledTimes(2);
      expect(dropdownMenuEl).toBeFalsy();
    });

    it('should close dropdown menu when click dropdown menu item and call itemClick', () => {
      splitbutton.model = [{label: 'Update', icon: 'fa fa-refresh', command: () => {}}];
      const dropDownEl = fixture.debugElement.query(By.css('.ui-splitbutton-menubutton')).nativeElement;
      const itemClickSpy = spyOn(splitbutton, 'itemClick').and.callThrough();
      dropDownEl.click();
      fixture.detectChanges();

      const menuEl = fixture.debugElement.query(By.css('.ui-menuitem')).children[0].nativeElement;
      menuEl.click();
      fixture.detectChanges();

      const dropdownMenuEl = fixture.debugElement.query(By.css('.ui-menu-dynamic'));
      expect (itemClickSpy).toHaveBeenCalled();
      expect(splitbutton.overlayVisible).toEqual(false);
      expect(dropdownMenuEl).toBeFalsy();
    });

    it('should disabled and not called onDropdownButtonClick & show', () => {
      splitbutton.disabled = true;
      const dropdownClickSpy = spyOn(splitbutton, 'onDropdownButtonClick').and.callThrough();
      const showSpy = spyOn(splitbutton, 'show').and.callThrough();
      fixture.detectChanges();
      
      const defaultButtonEl=fixture.debugElement.query(By.css('button')).nativeElement;
      const dropdownEl=fixture.debugElement.query(By.css('.ui-splitbutton-menubutton')).nativeElement;
      const containerEl=fixture.debugElement.query(By.css('.ui-splitbutton')).nativeElement;
      defaultButtonEl.click();
      dropdownEl.click();
      fixture.detectChanges();

      expect(containerEl.className).toContain("ui-state-disabled");
      expect(dropdownEl.disabled).toBeTruthy();
      expect(defaultButtonEl.disabled).toBeTruthy();
      expect (dropdownClickSpy).not.toHaveBeenCalled();
      expect (showSpy).not.toHaveBeenCalled();
    });

    it('should add label and change icon and iconPosition', () => {
      splitbutton.label = "Primeng ROCKS!";
      splitbutton.icon = "Primeng ROCKS!";
      splitbutton.iconPos = "right";
      fixture.detectChanges();

      const defaultButton=fixture.debugElement.query(By.css('button'));
      expect(defaultButton.attributes["ng-reflect-icon"]).toEqual("Primeng ROCKS!");
      expect(defaultButton.attributes["ng-reflect-label"]).toEqual("Primeng ROCKS!");
      expect(defaultButton.attributes["ng-reflect-icon-pos"]).toEqual("right");
    });

    it('should change style and styleClass', () => {
      splitbutton.style = {'primeng':'rock'};
      splitbutton.styleClass = "Primeng ROCKS!";
      fixture.detectChanges();

      const containerEl=fixture.debugElement.query(By.css('.ui-splitbutton')).nativeElement;
      expect(containerEl.className).toContain("Primeng ROCKS!");
      expect(containerEl.style.primeng).toContain("rock");
    });

    it('should change menuStyle and stylemenuStyleClassClass', () => {
      splitbutton.menuStyle = {'primeng':'rock'};
      splitbutton.menuStyleClass="Primeng ROCKS!";
      fixture.detectChanges();

      const dropdownEl=fixture.debugElement.query(By.css('.ui-splitbutton-menubutton')).nativeElement;
      dropdownEl.click();
      fixture.detectChanges();

      const containerEl=fixture.debugElement.query(By.css('.ui-menu')).nativeElement;
      expect(containerEl.className).toContain("Primeng ROCKS!");
      expect(containerEl.style.primeng).toContain("rock");
    });

    it('should change directon of elements', () => {
      splitbutton.dir="ltr"
      fixture.detectChanges();

      const dropdownButton = fixture.debugElement.query(By.css('.ui-splitbutton-menubutton'));
      const defaultButton = fixture.debugElement.query(By.css('button'));
      expect(defaultButton.attributes["ng-reflect-corner-style-class"]).toEqual("ui-corner-left");
      expect(dropdownButton.attributes["ng-reflect-corner-style-class"]).toEqual("ui-corner-right");
    });

    it('should have a tabindex', () => {
      splitbutton.tabindex = 1
      fixture.detectChanges();

      const defaultButton=fixture.debugElement.query(By.css('button'));
      expect(defaultButton.nativeElement.tabIndex).toEqual(1);
    });

});
Example #21
0
 TestUtils.configurePageTestingModule([PinModalPage]).then(testEnv => {
   fixture = testEnv.fixture;
   instance = testEnv.instance;
   fixture.detectChanges();
 })));
 beforeEach(() => {
   fixture = TestBed.createComponent(PodsHeaderRendererComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(BoardPersistenceComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(ResourceUploaderComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(PhrasesSelectionComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
     fixture = TestBed.createComponent(DrawInfoComponent);
     component = fixture.componentInstance;
     component.draw = new Draw(DrawType.Piscine);
     fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(ManageCrisesComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
 beforeEach(() => {
   fixture = TestBed.createComponent(FlashcarddetailComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });
  beforeEach(() => {
    fixture = TestBed.createComponent(AppHomeComponent);
    comp    = fixture.componentInstance;

    fixture.detectChanges();
  });
 beforeEach(() => {
   fixture = TestBed.createComponent(PendingTransactionsComponent);
   component = fixture.componentInstance;
   fixture.detectChanges();
 });