import commonModule from '../..';

describe('wsModalService', () => {
  let service;

  beforeEach(angular.mock.module(commonModule));
  beforeEach(angular.mock.inject(['wsModalService', (_service_) => {
    service = _service_;
  }]));

  function openModal() {
    service.open({
      bodyString: 'Hello',
      actionString: 'Confirm',
      actionInProgressString: 'Confirming...',
      checkboxString: 'Check this box',
      dismissString: 'Cancel',
    });
  }

  describe('.open', () => {
    it('should render the modal in the DOM', () => {
      /* eslint-disable angular/document-service */
      expect(document.querySelector('.ws-modal')).toBeFalsy();
      openModal();
      expect(document.querySelector('.ws-modal')).toBeTruthy();
      /* eslint-enable angular/document-service */
    });
  });
});
