Skip to content

Commit 2b68f1c

Browse files
authored
Merge pull request garris#170 from medovob/master
prevent clipping when using "body" selector
2 parents 6f73c7e + 506f21f commit 2b68f1c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,11 @@ From `./node_modules/backstopjs` ...
574574
$ npm run echo
575575
```
576576

577+
#### Body capture is clipped
578+
579+
Some stylesheets include a `height:100%` rule on the `<body>` element. When you use the `body` selector in this scenario, the resulting image will be clipped to the viewport. A special `body:noclip` selector is availble to force casper to use `casper.capture()` instead of `casper.captureSelector()`. Simply replace any `body` selectors in your scenarios config with `body:noclip` and this should ensure that the entire document is captured.
580+
581+
577582
### Running the report server
578583

579584
The test comparison report was written in Angular.js and requires a running HTTP server instance. This instance is auto-started after a test is run. The server is also auto-stopped after 15 minutes so you don't have to go worrying about node processes running all over the place.

capture/genBitmaps.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ function capturePageSelectors(url,scenarios,viewports,bitmaps_reference,bitmaps_
170170
var filePath = (isReference)?reference_FP:test_FP;
171171

172172

173-
if (casper.exists(o)) {
173+
if(o === "body:noclip") {
174+
casper.capture(filePath);
175+
} else if (casper.exists(o)) {
174176
if (casper.visible(o)) {
175177
casper.captureSelector(filePath, o);
176178
} else {

0 commit comments

Comments
 (0)