From faab8476ec9ca27acb5dfda912d1b4811e85ddfc Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Wed, 3 Feb 2016 13:29:11 +0100 Subject: [PATCH] add css option - fixes #228 --- package.json | 4 ++-- readme.md | 6 ++++++ test/test.js | 9 +++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b41fe27..f5efba6 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "node": ">=0.12.0" }, "scripts": { - "test": "xo && npm run prepublish && nyc ava", + "test": "xo && npm run prepublish && nyc ava --serial", "prepublish": "babel lib --out-dir=dist --optional=runtime", "coveralls": "nyc report --reporter=text-lcov | coveralls" }, @@ -69,7 +69,7 @@ "plur": "^2.0.0", "protocolify": "^1.0.0", "rimraf": "^2.2.8", - "screenshot-stream": "^3.0.0", + "screenshot-stream": "^3.1.0", "viewport-list": "^4.0.1" }, "devDependencies": { diff --git a/readme.md b/readme.md index ba82414..52d175b 100644 --- a/readme.md +++ b/readme.md @@ -51,6 +51,12 @@ Default: `false` Crop to the set height. +##### css + +Type: `string` + +Apply custom CSS to the webpage. Specify some CSS or the path to a CSS file. + ##### cookies Type: `array` of `string`, `object` diff --git a/test/test.js b/test/test.js index c799b98..d230f3e 100644 --- a/test/test.js +++ b/test/test.js @@ -74,6 +74,15 @@ test('crop image using the `crop` option', async t => { t.is(size.height, 768); }); +test('have a `css` option', async t => { + const streams = await new Pageres({delay: 2, css: 'body { background-color: red; }'}).src('http://todomvc.com', ['1024x768']).run(); + const png = new PNG(await getStream.buffer(streams[0])); + const pixels = await rfpify(png.decode.bind(png), Promise)(); + t.is(pixels[0], 255); + t.is(pixels[1], 0); + t.is(pixels[2], 0); +}); + test('rename image using the `filename` option', async t => { const streams = await new Pageres() .src('http://todomvc.com', ['1024x768'], {