Example #1
0
 it("exists", () => {
   expect(element.query(By.css("section.community"))).not.toBeNull();
 });
function getRemoveCommunicationButton(fixture: ComponentFixture<GroupCardComponent>): DebugElement {
    return fixture.debugElement.query(By.css(locators.removeCommunicationButton));
}
 .then((fixture: ComponentFixture<any>) => {
   let query = fixture.debugElement.query(By.directive(HelloComponent));
   expect(query).toBeTruthy();
   expect(query.componentInstance).toBeTruthy();
 });
  it(': should contain content', () => {
    el = fixture.debugElement.query(By.css('#software--content'));

    expect(el).not.toBe(undefined);
    expect(el).not.toBe(null);
  });
  it(': should contain footer-component', () => {
    el = fixture.debugElement.query(By.css('#footer-component'));

    expect(el).not.toBe(undefined);
    expect(el).not.toBe(null);
  });
 it('should render today', () => {
   expect(componentEl.query(By.css('.sub-title')).nativeElement.textContent).toContain('Today');
 });
 it('should fire navigateToday when click on title', () => {
   component.navigateToday.subscribe(e => expect(e).toBeUndefined());
   componentEl.query(By.css('span.title')).nativeElement.dispatchEvent(new Event('click'));
 });
 .then((fixture: ComponentFixture<any>) => {
   let query: DebugElement = fixture.debugElement.query(By.directive(AngularMaterialComponent));
   expect(query).toBeTruthy();
   expect(query.componentInstance).toBeTruthy();
 });
Example #9
0
 beforeEach(() => {
   fixture = TestBed.createComponent(NzTestFormTextComponent);
   fixture.detectChanges();
   testComponent = fixture.debugElement.componentInstance;
   text = fixture.debugElement.query(By.directive(NzFormTextComponent));
 });
 it('should not have an .dl-abdtp-up-button', () => {
   const upButton = fixture.debugElement.query(By.css('.dl-abdtp-up-button'));
   expect(upButton).toBeFalsy();
 });
 it('should start with day-view', () => {
   const dayView = fixture.debugElement.query(By.css('.dl-abdtp-day-view'));
   expect(dayView).toBeTruthy();
 });
 it('should start with minute-view', () => {
   const minuteView = fixture.debugElement.query(By.css('.dl-abdtp-minute-view'));
   expect(minuteView).toBeTruthy();
 });
 it('should not have an .dl-abdtp-up-button', () => {
   fixture.debugElement.query(By.css('.dl-abdtp-up-button')).nativeElement.click();  // go to month-view
   fixture.detectChanges();
   const upButton = fixture.debugElement.query(By.css('.dl-abdtp-up-button'));
   expect(upButton).toBeFalsy();
 });
Example #14
0
 beforeEach(() => {
   button = element.query(By.css("section.community a.button")).nativeElement;
 });
 const getSelectOptions = () =>
   fixture.debugElement.queryAll(By.css('mat-option'));
 beforeEach(() => {
   directive = fixture.debugElement
     .query(By.css('#t1'))
     .injector.get(DataTableColumnDirective);
 });
import {Component} from '@angular/core';
import {By} from '@angular/platform-browser';

const a = By.css('mat-form-field');

@Component({
  template: `
    <mat-form-field>
      <input matInput placeholder="Test">
    </mat-form-field>

    <style>
      mat-form-field {
        border: red 1px solid;
      }
    </style>
  `
})
class B {}

@Component({
  styles: [`
    mat-form-field {
      flex-direction: row;
    }
    :host > mat-form-field {
      text-align: right;
    }
  `]
})
class C {}
 it('should set a placeholder message when processInstanceId changed to null', () => {
     component.ngOnChanges({ 'processInstanceId': nullChange });
     fixture.detectChanges();
     expect(fixture.debugElement.query(By.css('[data-automation-id="comments-none"]'))).not.toBeNull();
 });
 it('should render today date', () => {
   component.date = new Date(2018, 6, 30);
   fixture.detectChanges();
   expect(componentEl.query(By.css('.title')).nativeElement.textContent).toContain('Jul 30, 2018');
 });
 it('should display a dialog to the user when the Add button clicked', () => {
     let dialogEl = fixture.debugElement.query(By.css('.mdl-dialog')).nativeElement;
     let showSpy: jasmine.Spy = spyOn(dialogEl, 'showModal');
     component.showDialog();
     expect(showSpy).toHaveBeenCalled();
 });
  it(': display correct title', () => {
    el = fixture.debugElement.query(By.css('#software--title'));
    const text = el.nativeElement.innerText;

    expect(text).toEqual('Software');
  });
 fixture.whenStable().then(() => {
     fixture.detectChanges();
     expect(fixture.debugElement.queryAll(By.css('ul.mdl-list li')).length).toBe(3);
 });
  it(': display correct content', () => {
    el = fixture.debugElement.query(By.css('#software--content'));
    const text = el.nativeElement.innerText;

    expect(text).toEqual('This page is currently under construction.');
  });
 it("render a noosfero activity tag for each activity", () => {
     fixture.detectChanges();
     expect(fixture.debugElement.queryAll(By.css('noosfero-activity')).length).toEqual(2);
 });
