Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pagedjs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume
pagedjs
Commits
6fc10433
Commit
6fc10433
authored
Jun 13, 2020
by
Guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolves #215 do not force a page break on named page
parent
58b2c9ea
Pipeline
#541
passed with stage
in 3 minutes and 59 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
1 deletion
+52
-1
no-forced-page-break-spec-js-no-forced-page-break-should-create-a-pdf-1-snap.png
...ec-js-no-forced-page-break-should-create-a-pdf-1-snap.png
+0
-0
no-forced-page-break.html
...named-page/no-forced-page-break/no-forced-page-break.html
+19
-0
no-forced-page-break.spec.js
...ed-page/no-forced-page-break/no-forced-page-break.spec.js
+32
-0
dom.js
src/utils/dom.js
+1
-1
No files found.
specs/named-page/no-forced-page-break/__image_snapshots_linux__/no-forced-page-break-spec-js-no-forced-page-break-should-create-a-pdf-1-snap.png
0 → 100644
View file @
6fc10433
16.4 KB
specs/named-page/no-forced-page-break/no-forced-page-break.html
0 → 100644
View file @
6fc10433
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
named-page
</title>
<meta
charset=
"UTF-8"
>
<script
src=
"../../../dist/paged.polyfill.js"
></script>
<style>
#toc
{
page
:
tableofcontents
;
}
</style>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
</head>
<body>
<header>
<div
id=
"toc"
><h1>
Table of Contents
</h1></div>
</header>
</body>
</html>
specs/named-page/no-forced-page-break/no-forced-page-break.spec.js
0 → 100644
View file @
6fc10433
const
TIMEOUT
=
10000
;
describe
(
"
no-forced-page-break
"
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
loadPage
(
"
named-page/no-forced-page-break/no-forced-page-break.html
"
);
return
page
.
rendered
;
},
TIMEOUT
);
afterAll
(
async
()
=>
{
if
(
!
DEBUG
)
{
await
page
.
close
();
}
});
it
(
"
should not force a page break and render only 1 page
"
,
async
()
=>
{
let
pages
=
await
page
.
$$eval
(
"
.pagedjs_page
"
,
(
r
)
=>
{
return
r
.
length
;
});
expect
(
pages
).
toEqual
(
1
);
});
if
(
!
DEBUG
)
{
it
(
"
should create a pdf
"
,
async
()
=>
{
let
pdf
=
await
page
.
pdf
(
PDF_SETTINGS
);
expect
(
pdf
).
toMatchPDFSnapshot
(
1
);
});
}
}
);
src/utils/dom.js
View file @
6fc10433
...
...
@@ -285,7 +285,7 @@ export function needsPreviousBreakAfter(node) {
export
function
needsPageBreak
(
node
)
{
if
(
typeof
node
!==
"
undefined
"
&&
typeof
node
.
dataset
!==
"
undefined
"
&&
(
node
.
dataset
.
page
||
node
.
dataset
.
afterPage
)
node
.
dataset
.
afterPage
)
{
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment