-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
184 additions
and
93 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- add_ci_and_linting | ||
pull_request: | ||
types: [opened, reopened] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
black: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
pip install black | ||
- name: Run Black | ||
run: | | ||
black --check . | ||
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import "@testing-library/jest-dom"; | ||
import Heading from "../heading"; | ||
import { ChakraProvider } from "@chakra-ui/react"; | ||
|
||
describe("Heading component", () => { | ||
const renderComponent = () => | ||
render( | ||
<ChakraProvider> | ||
<Heading /> | ||
</ChakraProvider> | ||
); | ||
|
||
test("renders the heading with the correct text", () => { | ||
renderComponent(); | ||
const firstPart = screen.getByText(/Learn about/i); | ||
const secondPart = screen.getByText(/your home’s earthquake readiness\./i); | ||
expect(firstPart).toBeInTheDocument(); | ||
expect(secondPart).toBeInTheDocument(); | ||
}); | ||
|
||
test("highlights the correct text with yellow color", () => { | ||
renderComponent(); | ||
const highlightedText = screen.getByText(/Learn about/i); | ||
expect(highlightedText).toHaveStyle({ color: "yellow" }); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import "@testing-library/jest-dom"; | ||
import SearchBar from "../search-bar"; | ||
import { ChakraProvider } from "@chakra-ui/react"; | ||
|
||
describe("SearchBar component", () => { | ||
const renderComponent = () => | ||
render( | ||
<ChakraProvider> | ||
<SearchBar /> | ||
</ChakraProvider> | ||
); | ||
|
||
test("renders search icon with correct color", () => { | ||
renderComponent(); | ||
const icon = screen.getByTestId("search-icon"); | ||
expect(icon).toHaveStyle({ color: "#2C5282" }); | ||
}); | ||
|
||
test("renders the input field with the correct placeholder", () => { | ||
renderComponent(); | ||
const inputElement = screen.getByPlaceholderText( | ||
"Search San Francisco address" | ||
); | ||
expect(inputElement).toBeInTheDocument(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Highlight, Text } from "@chakra-ui/react"; | ||
|
||
const Heading = () => { | ||
return ( | ||
<Text | ||
textStyle="headerBig" | ||
mb="43px" | ||
maxW={{ base: "332px", md: "457px", xl: "546px" }} | ||
> | ||
<Highlight query="Learn about" styles={{ color: "yellow" }}> | ||
Learn about your home’s earthquake readiness. | ||
</Highlight> | ||
</Text> | ||
); | ||
}; | ||
|
||
export default Heading; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Input, InputGroup, InputLeftElement } from "@chakra-ui/react"; | ||
import { IoSearchSharp } from "react-icons/io5"; | ||
|
||
const SearchBar = () => { | ||
return ( | ||
<InputGroup | ||
maxW={{ base: "303px", sm: "303px", md: "371px", lg: "417px" }} | ||
size={{ base: "md", md: "lg", xl: "lg" }} | ||
data-testid="search-bar" | ||
> | ||
<InputLeftElement> | ||
<IoSearchSharp | ||
color="#2C5282" | ||
fontSize="1.1em" | ||
data-testid="search-icon" | ||
/> | ||
</InputLeftElement> | ||
<Input | ||
placeholder="Search San Francisco address" | ||
p="0 10px 0 48px" | ||
borderRadius="50" | ||
bgColor="white" | ||
focusBorderColor="yellow" | ||
/> | ||
</InputGroup> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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