Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ footer p a {
color: blue;
}

.carousel-caption h3, h5 {
.carousel-caption .coffee-carousel-label {
background-color:yellow;
width: 50%;
height: auto;
margin: 0 auto;
border-radius: 12px;
}

.carousel-item img {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/CoffeeCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class CoffeeCarousel extends Component {
<Carousel.Item key={index}>
<img src={item.image} alt={item.title} />
<Carousel.Caption>
<h3>{item.title}</h3>
<h3 className="coffee-carousel-label">{item.title}</h3>
{item.ingredients && item.ingredients.length > 0 && (
<h5>
<h5 className="coffee-carousel-label">
<b>Ingredients:</b>{' '}
{Array.isArray(item.ingredients)
? item.ingredients.join(', ')
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/components/__tests__/CoffeCarousel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,14 @@ describe('CoffeeCarousel', () => {
// Ensure ingredients are NOT rendered
expect(screen.queryByText('Ingredients:')).not.toBeInTheDocument();
});

test('applies carousel label styling class to title and ingredients headings', () => {
render(<CoffeeCarousel items={coffeeItems} />);

const titleHeading = screen.getByRole('heading', { level: 3, name: 'Espresso' });
const ingredientHeading = screen.getAllByRole('heading', { level: 5 })[0];

expect(titleHeading).toHaveClass('coffee-carousel-label');
expect(ingredientHeading).toHaveClass('coffee-carousel-label');
});
});
Loading