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:
Jack Franklin
2020-04-21 10:40:04 +01:00
committed by GitHub
parent 3600f2f99b
commit e3922ea1f3
55 changed files with 791 additions and 789 deletions

View File

@@ -21,21 +21,21 @@ describe('querySelector', function() {
setupTestPageAndContextHooks();
describeFailsFirefox('Page.$eval', function() {
it('should work', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<section id="testAttribute">43543</section>');
const idAttribute = await page.$eval('section', e => e.id);
expect(idAttribute).toBe('testAttribute');
});
it('should accept arguments', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<section>hello</section>');
const text = await page.$eval('section', (e, suffix) => e.textContent + suffix, ' world!');
expect(text).toBe('hello world!');
});
it('should accept ElementHandles as arguments', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<section>hello</section><div> world</div>');
const divHandle = await page.$('div');
@@ -43,7 +43,7 @@ describe('querySelector', function() {
expect(text).toBe('hello world');
});
it('should throw error if no element is found', async() => {
const { page } = getTestState();
const {page} = getTestState();
let error = null;
await page.$eval('section', e => e.id).catch(e => error = e);
@@ -53,7 +53,7 @@ describe('querySelector', function() {
describeFailsFirefox('Page.$$eval', function() {
it('should work', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
const divsCount = await page.$$eval('div', divs => divs.length);
@@ -63,14 +63,14 @@ describe('querySelector', function() {
describeFailsFirefox('Page.$', function() {
it('should query existing element', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<section>test</section>');
const element = await page.$('section');
expect(element).toBeTruthy();
});
it('should return null for non-existing element', async() => {
const { page } = getTestState();
const {page} = getTestState();
const element = await page.$('non-existing-element');
expect(element).toBe(null);
@@ -79,7 +79,7 @@ describe('querySelector', function() {
describe('Page.$$', function() {
itFailsFirefox('should query existing elements', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<div>A</div><br/><div>B</div>');
const elements = await page.$$('div');
@@ -88,7 +88,7 @@ describe('querySelector', function() {
expect(await Promise.all(promises)).toEqual(['A', 'B']);
});
it('should return empty array if nothing is found', async() => {
const { page, server } = getTestState();
const {page, server} = getTestState();
await page.goto(server.EMPTY_PAGE);
const elements = await page.$$('div');
@@ -98,7 +98,7 @@ describe('querySelector', function() {
describeFailsFirefox('Path.$x', function() {
it('should query existing element', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<section>test</section>');
const elements = await page.$x('/html/body/section');
@@ -106,13 +106,13 @@ describe('querySelector', function() {
expect(elements.length).toBe(1);
});
it('should return empty array for non-existing element', async() => {
const { page } = getTestState();
const {page} = getTestState();
const element = await page.$x('/html/body/non-existing-element');
expect(element).toEqual([]);
});
it('should return multiple elements', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<div></div><div></div>');
const elements = await page.$x('/html/body/div');
@@ -123,7 +123,7 @@ describe('querySelector', function() {
describe('ElementHandle.$', function() {
it('should query existing element', async() => {
const { page, server } = getTestState();
const {page, server} = getTestState();
await page.goto(server.PREFIX + '/playground.html');
await page.setContent('<html><body><div class="second"><div class="inner">A</div></div></body></html>');
@@ -135,7 +135,7 @@ describe('querySelector', function() {
});
itFailsFirefox('should return null for non-existing element', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<html><body><div class="second"><div class="inner">B</div></div></body></html>');
const html = await page.$('html');
@@ -145,7 +145,7 @@ describe('querySelector', function() {
});
describeFailsFirefox('ElementHandle.$eval', function() {
it('should work', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');
const tweet = await page.$('.tweet');
@@ -154,7 +154,7 @@ describe('querySelector', function() {
});
it('should retrieve content from subtree', async() => {
const { page } = getTestState();
const {page} = getTestState();
const htmlContent = '<div class="a">not-a-child-div</div><div id="myId"><div class="a">a-child-div</div></div>';
await page.setContent(htmlContent);
@@ -164,7 +164,7 @@ describe('querySelector', function() {
});
it('should throw in case of missing selector', async() => {
const { page } = getTestState();
const {page} = getTestState();
const htmlContent = '<div class="a">not-a-child-div</div><div id="myId"></div>';
await page.setContent(htmlContent);
@@ -175,7 +175,7 @@ describe('querySelector', function() {
});
describeFailsFirefox('ElementHandle.$$eval', function() {
it('should work', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="like">10</div></div></body></html>');
const tweet = await page.$('.tweet');
@@ -184,7 +184,7 @@ describe('querySelector', function() {
});
it('should retrieve content from subtree', async() => {
const { page } = getTestState();
const {page} = getTestState();
const htmlContent = '<div class="a">not-a-child-div</div><div id="myId"><div class="a">a1-child-div</div><div class="a">a2-child-div</div></div>';
await page.setContent(htmlContent);
@@ -194,7 +194,7 @@ describe('querySelector', function() {
});
it('should not throw in case of missing selector', async() => {
const { page } = getTestState();
const {page} = getTestState();
const htmlContent = '<div class="a">not-a-child-div</div><div id="myId"></div>';
await page.setContent(htmlContent);
@@ -207,7 +207,7 @@ describe('querySelector', function() {
describeFailsFirefox('ElementHandle.$$', function() {
it('should query existing elements', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<html><body><div>A</div><br/><div>B</div></body></html>');
const html = await page.$('html');
@@ -218,7 +218,7 @@ describe('querySelector', function() {
});
it('should return empty array for non-existing elements', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<html><body><span>A</span><br/><span>B</span></body></html>');
const html = await page.$('html');
@@ -230,7 +230,7 @@ describe('querySelector', function() {
describe('ElementHandle.$x', function() {
it('should query existing element', async() => {
const { page, server } = getTestState();
const {page, server} = getTestState();
await page.goto(server.PREFIX + '/playground.html');
await page.setContent('<html><body><div class="second"><div class="inner">A</div></div></body></html>');
@@ -242,7 +242,7 @@ describe('querySelector', function() {
});
itFailsFirefox('should return null for non-existing element', async() => {
const { page } = getTestState();
const {page} = getTestState();
await page.setContent('<html><body><div class="second"><div class="inner">B</div></div></body></html>');
const html = await page.$('html');