Skip to content

Commit

Permalink
Update modal-backdrop.component.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
svetoldo4444ka committed Nov 27, 2018
1 parent 2a4acb8 commit 67f9840
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions src/spec/modal-backdrop.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { DebugElement } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ModalBackdropComponent } from '../modal';
import { window } from '../utils/facade/browser';
import { ComponentFixture, TestBed } from '@angular/core/testing';

describe('ModalBackdropComponent tests', () => {
let fixture: ComponentFixture<ModalBackdropComponent>;
Expand All @@ -14,51 +11,22 @@ describe('ModalBackdropComponent tests', () => {
});
fixture = TestBed.createComponent(ModalBackdropComponent);
component = fixture.componentInstance;
component.isAnimated = true;
fixture.detectChanges();
});

it('should get and set isAnimated correctly', () => {
component.isAnimated = false;
expect(component.isAnimated).toBeFalsy();
component.isAnimated = true;
expect(component.isAnimated).toBeTruthy();
});

it('should get and set isShown correctly', () => {
component.isShown = false;
expect(component.isShown).toBeFalsy();
component.isShown = true;
expect(component.isShown).toBeTruthy();
});

it('isShown() tests, when bs4', () => {
const tempVal = window.__theme;
window.__theme = 'bs4';
component.isShown = true;
fixture.detectChanges();
let modalClass = component.element.nativeElement.classList.contains('show');
expect(modalClass).toBeTruthy();

component.isShown = false;
fixture.detectChanges();
modalClass = component.element.nativeElement.classList.contains('show');
expect(modalClass).toBeFalsy();
window.__theme = tempVal;
});

it('isShown() tests, when bs3', () => {
const tempVal = window.__theme;
window.__theme = 'bs3';
it('isShown() tests', () => {
component.isShown = true;
fixture.detectChanges();
let modalClass = component.element.nativeElement.classList.contains('in');
expect(modalClass).toBeTruthy();

component.isShown = false;
fixture.detectChanges();
modalClass = component.element.nativeElement.classList.contains('in');
expect(modalClass).toBeFalsy();
window.__theme = tempVal;
});
});

0 comments on commit 67f9840

Please sign in to comment.