File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,10 @@ test('check categories', async () => {
50
50
expect ( category2 ) . toBeInTheDocument ( ) ;
51
51
} ) ;
52
52
53
- test ( 'if query is passed into window.location.search then it should be used to filter extensions' , async ( ) => {
53
+ test ( 'if per_page is passed into window.location.search then it should be used to filter extensions' , async ( ) => {
54
54
// Mock query to be last 1
55
55
vi . spyOn ( window , 'location' , 'get' ) . mockReturnValue ( {
56
- search : '?query =1' ,
56
+ search : '?per_page =1' ,
57
57
} as unknown as Location ) ;
58
58
59
59
const extensionsByCategories : ExtensionByCategoryInfo [ ] = [
@@ -108,10 +108,10 @@ test('if query is passed into window.location.search then it should be used to f
108
108
expect ( category2 ) . not . toBeInTheDocument ( ) ;
109
109
} ) ;
110
110
111
- test ( 'if query is passed in with 4, it should show last 4 extensions even if there is 5 in the list' , async ( ) => {
111
+ test ( 'if per_page is passed in with 4, it should show last 4 extensions even if there is 5 in the list' , async ( ) => {
112
112
// Mock query to be last 4
113
113
vi . spyOn ( window , 'location' , 'get' ) . mockReturnValue ( {
114
- search : '?query =4' ,
114
+ search : '?per_page =4' ,
115
115
} as unknown as Location ) ;
116
116
117
117
const extensionsByCategories : ExtensionByCategoryInfo [ ] = [
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ let { extensionsByCategories }: Props = $props();
12
12
let filteredExtensions = $state <CatalogExtensionInfo []>([]);
13
13
let showCategories = $state <boolean >(true );
14
14
15
- // Get the query from the URL
16
- function getQueryLimit (): number | undefined {
17
- const query = new URLSearchParams (window .location .search ).get (' query ' );
18
- return query ? parseInt (query , 10 ) : undefined ;
15
+ // Get the per_page from the URL
16
+ function getPerPageLimit (): number | undefined {
17
+ const perPage = new URLSearchParams (window .location .search ).get (' per_page ' );
18
+ return perPage ? parseInt (perPage , 10 ) : undefined ;
19
19
}
20
20
21
21
// Sort extensions based upon the last updated date based upon what's in .versions array
@@ -28,7 +28,7 @@ function getSortedExtensions(extensions: CatalogExtensionInfo[]): CatalogExtensi
28
28
}
29
29
30
30
$effect (() => {
31
- const limit = getQueryLimit ();
31
+ const limit = getPerPageLimit ();
32
32
showCategories = ! limit ;
33
33
34
34
if (limit ) {
@@ -47,7 +47,7 @@ $effect(() => {
47
47
<div
48
48
class =" mt-2 grid min-[920px]:grid-cols-2 min-[1180px]:grid-cols-3 gap-3"
49
49
role =" region"
50
- aria-label =" Queried extensions"
50
+ aria-label =" Filtered extensions"
51
51
>
52
52
{#each filteredExtensions as extension }
53
53
<ExtensionByCategoryCard {extension } />
You can’t perform that action at this time.
0 commit comments