diff --git a/app/src/components/Theme.test.js b/app/src/components/Theme.test.js index 1c76ea88..8389e509 100644 --- a/app/src/components/Theme.test.js +++ b/app/src/components/Theme.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import {Progress} from './Theme'; +import {Button, Modal, Progress} from './Theme'; import {renderInDarkMode, renderInLightMode} from '../test-utils'; // All semantic-ui colors. @@ -10,6 +10,34 @@ const lightBarColors = ['yellow', 'olive', 'teal']; // Bar colors that need dark percent text only in dark mode (inverted makes bar lighter). const darkModeLightBarColors = ['grey', 'blue']; +describe('Button ref forwarding', () => { + // Regression: SButton is a class component, so forwarding a ref straight to it resolves to the class instance + // (no `.contains`). Semantic UI's Modal/Popup Portal calls `node.contains(...)` on the trigger's ref during + // handleDocumentClick, throwing "node.contains is not a function". The forwarded ref must be the DOM