Skip to content

Commit

Permalink
fix(Modal): remove default timeout in modal and backdrop transition (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sebammon authored and kyletsang committed Jun 3, 2021
1 parent 785504b commit 3824fa3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ const defaultProps = {

/* eslint-disable no-use-before-define, react/no-multi-comp */
function DialogTransition(props) {
return <Fade {...props} />;
return <Fade {...props} timeout={null} />;
}

function BackdropTransition(props) {
return <Fade {...props} />;
return <Fade {...props} timeout={null} />;
}

/* eslint-enable no-use-before-define */
Expand Down
22 changes: 22 additions & 0 deletions test/ModalSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,28 @@ describe('<Modal>', () => {
);
});

it('should call `transitionend` before `exited`', (done) => {
const increment = sinon.spy();
let modal;

const instance = mount(
<Modal
show
style={{ transition: 'opacity 1s linear' }}
onExited={() => {
expect(increment.callCount).to.equal(1);
modal.removeEventListener('transitionend', increment);
done();
}}
>
<strong>Message</strong>
</Modal>,
);
modal = instance.find('.modal').getDOMNode();
modal.addEventListener('transitionend', increment);
instance.setProps({ show: false });
});

describe('cleanup', () => {
let offSpy;

Expand Down

0 comments on commit 3824fa3

Please sign in to comment.