/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import { PageContentComponent } from './page-content.component';

describe('PageContentComponent', () => {
  let component: PageContentComponent;
  let fixture: ComponentFixture<PageContentComponent>;
  let nativeEl: Element;

  beforeEach(
    waitForAsync(() => {
      TestBed.configureTestingModule({
        declarations: [PageContentComponent],
      }).compileComponents();
    })
  );

  beforeEach(() => {
    fixture = TestBed.createComponent(PageContentComponent);
    component = fixture.componentInstance;
    nativeEl = fixture.debugElement.nativeElement;
  });

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

  it('should by default have classes full-space and padding, 32px padding and display:block', () => {
    fixture.detectChanges();
    expect(nativeEl.className).toContain('full-space');
    expect(nativeEl.className).toContain('padding');
    // FIXME: getComputedStyle not possible in jest
    // expect(window.getComputedStyle(nativeEl).padding).toBe('32px');
    // expect(window.getComputedStyle(nativeEl).flex).toBe('0 0 auto');
    // expect(window.getComputedStyle(nativeEl).display).toBe('block');
  });

  it('should have no padding with padding=false', () => {
    component.padding = false;
    fixture.detectChanges();
    expect(nativeEl.className).not.toContain('padding');
    // FIXME: getComputedStyle not possible in jest
    // expect(window.getComputedStyle(nativeEl).padding).toBe('0px');
  });

  it('should have width and height set to 100% with fullSpace', () => {
    component.fullSpace = false;
    fixture.detectChanges();
    expect(nativeEl.className).not.toContain('full-space');
  });
});
