forked from ShelterTechSF/askdarcel-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OUR415-244] Adds styling to search result cards to distinguish Servi…
…ces from Organizations (#231)
- Loading branch information
1 parent
15f4ac9
commit 86e1e95
Showing
8 changed files
with
200 additions
and
64 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,138 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import LabelTagRows from "components/listing/LabelTagRows"; | ||
|
||
describe("<LabelTagRows />", () => { | ||
it("should show top level category labels if they exist", () => { | ||
const fake_category = { | ||
id: 4558736345530368, | ||
name: "Rene Lebsack", | ||
top_level: true, | ||
featured: true, | ||
}; | ||
|
||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows categories={[fake_category]} eligibilities={[]} /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect(screen.getByTestId("top-level-categories")).toHaveTextContent( | ||
fake_category.name | ||
); | ||
}); | ||
|
||
it("should not show top level category labels if they are empty", () => { | ||
const fake_category = { | ||
id: 4558736345530368, | ||
name: "Rene Lebsack", | ||
top_level: false, | ||
featured: true, | ||
}; | ||
|
||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows categories={[fake_category]} eligibilities={[]} /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect( | ||
screen.queryByTestId("top-level-categories") | ||
).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("should show subcategory labels if they exist", () => { | ||
const fake_category = { | ||
id: 4558736345530368, | ||
name: "Rene Lebsack", | ||
top_level: false, | ||
featured: true, | ||
}; | ||
|
||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows categories={[fake_category]} eligibilities={[]} /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect(screen.getByTestId("subcategories")).toHaveTextContent( | ||
fake_category.name | ||
); | ||
expect( | ||
screen.queryByTestId("top-level-categories") | ||
).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("should not show subcategory labels if they are empty", () => { | ||
const fake_category = { | ||
id: 4558736345530368, | ||
name: "Rene Lebsack", | ||
top_level: true, | ||
featured: true, | ||
}; | ||
|
||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows categories={[fake_category]} eligibilities={[]} /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect(screen.queryByTestId("subcategories")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("should show eligibility labels if they exist", () => { | ||
const fake_eligibility = { | ||
id: 3185842451382272, | ||
name: "Mr. Frank Larson DVM", | ||
feature_rank: null, | ||
}; | ||
|
||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows categories={[]} eligibilities={[fake_eligibility]} /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect(screen.getByTestId("eligibilities")).toHaveTextContent( | ||
fake_eligibility.name | ||
); | ||
}); | ||
|
||
it("should not show eligibility labels if they are empty", () => { | ||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows categories={[]} eligibilities={[]} /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect(screen.queryByTestId("eligibilities")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("should not show eligibility or category labels if they are not passed", () => { | ||
render( | ||
<table> | ||
<tbody> | ||
<LabelTagRows /> | ||
</tbody> | ||
</table> | ||
); | ||
|
||
expect(screen.queryByTestId("eligibilities")).not.toBeInTheDocument(); | ||
expect( | ||
screen.queryByTestId("top-level-categories") | ||
).not.toBeInTheDocument(); | ||
expect(screen.queryByTestId("subcategories")).not.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
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
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