This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Header = () => { | |
return ( | |
<nav className="navbar-wrapper"> | |
<Breakpoint medium up> | |
<ul className="navbar-links"> | |
<li className="navbar-link-logo"> | |
<NavLink to="/"> | |
<img src={TmdbIcon} alt="logo" /> | |
</NavLink> | |
</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext } from 'react'; | |
const CheckoutDrawerContext = createContext({ | |
showDrawer: false, | |
toggleCheckoutDrawer: () => {}, | |
}); | |
export default CheckoutDrawerContext; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<CheckoutDrawerContext.Provider value={{ showDrawer, toggleCheckoutDrawer }}> | |
<section className="cart-checkout"> | |
<CartDrawer selectedCartItems={selectedCartItems} /> | |
</section> | |
</CheckoutDrawerContext.Provider> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [showDrawer, setShowDrawer] = useState(false); | |
const toggleCheckoutDrawer = () => { | |
setShowDrawer(!showDrawer); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from 'react'; | |
import { orderItems } from '../../../../services/orderService'; | |
import CheckoutDrawerContext from '../../../../context/CheckoutDrawerContext'; | |
export const CheckoutSummaryDetails = props => { | |
const { summaryDetails, userInfo, items } = props; | |
const checkoutDrawer = useContext(CheckoutDrawerContext); | |
const placeOrder = async () => { | |
const executionResponse = await orderItems(userInfo, items); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { screen } from '@testing-library/dom'; | |
import { render } from '@testing-library/react'; | |
import { act } from 'react-dom/test-utils'; | |
import App from './App'; | |
describe('Product Browser App', () => { | |
it('renders a welcome message', () => { | |
act(() => { | |
render(<App />); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const orderButton = await waitForElement(() => container.getByTestId('order-submit-button')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const orderButton = await container.findByTestId('order-submit-button'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await fireEvent.click(orderButton); |