build: enable JS semicolons (#22783)

This commit is contained in:
Samuel Attard 2020-03-20 13:28:31 -07:00 committed by GitHub
parent 24e21467b9
commit 5d657dece4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
354 changed files with 21512 additions and 21510 deletions

View file

@ -1,109 +1,109 @@
const { expect } = require('chai')
const { webFrame } = require('electron')
const { expect } = require('chai');
const { webFrame } = require('electron');
describe('webFrame module', function () {
it('top is self for top frame', () => {
expect(webFrame.top.context).to.equal(webFrame.context)
})
expect(webFrame.top.context).to.equal(webFrame.context);
});
it('opener is null for top frame', () => {
expect(webFrame.opener).to.be.null()
})
expect(webFrame.opener).to.be.null();
});
it('firstChild is null for top frame', () => {
expect(webFrame.firstChild).to.be.null()
})
expect(webFrame.firstChild).to.be.null();
});
it('getFrameForSelector() does not crash when not found', () => {
expect(webFrame.getFrameForSelector('unexist-selector')).to.be.null()
})
expect(webFrame.getFrameForSelector('unexist-selector')).to.be.null();
});
it('findFrameByName() does not crash when not found', () => {
expect(webFrame.findFrameByName('unexist-name')).to.be.null()
})
expect(webFrame.findFrameByName('unexist-name')).to.be.null();
});
it('findFrameByRoutingId() does not crash when not found', () => {
expect(webFrame.findFrameByRoutingId(-1)).to.be.null()
})
expect(webFrame.findFrameByRoutingId(-1)).to.be.null();
});
describe('executeJavaScript', () => {
let childFrameElement, childFrame
let childFrameElement, childFrame;
before(() => {
childFrameElement = document.createElement('iframe')
document.body.appendChild(childFrameElement)
childFrame = webFrame.firstChild
})
childFrameElement = document.createElement('iframe');
document.body.appendChild(childFrameElement);
childFrame = webFrame.firstChild;
});
after(() => {
childFrameElement.remove()
})
childFrameElement.remove();
});
it('executeJavaScript() yields results via a promise and a sync callback', done => {
let callbackResult, callbackError
let callbackResult, callbackError;
childFrame
.executeJavaScript('1 + 1', (result, error) => {
callbackResult = result
callbackError = error
callbackResult = result;
callbackError = error;
})
.then(
promiseResult => {
expect(promiseResult).to.equal(2)
done()
expect(promiseResult).to.equal(2);
done();
},
promiseError => {
done(promiseError)
done(promiseError);
}
)
);
expect(callbackResult).to.equal(2)
expect(callbackError).to.be.undefined()
})
expect(callbackResult).to.equal(2);
expect(callbackError).to.be.undefined();
});
it('executeJavaScriptInIsolatedWorld() yields results via a promise and a sync callback', done => {
let callbackResult, callbackError
let callbackResult, callbackError;
childFrame
.executeJavaScriptInIsolatedWorld(999, [{ code: '1 + 1' }], (result, error) => {
callbackResult = result
callbackError = error
callbackResult = result;
callbackError = error;
})
.then(
promiseResult => {
expect(promiseResult).to.equal(2)
done()
expect(promiseResult).to.equal(2);
done();
},
promiseError => {
done(promiseError)
done(promiseError);
}
)
);
expect(callbackResult).to.equal(2)
expect(callbackError).to.be.undefined()
})
expect(callbackResult).to.equal(2);
expect(callbackError).to.be.undefined();
});
it('executeJavaScript() yields errors via a promise and a sync callback', done => {
let callbackResult, callbackError
let callbackResult, callbackError;
childFrame
.executeJavaScript('thisShouldProduceAnError()', (result, error) => {
callbackResult = result
callbackError = error
callbackResult = result;
callbackError = error;
})
.then(
promiseResult => {
done(new Error('error is expected'))
done(new Error('error is expected'));
},
promiseError => {
expect(promiseError).to.be.an('error')
done()
expect(promiseError).to.be.an('error');
done();
}
)
);
expect(callbackResult).to.be.undefined()
expect(callbackError).to.be.an('error')
})
expect(callbackResult).to.be.undefined();
expect(callbackError).to.be.an('error');
});
// executeJavaScriptInIsolatedWorld is failing to detect exec errors and is neither
// rejecting nor passing the error to the callback. This predates the reintroduction
@ -133,8 +133,8 @@ describe('webFrame module', function () {
// })
it('executeJavaScript(InIsolatedWorld) can be used without a callback', async () => {
expect(await webFrame.executeJavaScript('1 + 1')).to.equal(2)
expect(await webFrame.executeJavaScriptInIsolatedWorld(999, [{ code: '1 + 1' }])).to.equal(2)
})
})
})
expect(await webFrame.executeJavaScript('1 + 1')).to.equal(2);
expect(await webFrame.executeJavaScriptInIsolatedWorld(999, [{ code: '1 + 1' }])).to.equal(2);
});
});
});