fix: add a "set" trap to the "screen" module proxy (#26818)

This commit is contained in:
Alexey Kuzmin 2020-12-07 20:20:50 +03:00 committed by GitHub
parent d3b1566181
commit e89b3ca1d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 21 deletions

View file

@ -2,6 +2,18 @@ import { expect } from 'chai';
import { screen } from 'electron/main';
describe('screen module', () => {
describe('methods reassignment', () => {
it('works for a selected method', () => {
const originalFunction = screen.getPrimaryDisplay;
try {
(screen as any).getPrimaryDisplay = () => null;
expect(screen.getPrimaryDisplay()).to.be.null();
} finally {
screen.getPrimaryDisplay = originalFunction;
}
});
});
describe('screen.getCursorScreenPoint()', () => {
it('returns a point object', () => {
const point = screen.getCursorScreenPoint();