diff --git a/app/javascript/listings/__tests__/AllListings.test.jsx b/app/javascript/listings/__tests__/AllListings.test.jsx index feee5c35b..dfa00e4c2 100644 --- a/app/javascript/listings/__tests__/AllListings.test.jsx +++ b/app/javascript/listings/__tests__/AllListings.test.jsx @@ -103,18 +103,13 @@ describe('', () => { }); it('should render the given listings', async () => { - const { getByTestId, getByText } = renderAllListings(); - - // Ensure each listing is present - const titleOptions = { - selector: 'h2 > a', - }; + const { getByTestId, getByText, getByRole } = renderAllListings(); // 1st listings getByTestId('single-listing-20'); // listing title - const listing1Title = getByText('Mentor wanted', titleOptions); + const listing1Title = getByRole('link', { name: 'Mentor wanted' }); expect(listing1Title.getAttribute('href')).toEqual( '/listings/misc/illo-iure-quos-htyashsayas-5hk7', @@ -149,7 +144,9 @@ describe('', () => { getByTestId('single-listing-21'); // listing title - const listing2Title = getByText('This is an awesome listing', titleOptions); + const listing2Title = getByRole('link', { + name: 'This is an awesome listing', + }); expect(listing2Title.getAttribute('href')).toEqual( '/listings/misc/illo-iure-quos-ereerr-5hk7', @@ -186,10 +183,9 @@ describe('', () => { getByTestId('single-listing-22'); // listing title - const listing3Title = getByText( - 'Illo iure quos perspiciatis', - titleOptions, - ); + const listing3Title = getByRole('link', { + name: 'Illo iure quos perspiciatis', + }); expect(listing3Title.getAttribute('href')).toEqual( '/listings/misc/illo-iure-fss-ssasas-5hk7', diff --git a/app/javascript/listings/components/AllListings.jsx b/app/javascript/listings/components/AllListings.jsx index c08e52bfa..b0b16068d 100644 --- a/app/javascript/listings/components/AllListings.jsx +++ b/app/javascript/listings/components/AllListings.jsx @@ -13,10 +13,11 @@ export const AllListings = ({ loadNextPage, }) => { return ( -
+
{listings.map((listing) => ( {showNextPageButton && } -
+ ); }; diff --git a/app/javascript/listings/components/ListingFilters.jsx b/app/javascript/listings/components/ListingFilters.jsx index 0bcdf208e..94c7fc139 100644 --- a/app/javascript/listings/components/ListingFilters.jsx +++ b/app/javascript/listings/components/ListingFilters.jsx @@ -16,7 +16,7 @@ export const ListingFilters = ({ query, }) => { return ( - + ); }; diff --git a/app/javascript/listings/components/ListingFiltersCategories.jsx b/app/javascript/listings/components/ListingFiltersCategories.jsx index 4fc83b53d..2e4308597 100644 --- a/app/javascript/listings/components/ListingFiltersCategories.jsx +++ b/app/javascript/listings/components/ListingFiltersCategories.jsx @@ -5,7 +5,7 @@ import { CategoryLinksMobile } from './CategoryLinksMobile'; export const ListingFiltersCategories = ({ categories, category, onClick }) => ( ); }; diff --git a/app/javascript/listings/singleListing/Header.jsx b/app/javascript/listings/singleListing/Header.jsx index 4a1af282d..d648b2eb7 100644 --- a/app/javascript/listings/singleListing/Header.jsx +++ b/app/javascript/listings/singleListing/Header.jsx @@ -18,7 +18,7 @@ export const Header = ({ listing, currentUserId, onTitleClick, onAddTag }) => { const listingDate = bumped_at ? bumped_at : originally_published_at; return ( -
+

{ -

+ ); }; diff --git a/app/views/listings/index.html.erb b/app/views/listings/index.html.erb index c37f269b6..2aafc1aa9 100644 --- a/app/views/listings/index.html.erb +++ b/app/views/listings/index.html.erb @@ -27,21 +27,26 @@ <% end %> -
-

Listings

+
-
- Create - Manage +
+

Listings

+ +
-
-
- data-displayedlisting="<%= @displayed_listing_json %> " - <% end %>> -
+
+ data-displayedlisting="<%= @displayed_listing_json %> " + <% end %>> +
+ <%= javascript_packs_with_chunks_tag "listings", defer: true %>