function getInternalCommunicationSwitch(fixture: ComponentFixture<GroupCardComponent>): DebugElement {
    return fixture.debugElement.query(By.css(locators.internalCommunicationSwitch));
}
 it('apps view should contain all palette cards', async(() => {
   let cards:DebugElement[] = debugElement.queryAll(By.css(".card"));
   expect(cards.length).toBe(13);
 }));
function getTitle(fixture: ComponentFixture<GroupCardComponent>): DebugElement {
    return fixture.debugElement.query(By.css(locators.title));
}
 const getThemeSelectArrow = () =>
   fixture.debugElement.queryAll(By.css('.mat-select-trigger'))[1];
    beforeEach(() => {
        const messageServiceMock = new MockDotMessageService({
            'global-search': 'Global Serach'
        });

        DOTTestBed.configureTestingModule({
            declarations: [
                ActionHeaderComponent,
                DotActionButtonComponent,
                ListingDataTableComponent,
                ActionMenuButtonComponent
            ],
            imports: [
                TableModule,
                SharedModule,
                RouterTestingModule.withRoutes([
                    { path: 'test', component: ListingDataTableComponent }
                ]),
                DotIconButtonTooltipModule,
                MenuModule,
                DotMenuModule,
                DotIconModule,
                DotIconButtonModule
            ],
            providers: [
                { provide: DotMessageService, useValue: messageServiceMock },
                CrudService,
                FormatDateService,
                PaginatorService,
                DotAlertConfirmService
            ]
        });

        fixture = DOTTestBed.createComponent(ListingDataTableComponent);
        comp = fixture.componentInstance;
        de = fixture.debugElement.query(By.css('p-table'));
        el = de.nativeElement;

        this.items = [
            {
                field1: 'item1-value1',
                field2: 'item1-value2',
                field3: 'item1-value3',
                field4: 'item1-value4'
            },
            {
                field1: 'item2-value1',
                field2: 'item2-value2',
                field3: 'item2-value3',
                field4: 'item1-value4'
            },
            {
                field1: 'item3-value1',
                field2: 'item3-value2',
                field3: 'item3-value3',
                field4: 'item1-value4'
            },
            {
                field1: 'item4-value1',
                field2: 'item4-value2',
                field3: 'item4-value3',
                field4: 'item1-value4'
            },
            {
                field1: 'item5-value1',
                field2: 'item5-value2',
                field3: 'item5-value3',
                field4: 'item1-value4'
            },
            {
                field1: 'item6-value1',
                field2: 'item6-value2',
                field3: 'item6-value3',
                field4: 'item1-value4'
            },
            {
                field1: 'item7-value1',
                field2: 'item7-value2',
                field3: 'item7-value3',
                field4: 'item1-value4'
            }
        ];

        this.paginatorService = fixture.debugElement.injector.get(PaginatorService);
        this.paginatorService.paginationPerPage = 4;
        this.paginatorService.maxLinksPage = 2;
        this.paginatorService.totalRecords = this.items.length;

        this.columns = [
            { fieldName: 'field1', header: 'Field 1', width: '45%' },
            { fieldName: 'field2', header: 'Field 2', width: '10%' },
            { fieldName: 'field3', header: 'Field 3', width: '30%' },
            { fieldName: 'field4', header: 'Field 4', width: '5%' }
        ];

        this.url = '/test/';
        comp.actions = [
            {
                menuItem: {
                    icon: 'fa fa-trash',
                    label: 'Remove',
                    command: () => {}
                }
            }
        ];
    });
Example #30
0
 it("exists", () => {
   expect(element.query(By.css("section.scaffolding"))).not.toBeNull();
 });