rendering empty div
See original GitHub issueHello @DimitryDushkin ,
I am trying to unit test my notification bar and during the test, SlidingPane is rendering an empty div. I have tried everything I could. Maybe a third eye could help me find out the issue. Please let me know if you have any suggestions for me. Thanks in advance !!
My Component
<div ref={(ref) => (this.el = ref)}>
<SlidingPane
className="notification"
overlayClassName="notification__overlay"
isOpen={this.props.showNotificationPanel}
from="right"
onRequestClose={() => {
this.props.showNotification(false);
}}>
//some code
</SlidingPane>
</div>
My Test
it('renders', () => {
wrapper = mountWithIntl(<ShowNotification {...minProps} showNotificationPanel={true} />, 'en');
console.log("wrapper", wrapper.html()); // outputs <div><!-- react-empty: 2 --></div>
expect(
wrapper.children().hasClass('notification')
).to.equal(true);
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Is it possible to render empty <div style="width:50%"> </div ...
I'd personally go for <div style="min-height:1px;width:50%"></div>. That way any non empty divs will not get unwanted padding as in the other answer.
Read more >How to make an empty div take space ? - GeeksforGeeks
In this article, we will learn how to make an empty div take space using CSS. Approach: The solution is to give some...
Read more >Don't Fear Empty Divs - Cory Etzkorn
An empty div with a height of 60px surrounded by two divs containing real content. Rendered, it looks like this: Two divs 60px...
Read more >Render returns empty div as container when passed a portal ...
render method, if not passed a container, returns container by creating a div element in the body. It works fine for all the...
Read more >empty - CSS: Cascading Style Sheets - MDN Web Docs
The :empty CSS pseudo-class represents any element that has no children. Children can be either element nodes or text (including whitespace) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks everyone for your input. There were some solutions in the past using node.portal but its deprecated now. I was able to make it work for now using the following code but I don’t think its the best approach so I will keep looking for a better approach and will post it here if I find something. Meanwhile you can use this code to test your component.
My Component
My Test
I will think how to make it testable