From 8b87ff4e144922a74c5b5aeb644b84c5144d45c3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 28 Feb 2017 15:41:38 +0800 Subject: [PATCH] fix pop node height 100% close ant-design/ant-design#5092 --- src/Trigger.jsx | 1 + tests/index.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Trigger.jsx b/src/Trigger.jsx index decf9801..a9862031 100644 --- a/src/Trigger.jsx +++ b/src/Trigger.jsx @@ -74,6 +74,7 @@ const Trigger = React.createClass({ popupContainer.style.top = '0'; popupContainer.style.left = '0'; popupContainer.style.width = '100%'; + popupContainer.style.height = '100%'; const mountNode = props.getPopupContainer ? props.getPopupContainer(findDOMNode(instance)) : props.getDocument().body; mountNode.appendChild(popupContainer); diff --git a/tests/index.js b/tests/index.js index 1bcfc7b8..c4fbd241 100644 --- a/tests/index.js +++ b/tests/index.js @@ -654,5 +654,22 @@ describe('rc-trigger', function main() { // height should be same, should not have break lines inside words expect(popupNodeHeightOfOneWord).to.equal(popupNodeHeightOfSeveralWords); }); + + // https://github.com/ant-design/ant-design/issues/5092 + it.only('popup node height should be 100% as body', () => { + const trigger = ReactDOM.render( + i am a pop up} + popupStyle={{ height: '100%' }} + > +
trigger
+
+ , div); + + // height should be same, should not have break lines inside words + expect(trigger.getPopupDomNode().offsetHeight).to.above(0); + }); }); });