diff --git a/packages/material-ui/src/ButtonBase/TouchRipple.test.js b/packages/material-ui/src/ButtonBase/TouchRipple.test.js
index 64b9ada9ce3662..9b66633f70f0e2 100644
--- a/packages/material-ui/src/ButtonBase/TouchRipple.test.js
+++ b/packages/material-ui/src/ButtonBase/TouchRipple.test.js
@@ -18,7 +18,7 @@ describe('', () => {
*/
function renderTouchRipple(other) {
const touchRippleRef = React.createRef();
- const { container } = render(
+ const { container, unmount } = render(
', () => {
queryRipple() {
return container.querySelector('.ripple');
},
+ unmount,
};
}
@@ -155,6 +156,9 @@ describe('', () => {
});
describe('mobile', () => {
+ /**
+ * @type {ReturnType}
+ */
let clock;
before(() => {
@@ -227,5 +231,17 @@ describe('', () => {
expect(queryAllActiveRipples()).to.have.lengthOf(0);
expect(queryAllStoppingRipples()).to.have.lengthOf(0);
});
+
+ it('should not leak on multi-touch', function multiTouchTest() {
+ const { instance, unmount } = renderTouchRipple();
+
+ instance.start({ type: 'touchstart', touches: [{}] }, () => {});
+ instance.start({ type: 'touchstart', touches: [{}] }, () => {});
+ unmount();
+
+ // expect this to run gracefully without
+ // "react state update on an unmounted component"
+ clock.runAll();
+ });
});
});