@@ -8,14 +8,19 @@ import { dirname, join } from "../../../src/deno_ral/path.ts";
88import { testQuartoCmd , Verify } from "../../test.ts" ;
99
1010import { docs } from "../../utils.ts" ;
11- import { ensureHtmlElements , fileExists } from "../../verify.ts" ;
11+ import { ensureFileRegexMatches , ensureHtmlElements , fileExists } from "../../verify.ts" ;
1212
1313const input = docs ( "listings/index.qmd" ) ;
1414const outputDir = join ( docs ( "listings" ) , "_site" ) ;
1515const htmlOutput = join (
1616 outputDir ,
1717 "index.html" ,
1818) ;
19+ const paginationHtmlOutput = join (
20+ outputDir ,
21+ "pagination" ,
22+ "index.html" ,
23+ ) ;
1924
2025const verify : Verify [ ] = [ ] ;
2126verify . push ( fileExists ( htmlOutput ) ) ;
@@ -36,6 +41,27 @@ verify.push(ensureHtmlElements(htmlOutput, [
3641 'div#listing-other-reports .quarto-post div.thumbnail img[src$="2\.png"]' ,
3742] ) ) ;
3843
44+ // Pagination tests
45+ verify . push ( fileExists ( paginationHtmlOutput ) ) ;
46+ verify . push ( ensureHtmlElements ( paginationHtmlOutput , [
47+ // 1. Testing listing type for each pagination listing
48+ "div#listing-default-pagination table.quarto-listing-table" ,
49+ "div#listing-custom-pagination .quarto-grid-item" ,
50+ "div#listing-zero-inner-window .quarto-listing-default" ,
51+ // 2. Testing pagination nav elements exist
52+ "nav#default-pagination-pagination.listing-pagination" ,
53+ "nav#custom-pagination-pagination.listing-pagination" ,
54+ "nav#zero-inner-window-pagination.listing-pagination" ,
55+ ] ) ) ;
56+ verify . push ( ensureFileRegexMatches ( paginationHtmlOutput , [
57+ // Default pagination uses innerWindow: 2 (default value)
58+ / p a g i n a t i o n : \s * \{ [ ^ } ] * i n n e r W i n d o w : \s * 2 / ,
59+ // Custom pagination uses innerWindow: 1 and outerWindow: 1
60+ / p a g i n a t i o n : \s * \{ [ ^ } ] * i n n e r W i n d o w : \s * 1 [ ^ } ] * o u t e r W i n d o w : \s * 1 / ,
61+ // Zero inner-window regression test: innerWindow: 0 must be output
62+ / p a g i n a t i o n : \s * \{ [ ^ } ] * i n n e r W i n d o w : \s * 0 / ,
63+ ] ) ) ;
64+
3965testQuartoCmd (
4066 "render" ,
4167 [
0 commit comments