diff --git a/src/web/components/form/__tests__/__snapshots__/selectelement.js.snap b/src/web/components/form/__tests__/__snapshots__/selectelement.js.snap index 3432c81098..0a3b4ad880 100644 --- a/src/web/components/form/__tests__/__snapshots__/selectelement.js.snap +++ b/src/web/components/form/__tests__/__snapshots__/selectelement.js.snap @@ -216,6 +216,76 @@ exports[`Menu tests should render 1`] = ` /> `; +exports[`Menu tests should render with open direction downwards 1`] = ` +.c0 { + outline: 0; + border-radius: 0 0 4px 4px; + -webkit-transition: opacity 0.1s ease; + transition: opacity 0.1s ease; + box-shadow: 0 2px 3px 0 rgba(34, 36, 38, 0.15); + border: 1px solid #bfbfbf; + background-color: #fff; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + position: absolute; + z-index: 600; + margin-top: -1px; + box-sizing: border-box; + top: 120px; + left: 50px; + white-space: nowrap; +} + +
+`; + +exports[`Menu tests should render with open direction upwards 1`] = ` +.c0 { + outline: 0; + border-radius: 0 0 4px 4px; + -webkit-transition: opacity 0.1s ease; + transition: opacity 0.1s ease; + box-shadow: 0 2px 3px 0 rgba(34, 36, 38, 0.15); + border: 1px solid #bfbfbf; + background-color: #fff; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + position: absolute; + z-index: 600; + margin-top: -1px; + box-sizing: border-box; + top: 25px; + left: 50px; + white-space: nowrap; +} + + +`; + exports[`Menu tests should render with position adjust 1`] = ` .c0 { outline: 0; diff --git a/src/web/components/form/__tests__/selectelement.js b/src/web/components/form/__tests__/selectelement.js index ae93751b5b..0b4471dc3e 100644 --- a/src/web/components/form/__tests__/selectelement.js +++ b/src/web/components/form/__tests__/selectelement.js @@ -209,6 +209,7 @@ class MenuTestComponent extends React.Component { this.target = React.createRef(); this.mockBoundingClientRect = this.props.mockBoundingClientRect; + this.notifyRefAssigned = jest.fn(); } render() { @@ -235,7 +236,13 @@ class MenuTestComponent extends React.Component { className={this.mockBoundingClientRect ? 'multiselect-scroll' : ''} style={{width: '200px', height: '100px'}} /> - {hasTarget && } + {hasTarget && ( + + )} ); } @@ -246,6 +253,7 @@ MenuTestComponent.propTypes = { }; describe('Menu tests', () => { + window.innerHeight = 180; const renderTest = props => { const {rerender, ...other} = render(