spec: fix conditions for some tests (#23489)
This commit is contained in:
parent
6114518463
commit
dc3de49a08
3 changed files with 9 additions and 10 deletions
|
@ -11,6 +11,7 @@ import { emittedOnce } from './events-helpers';
|
||||||
import { ifit, ifdescribe } from './spec-helpers';
|
import { ifit, ifdescribe } from './spec-helpers';
|
||||||
import { closeWindow, closeAllWindows } from './window-helpers';
|
import { closeWindow, closeAllWindows } from './window-helpers';
|
||||||
|
|
||||||
|
const features = process.electronBinding('features');
|
||||||
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures');
|
const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures');
|
||||||
|
|
||||||
// Is the display's scale factor possibly causing rounding of pixel coordinate
|
// Is the display's scale factor possibly causing rounding of pixel coordinate
|
||||||
|
@ -720,7 +721,7 @@ describe('BrowserWindow module', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('BrowserWindow.moveAbove(mediaSourceId)', () => {
|
ifdescribe(features.isDesktopCapturerEnabled())('BrowserWindow.moveAbove(mediaSourceId)', () => {
|
||||||
it('should throw an exception if wrong formatting', async () => {
|
it('should throw an exception if wrong formatting', async () => {
|
||||||
const fakeSourceIds = [
|
const fakeSourceIds = [
|
||||||
'none', 'screen:0', 'window:fake', 'window:1234', 'foobar:1:2'
|
'none', 'screen:0', 'window:fake', 'window:1234', 'foobar:1:2'
|
||||||
|
@ -731,6 +732,7 @@ describe('BrowserWindow module', () => {
|
||||||
}).to.throw(/Invalid media source id/);
|
}).to.throw(/Invalid media source id/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an exception if wrong type', async () => {
|
it('should throw an exception if wrong type', async () => {
|
||||||
const fakeSourceIds = [null as any, 123 as any];
|
const fakeSourceIds = [null as any, 123 as any];
|
||||||
fakeSourceIds.forEach((sourceId) => {
|
fakeSourceIds.forEach((sourceId) => {
|
||||||
|
@ -739,6 +741,7 @@ describe('BrowserWindow module', () => {
|
||||||
}).to.throw(/Error processing argument at index 0 */);
|
}).to.throw(/Error processing argument at index 0 */);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an exception if invalid window', async () => {
|
it('should throw an exception if invalid window', async () => {
|
||||||
// It is very unlikely that these window id exist.
|
// It is very unlikely that these window id exist.
|
||||||
const fakeSourceIds = ['window:99999999:0', 'window:123456:1',
|
const fakeSourceIds = ['window:99999999:0', 'window:123456:1',
|
||||||
|
@ -749,6 +752,7 @@ describe('BrowserWindow module', () => {
|
||||||
}).to.throw(/Invalid media source id/);
|
}).to.throw(/Invalid media source id/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not throw an exception', async () => {
|
it('should not throw an exception', async () => {
|
||||||
const w2 = new BrowserWindow({ show: false, title: 'window2' });
|
const w2 = new BrowserWindow({ show: false, title: 'window2' });
|
||||||
const w2Shown = emittedOnce(w2, 'show');
|
const w2Shown = emittedOnce(w2, 'show');
|
||||||
|
@ -777,9 +781,11 @@ describe('BrowserWindow module', () => {
|
||||||
|
|
||||||
describe('sizing', () => {
|
describe('sizing', () => {
|
||||||
let w = null as unknown as BrowserWindow;
|
let w = null as unknown as BrowserWindow;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
w = new BrowserWindow({ show: false, width: 400, height: 400 });
|
w = new BrowserWindow({ show: false, width: 400, height: 400 });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await closeWindow(w);
|
await closeWindow(w);
|
||||||
w = null as unknown as BrowserWindow;
|
w = null as unknown as BrowserWindow;
|
||||||
|
@ -4187,7 +4193,6 @@ describe('BrowserWindow module', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const features = process.electronBinding('features');
|
|
||||||
ifdescribe(features.isOffscreenRenderingEnabled())('offscreen rendering', () => {
|
ifdescribe(features.isOffscreenRenderingEnabled())('offscreen rendering', () => {
|
||||||
let w: BrowserWindow;
|
let w: BrowserWindow;
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
|
|
@ -128,7 +128,7 @@ describe('node feature', () => {
|
||||||
let child: childProcess.ChildProcessWithoutNullStreams;
|
let child: childProcess.ChildProcessWithoutNullStreams;
|
||||||
let exitPromise: Promise<any[]>;
|
let exitPromise: Promise<any[]>;
|
||||||
|
|
||||||
it('Prohibits crypto-related flags in ELECTRON_RUN_AS_NODE mode', (done) => {
|
ifit(features.isRunAsNodeEnabled())('Prohibits crypto-related flags in ELECTRON_RUN_AS_NODE mode', (done) => {
|
||||||
after(async () => {
|
after(async () => {
|
||||||
const [code, signal] = await exitPromise;
|
const [code, signal] = await exitPromise;
|
||||||
expect(signal).to.equal(null);
|
expect(signal).to.equal(null);
|
||||||
|
|
|
@ -1009,13 +1009,7 @@ describe('<webview> tag', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('<webview>.printToPDF()', () => {
|
ifdescribe(features.isPrintingEnabled())('<webview>.printToPDF()', () => {
|
||||||
before(() => {
|
|
||||||
if (!features.isPrintingEnabled()) {
|
|
||||||
this.skip();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('rejects on incorrectly typed parameters', async () => {
|
it('rejects on incorrectly typed parameters', async () => {
|
||||||
const badTypes = {
|
const badTypes = {
|
||||||
marginsType: 'terrible',
|
marginsType: 'terrible',
|
||||||
|
|
Loading…
Reference in a new issue