Add link to next file in the export (#10190)
Co-authored-by: grimhilt <grimhilt@users.noreply.github.com>
This commit is contained in:
parent
168f6df7c8
commit
fbeddba782
3 changed files with 94 additions and 17 deletions
|
@ -315,4 +315,45 @@ describe("HTMLExport", () => {
|
|||
expect(fileName).not.toMatch(/^files\/hello/);
|
||||
}
|
||||
});
|
||||
|
||||
it("should add link to next and previous file", async () => {
|
||||
const exporter = new HTMLExporter(
|
||||
room,
|
||||
ExportType.LastNMessages,
|
||||
{
|
||||
attachmentsIncluded: false,
|
||||
maxSize: 1_024 * 1_024,
|
||||
},
|
||||
() => {},
|
||||
);
|
||||
|
||||
// test link to the first page
|
||||
//@ts-ignore private access
|
||||
exporter.wrapHTML("", 0, 3).then((res) => {
|
||||
expect(res).not.toContain("Previous group of messages");
|
||||
expect(res).toContain(
|
||||
'<div style="text-align:center;margin:10px"><a href="./messages2.html" style="font-weight:bold">Next group of messages</a></div>',
|
||||
);
|
||||
});
|
||||
|
||||
// test link for a middle page
|
||||
//@ts-ignore private access
|
||||
exporter.wrapHTML("", 1, 3).then((res) => {
|
||||
expect(res).toContain(
|
||||
'<div style="text-align:center"><a href="./messages.html" style="font-weight:bold">Previous group of messages</a></div>',
|
||||
);
|
||||
expect(res).toContain(
|
||||
'<div style="text-align:center;margin:10px"><a href="./messages3.html" style="font-weight:bold">Next group of messages</a></div>',
|
||||
);
|
||||
});
|
||||
|
||||
// test link for last page
|
||||
//@ts-ignore private access
|
||||
exporter.wrapHTML("", 2, 3).then((res) => {
|
||||
expect(res).toContain(
|
||||
'<div style="text-align:center"><a href="./messages2.html" style="font-weight:bold">Previous group of messages</a></div>',
|
||||
);
|
||||
expect(res).not.toContain("Next group of messages");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue