Posts

Showing posts from August, 2019

Unit Test: React-Bootstrap Modal

Writing unit test always help in longer run. Now a days almost all frameworks and libraries are supporting unit testing. In React Bootstrap, there is documentation for using the unit test cases but still writing unit test cases for React-Bootstrap Modal can get confusing. After spending hours on it finally I am able to write test cases for it. These code snippets can be used for other React-Bootstrap components as well (by changing the corresponding names). Modal Source code: import React from 'react'; import Container from 'react-bootstrap/Container'; import './uv-modal.css'; function UVModal(props) { return ( <Modal {...props} aria-labelledby="contained-modal-title-vcenter"> <Modal.Header closeButton> <Modal.Title id="contained-modal-title-vcenter"> Modal Title </Modal.Title> </Modal.Header> <Modal.Body> <Containe...