mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: enforce consistent spacing around object curlys (#5700)
The codebase was incredibly inconsistent with the use of spacing around
curly braces, e.g.:
```
// this?
const a = {b: 1}
// or?
const a = { b: 1 }
```
This extended into import statements also. Google's styleguide is no
spacing, so we're going with that.
This commit is contained in:
@@ -22,14 +22,14 @@ describe('Page.click', function() {
|
||||
setupTestBrowserHooks();
|
||||
setupTestPageAndContextHooks();
|
||||
it('should click the button', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
await page.click('button');
|
||||
expect(await page.evaluate(() => result)).toBe('Clicked');
|
||||
});
|
||||
itFailsFirefox('should click svg', async() => {
|
||||
const { page } = getTestState();
|
||||
const {page} = getTestState();
|
||||
|
||||
await page.setContent(`
|
||||
<svg height="100" width="100">
|
||||
@@ -40,7 +40,7 @@ describe('Page.click', function() {
|
||||
expect(await page.evaluate(() => window.__CLICKED)).toBe(42);
|
||||
});
|
||||
itFailsFirefox('should click the button if window.Node is removed', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
await page.evaluate(() => delete window.Node);
|
||||
@@ -49,7 +49,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
// @see https://github.com/puppeteer/puppeteer/issues/4281
|
||||
itFailsFirefox('should click on a span with an inline element inside', async() => {
|
||||
const { page } = getTestState();
|
||||
const {page} = getTestState();
|
||||
|
||||
await page.setContent(`
|
||||
<style>
|
||||
@@ -63,7 +63,7 @@ describe('Page.click', function() {
|
||||
expect(await page.evaluate(() => window.CLICKED)).toBe(42);
|
||||
});
|
||||
it('should not throw UnhandledPromiseRejection when page closes', async() => {
|
||||
const { page } = getTestState();
|
||||
const {page} = getTestState();
|
||||
|
||||
const newPage = await page.browser().newPage();
|
||||
await Promise.all([
|
||||
@@ -72,7 +72,7 @@ describe('Page.click', function() {
|
||||
]).catch(e => {});
|
||||
});
|
||||
it('should click the button after navigation ', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
await page.click('button');
|
||||
@@ -81,7 +81,7 @@ describe('Page.click', function() {
|
||||
expect(await page.evaluate(() => result)).toBe('Clicked');
|
||||
});
|
||||
itFailsFirefox('should click with disabled javascript', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.setJavaScriptEnabled(false);
|
||||
await page.goto(server.PREFIX + '/wrappedlink.html');
|
||||
@@ -92,7 +92,7 @@ describe('Page.click', function() {
|
||||
expect(page.url()).toBe(server.PREFIX + '/wrappedlink.html#clicked');
|
||||
});
|
||||
itFailsFirefox('should click when one of inline box children is outside of viewport', async() => {
|
||||
const { page } = getTestState();
|
||||
const {page} = getTestState();
|
||||
|
||||
await page.setContent(`
|
||||
<style>
|
||||
@@ -107,7 +107,7 @@ describe('Page.click', function() {
|
||||
expect(await page.evaluate(() => window.CLICKED)).toBe(42);
|
||||
});
|
||||
it('should select the text by triple clicking', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||
await page.focus('textarea');
|
||||
@@ -122,7 +122,7 @@ describe('Page.click', function() {
|
||||
})).toBe(text);
|
||||
});
|
||||
itFailsFirefox('should click offscreen buttons', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
||||
const messages = [];
|
||||
@@ -148,7 +148,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
|
||||
it('should click wrapped links', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/wrappedlink.html');
|
||||
await page.click('a');
|
||||
@@ -156,7 +156,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
|
||||
it('should click on checkbox input and toggle', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/checkbox.html');
|
||||
expect(await page.evaluate(() => result.check)).toBe(null);
|
||||
@@ -177,7 +177,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
|
||||
itFailsFirefox('should click on checkbox label and toggle', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/checkbox.html');
|
||||
expect(await page.evaluate(() => result.check)).toBe(null);
|
||||
@@ -193,7 +193,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
|
||||
it('should fail to click a missing button', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
let error = null;
|
||||
@@ -202,7 +202,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
// @see https://github.com/puppeteer/puppeteer/issues/161
|
||||
it('should not hang with touch-enabled viewports', async() => {
|
||||
const { page, puppeteer } = getTestState();
|
||||
const {page, puppeteer} = getTestState();
|
||||
|
||||
await page.setViewport(puppeteer.devices['iPhone 6'].viewport);
|
||||
await page.mouse.down();
|
||||
@@ -210,7 +210,7 @@ describe('Page.click', function() {
|
||||
await page.mouse.up();
|
||||
});
|
||||
it('should scroll and click the button', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||
await page.click('#button-5');
|
||||
@@ -219,7 +219,7 @@ describe('Page.click', function() {
|
||||
expect(await page.evaluate(() => document.querySelector('#button-80').textContent)).toBe('clicked');
|
||||
});
|
||||
itFailsFirefox('should double click the button', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
await page.evaluate(() => {
|
||||
@@ -230,12 +230,12 @@ describe('Page.click', function() {
|
||||
});
|
||||
});
|
||||
const button = await page.$('button');
|
||||
await button.click({ clickCount: 2 });
|
||||
await button.click({clickCount: 2});
|
||||
expect(await page.evaluate('double')).toBe(true);
|
||||
expect(await page.evaluate('result')).toBe('Clicked');
|
||||
});
|
||||
it('should click a partially obscured button', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
await page.evaluate(() => {
|
||||
@@ -248,14 +248,14 @@ describe('Page.click', function() {
|
||||
expect(await page.evaluate(() => window.result)).toBe('Clicked');
|
||||
});
|
||||
it('should click a rotated button', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/rotatedButton.html');
|
||||
await page.click('button');
|
||||
expect(await page.evaluate(() => result)).toBe('Clicked');
|
||||
});
|
||||
it('should fire contextmenu event on right click', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||
await page.click('#button-8', {button: 'right'});
|
||||
@@ -263,14 +263,14 @@ describe('Page.click', function() {
|
||||
});
|
||||
// @see https://github.com/puppeteer/puppeteer/issues/206
|
||||
itFailsFirefox('should click links which cause navigation', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.setContent(`<a href="${server.EMPTY_PAGE}">empty.html</a>`);
|
||||
// This await should not hang.
|
||||
await page.click('a');
|
||||
});
|
||||
itFailsFirefox('should click the button inside an iframe', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<div style="width:100px;height:100px">spacer</div>');
|
||||
@@ -282,7 +282,7 @@ describe('Page.click', function() {
|
||||
});
|
||||
// @see https://github.com/puppeteer/puppeteer/issues/4110
|
||||
xit('should click the button with fixed position inside an iframe', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setViewport({width: 500, height: 500});
|
||||
@@ -294,7 +294,7 @@ describe('Page.click', function() {
|
||||
expect(await frame.evaluate(() => window.result)).toBe('Clicked');
|
||||
});
|
||||
itFailsFirefox('should click the button with deviceScaleFactor set', async() => {
|
||||
const { page, server } = getTestState();
|
||||
const {page, server} = getTestState();
|
||||
|
||||
await page.setViewport({width: 400, height: 400, deviceScaleFactor: 5});
|
||||
expect(await page.evaluate(() => window.devicePixelRatio)).toBe(5);
|
||||
|
||||
Reference in New Issue
Block a user