electron-mocks
Advanced tools
Comparing version
@@ -15,17 +15,17 @@ "use strict"; | ||
// stub all Electron.Screen methods returning logical values | ||
this.getCursorScreenPoint = sinon_1.default.stub().returns({ x: 0, y: 0 }); | ||
this.getPrimaryDisplay = sinon_1.default.stub().returns(this._displays[0]); | ||
this.getAllDisplays = sinon_1.default.stub().returns(this._displays); | ||
this.getDisplayMatching = sinon_1.default.stub().returns(this._displays[0]); | ||
this.getDisplayNearestPoint = sinon_1.default.stub().returns(this._displays[0]); | ||
this.dipToScreenPoint = sinon_1.default.stub((point) => { | ||
this.getCursorScreenPoint = sinon_1.default.spy(() => ({ x: 0, y: 0 })); | ||
this.getPrimaryDisplay = sinon_1.default.spy(() => this._displays[0]); | ||
this.getAllDisplays = sinon_1.default.spy(() => this._displays); | ||
this.getDisplayMatching = sinon_1.default.spy(() => this._displays[0]); | ||
this.getDisplayNearestPoint = sinon_1.default.spy(() => this._displays[0]); | ||
this.dipToScreenPoint = sinon_1.default.spy((point) => { | ||
return point; | ||
}); | ||
this.dipToScreenRect = sinon_1.default.stub((thing) => { | ||
this.dipToScreenRect = sinon_1.default.spy((thing) => { | ||
return thing; | ||
}); | ||
this.screenToDipPoint = sinon_1.default.stub((point) => { | ||
this.screenToDipPoint = sinon_1.default.spy((point) => { | ||
return point; | ||
}); | ||
this.screenToDipRect = sinon_1.default.stub((thing) => { | ||
this.screenToDipRect = sinon_1.default.spy((thing) => { | ||
return thing; | ||
@@ -40,5 +40,7 @@ }); | ||
this._displays.push(display); | ||
this.emit('display-added', display); | ||
} | ||
removeDisplay(display) { | ||
this._displays = this._displays.filter((d) => d.id !== display.id); | ||
this.emit('display-removed', display); | ||
} | ||
@@ -45,0 +47,0 @@ } |
@@ -9,17 +9,17 @@ import { EventEmitter } from 'events'; | ||
// stub all Electron.Screen methods returning logical values | ||
this.getCursorScreenPoint = sinon.stub().returns({ x: 0, y: 0 }); | ||
this.getPrimaryDisplay = sinon.stub().returns(this._displays[0]); | ||
this.getAllDisplays = sinon.stub().returns(this._displays); | ||
this.getDisplayMatching = sinon.stub().returns(this._displays[0]); | ||
this.getDisplayNearestPoint = sinon.stub().returns(this._displays[0]); | ||
this.dipToScreenPoint = sinon.stub((point) => { | ||
this.getCursorScreenPoint = sinon.spy(() => ({ x: 0, y: 0 })); | ||
this.getPrimaryDisplay = sinon.spy(() => this._displays[0]); | ||
this.getAllDisplays = sinon.spy(() => this._displays); | ||
this.getDisplayMatching = sinon.spy(() => this._displays[0]); | ||
this.getDisplayNearestPoint = sinon.spy(() => this._displays[0]); | ||
this.dipToScreenPoint = sinon.spy((point) => { | ||
return point; | ||
}); | ||
this.dipToScreenRect = sinon.stub((thing) => { | ||
this.dipToScreenRect = sinon.spy((thing) => { | ||
return thing; | ||
}); | ||
this.screenToDipPoint = sinon.stub((point) => { | ||
this.screenToDipPoint = sinon.spy((point) => { | ||
return point; | ||
}); | ||
this.screenToDipRect = sinon.stub((thing) => { | ||
this.screenToDipRect = sinon.spy((thing) => { | ||
return thing; | ||
@@ -34,7 +34,9 @@ }); | ||
this._displays.push(display); | ||
this.emit('display-added', display); | ||
} | ||
removeDisplay(display) { | ||
this._displays = this._displays.filter((d) => d.id !== display.id); | ||
this.emit('display-removed', display); | ||
} | ||
} | ||
//# sourceMappingURL=MockScreen.js.map |
@@ -6,11 +6,14 @@ /// <reference types="node" /> | ||
private _displays; | ||
getCursorScreenPoint: sinon.SinonStub<any[], any>; | ||
getPrimaryDisplay: sinon.SinonStub<any[], any>; | ||
getAllDisplays: sinon.SinonStub<any[], any>; | ||
getDisplayMatching: sinon.SinonStub<any[], any>; | ||
getDisplayNearestPoint: sinon.SinonStub<any[], any>; | ||
dipToScreenPoint: sinon.SinonStubbedInstance<(point: Electron.Point) => Electron.Point>; | ||
dipToScreenRect: sinon.SinonStubbedInstance<(thing: Electron.BrowserWindow | Electron.Rectangle) => Electron.Rectangle>; | ||
screenToDipPoint: sinon.SinonStubbedInstance<(point: Electron.Point) => Electron.Point>; | ||
screenToDipRect: sinon.SinonStubbedInstance<(thing: Electron.BrowserWindow | Electron.Rectangle) => Electron.Rectangle>; | ||
getCursorScreenPoint: sinon.SinonSpy<[], { | ||
x: number; | ||
y: number; | ||
}>; | ||
getPrimaryDisplay: sinon.SinonSpy<[], Electron.Display>; | ||
getAllDisplays: sinon.SinonSpy<[], Electron.Display[]>; | ||
getDisplayMatching: sinon.SinonSpy<[], Electron.Display>; | ||
getDisplayNearestPoint: sinon.SinonSpy<[], Electron.Display>; | ||
dipToScreenPoint: sinon.SinonSpy<[point: Electron.Point], Electron.Point>; | ||
dipToScreenRect: sinon.SinonSpy<[thing: Electron.BrowserWindow | Electron.Rectangle], Electron.Rectangle>; | ||
screenToDipPoint: sinon.SinonSpy<[point: Electron.Point], Electron.Point>; | ||
screenToDipRect: sinon.SinonSpy<[thing: Electron.BrowserWindow | Electron.Rectangle], Electron.Rectangle>; | ||
constructor(displays?: Electron.Display[]); | ||
@@ -17,0 +20,0 @@ addDisplay(display: Electron.Display): void; |
{ | ||
"name": "electron-mocks", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Testing mocks for Electron", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
142976
0.27%1903
0.37%