Last active
August 17, 2023 04:51
-
-
Save felipe-b-oliveira/36541b36cf7b0aed905ae2e24b4a2766 to your computer and use it in GitHub Desktop.
error/react-testing-library-toHaveStyle-rgb-hex
This file contains 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 * as Styles from "./styles"; | |
const App = () => ( | |
<Styles.Wrapper> | |
<Styles.Title>Hello CodeSandbox</Styles.Title> | |
</Styles.Wrapper> | |
); | |
export default App; |
This file contains 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 { render, screen } from "@testing-library/react"; | |
import "@testing-library/jest-dom/extend-expect"; | |
import App from "./App"; | |
it("should work", () => { | |
render(<App />); | |
expect(screen.getByText("Hello CodeSandbox")).toHaveStyle({ | |
color: "#06092b" | |
}); | |
}); |
This file contains 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 { StrictMode } from "react"; | |
import { createRoot } from "react-dom/client"; | |
import App from "./App"; | |
const rootElement = document.getElementById("root"); | |
const root = createRoot(rootElement); | |
root.render( | |
<StrictMode> | |
<App /> | |
</StrictMode> | |
); |
This file contains 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
{ | |
"name": "rtl-tohavestyle-error", | |
"version": "1.0.0", | |
"description": "", | |
"keywords": [], | |
"main": "src/index.js", | |
"dependencies": { | |
"@babel/runtime": "7.21.0", | |
"@testing-library/jest-dom": "5.16.5", | |
"@testing-library/react": "14.0.0", | |
"loader-utils": "3.2.1", | |
"react": "18.2.0", | |
"react-dom": "18.2.0", | |
"react-scripts": "5.0.1", | |
"styled-components": "5.3.9", | |
"testing-library": "0.0.2" | |
}, | |
"devDependencies": { | |
"@babel/runtime": "7.13.8", | |
"typescript": "4.1.3" | |
}, | |
"scripts": { | |
"start": "react-scripts start", | |
"build": "react-scripts build", | |
"test": "react-scripts test --env=jsdom", | |
"eject": "react-scripts eject" | |
}, | |
"browserslist": [ | |
">0.2%", | |
"not dead", | |
"not ie <= 11", | |
"not op_mini all" | |
] | |
} |
This file contains 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 styled from "styled-components"; | |
export const Wrapper = styled.div` | |
font-family: sans-serif; | |
text-align: center; | |
`; | |
export const Title = styled.h1` | |
color: "#06092b"; | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment