Skip to content

Commit

Permalink
Added tests for modal modifier class.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrozav committed Jun 5, 2019
1 parent 6dd0abf commit c52869b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/unit/factories/PopupManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ describe('Factories', () => {
expect(popupManager.modalStack.length).toEqual(1);
expect(popupManager.modalStack[0].$el.style.zIndex).toEqual(1000);
});

it('should add ".-modal" modifier class to document body', () => {
popupManager.openModal('abc');

expect(window.document.body.classList.contains('-modal')).toEqual(true);
});
});

describe('closeModal()', () => {
Expand All @@ -167,6 +173,13 @@ describe('Factories', () => {

expect(popupManager.modalStack.length).toEqual(0);
});

it('should remove ".-modal" modifier class from document body', () => {
popupManager.openModal('abc');
popupManager.closeModal('abc');

expect(window.document.body.classList.contains('-modal')).toEqual(false);
});
});

describe('getTopPopup()', () => {
Expand Down

0 comments on commit c52869b

Please sign in to comment.