From 6be462b11af62fa2b83b2fd6ec4b1345b194af30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20L=C3=BCthy?= Date: Wed, 3 Jan 2018 20:18:12 -0800 Subject: [PATCH] style(prettier): run prettier on old js PRs --- examples/extract-google-results.js | 8 ++++---- examples/mocha-chai-test-example.js | 22 ++++++++++------------ examples/mouse-event-example.js | 18 +++++++++--------- examples/twitter.js | 5 ++--- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/examples/extract-google-results.js b/examples/extract-google-results.js index 0d00bcea..161c0055 100644 --- a/examples/extract-google-results.js +++ b/examples/extract-google-results.js @@ -10,10 +10,10 @@ async function run() { .wait('#resultStats') .evaluate(() => { // this will be executed in headless chrome - const links = [].map.call( - document.querySelectorAll('.g h3 a'), - a => ({title: a.innerText, href: a.href}) - ) + const links = [].map.call(document.querySelectorAll('.g h3 a'), a => ({ + title: a.innerText, + href: a.href, + })) return JSON.stringify(links) }) // you can still use the method chaining API after evaluating diff --git a/examples/mocha-chai-test-example.js b/examples/mocha-chai-test-example.js index 54dfd797..80c8bbaa 100644 --- a/examples/mocha-chai-test-example.js +++ b/examples/mocha-chai-test-example.js @@ -5,39 +5,37 @@ const { expect } = require('chai') // to run this example just run // mocha path/to/this/file -describe('When searching on google', function () { - it('shows results', async function () { - this.timeout(10000); //we need to increase the timeout or else mocha will exit with an error +describe('When searching on google', function() { + it('shows results', async function() { + this.timeout(10000) //we need to increase the timeout or else mocha will exit with an error const chromeless = new Chromeless() - await chromeless.goto('https://google.com') + await chromeless + .goto('https://google.com') .wait('input[name="q"]') .type('chromeless github', 'input[name="q"]') .press(13) // press enter .wait('#resultStats') - const result = await chromeless.exists('a[href*="graphcool/chromeless"]') - expect(result).to.be.true await chromeless.end() }) }) -describe('When clicking on the image of the demo playground', function () { - it('should redirect to the demo', async function () { - this.timeout(10000); //we need to increase the timeout or else mocha will exit with an error +describe('When clicking on the image of the demo playground', function() { + it('should redirect to the demo', async function() { + this.timeout(10000) //we need to increase the timeout or else mocha will exit with an error const chromeless = new Chromeless() - await chromeless.goto('https://github.com/graphcool/chromeless') + await chromeless + .goto('https://github.com/graphcool/chromeless') .wait('a[href="https://chromeless.netlify.com/"]') .click('a[href="https://chromeless.netlify.com/"]') .wait('#root') - const url = await chromeless.evaluate(url => window.location.href) - expect(url).to.match(/^https\:\/\/chromeless\.netlify\.com/) await chromeless.end() }) diff --git a/examples/mouse-event-example.js b/examples/mouse-event-example.js index c6858c8c..ccfa841f 100644 --- a/examples/mouse-event-example.js +++ b/examples/mouse-event-example.js @@ -1,18 +1,18 @@ const { Chromeless } = require('chromeless') async function run() { - const chromeless = new Chromeless() + const chromeless = new Chromeless() - const screenshot = await chromeless - .goto('https://www.google.com') - .mousedown('input[name="btnI"]') - .mouseup('input[name="btnI"]') - .wait('.latest-doodle') - .screenshot() + const screenshot = await chromeless + .goto('https://www.google.com') + .mousedown('input[name="btnI"]') + .mouseup('input[name="btnI"]') + .wait('.latest-doodle') + .screenshot() - console.log(screenshot) + console.log(screenshot) - await chromeless.end() + await chromeless.end() } run().catch(console.error.bind(console)) diff --git a/examples/twitter.js b/examples/twitter.js index 0a607859..cef3d0bb 100644 --- a/examples/twitter.js +++ b/examples/twitter.js @@ -1,7 +1,7 @@ const { Chromeless } = require('chromeless') -const twitterUsername = "xxx" -const twitterPassword = "xxx" +const twitterUsername = 'xxx' +const twitterPassword = 'xxx' async function run() { const chromeless = new Chromeless() @@ -18,4 +18,3 @@ async function run() { } run().catch(console.error.bind(console)) -