diff --git a/src/ui/public/modals/__tests__/confirm_modal.js b/src/ui/public/modals/__tests__/confirm_modal.js index 7cc8904f157c5..f81234634e813 100644 --- a/src/ui/public/modals/__tests__/confirm_modal.js +++ b/src/ui/public/modals/__tests__/confirm_modal.js @@ -81,72 +81,27 @@ describe('ui/modals/confirm_modal', function () { }); }); - describe('x icon', function () { - it('is visible when showClose is true', function () { - const confirmModalOptions = { - confirmButtonText: 'bye', - onConfirm: _.noop, - showClose: true, - title: 'hi' - }; - confirmModal('hi', confirmModalOptions); - - $rootScope.$digest(); - const xIcon = findByDataTestSubj('confirmModalCloseButton'); - expect(xIcon.length).to.be(1); - }); - - it('is not visible when showClose is false', function () { - const confirmModalOptions = { - confirmButtonText: 'bye', - onConfirm: _.noop, - title: 'hi', - showClose: false - }; - confirmModal('hi', confirmModalOptions); - - $rootScope.$digest(); - const xIcon = findByDataTestSubj('confirmModalCloseButton'); - expect(xIcon.length).to.be(0); - }); - }); - describe('callbacks are called:', function () { const confirmCallback = sinon.spy(); - const closeCallback = sinon.spy(); const cancelCallback = sinon.spy(); const confirmModalOptions = { confirmButtonText: 'bye', onConfirm: confirmCallback, onCancel: cancelCallback, - onClose: closeCallback, - title: 'hi', - showClose: true + title: 'hi' }; beforeEach(() => { confirmCallback.reset(); - closeCallback.reset(); cancelCallback.reset(); }); - it('onClose', function () { - confirmModal('hi', confirmModalOptions); - $rootScope.$digest(); - findByDataTestSubj('confirmModalCloseButton').click(); - - expect(closeCallback.called).to.be(true); - expect(confirmCallback.called).to.be(false); - expect(cancelCallback.called).to.be(false); - }); - it('onCancel', function () { confirmModal('hi', confirmModalOptions); $rootScope.$digest(); findByDataTestSubj('confirmModalCancelButton').click(); - expect(closeCallback.called).to.be(false); expect(confirmCallback.called).to.be(false); expect(cancelCallback.called).to.be(true); }); @@ -156,29 +111,10 @@ describe('ui/modals/confirm_modal', function () { $rootScope.$digest(); findByDataTestSubj('confirmModalConfirmButton').click(); - expect(closeCallback.called).to.be(false); expect(confirmCallback.called).to.be(true); expect(cancelCallback.called).to.be(false); }); - - it('onClose defaults to onCancel if not specified', function () { - const confirmModalOptions = { - confirmButtonText: 'bye', - onConfirm: confirmCallback, - onCancel: cancelCallback, - title: 'hi', - showClose: true - }; - - confirmModal('hi', confirmModalOptions); - $rootScope.$digest(); - findByDataTestSubj('confirmModalCloseButton').click(); - - expect(confirmCallback.called).to.be(false); - expect(cancelCallback.called).to.be(true); - }); - it('onKeyDown detects ESC and calls onCancel', function () { const confirmModalOptions = { confirmButtonText: 'bye', diff --git a/src/ui/public/modals/confirm_modal.html b/src/ui/public/modals/confirm_modal.html index 34a4eaae99a05..41c95268cbfc5 100644 --- a/src/ui/public/modals/confirm_modal.html +++ b/src/ui/public/modals/confirm_modal.html @@ -3,12 +3,6 @@