Add spec for remote setter with remote object

This commit is contained in:
Kevin Sawicki 2017-04-03 14:17:16 -07:00
parent 3e9014c371
commit e5f70f90a4
2 changed files with 19 additions and 0 deletions

View file

@ -199,6 +199,14 @@ describe('ipc module', function () {
}, /setting error/) }, /setting error/)
}) })
it('can set a remote property with a remote object', function () {
const foo = remote.require(path.join(fixtures, 'module', 'remote-object-set.js'))
assert.doesNotThrow(function () {
foo.bar = remote.getCurrentWindow()
})
})
it('can construct an object from its member', function () { it('can construct an object from its member', function () {
var call = remote.require(path.join(fixtures, 'module', 'call.js')) var call = remote.require(path.join(fixtures, 'module', 'call.js'))
var obj = new call.constructor() var obj = new call.constructor()

View file

@ -0,0 +1,11 @@
const {BrowserWindow} = require('electron')
class Foo {
set bar (value) {
if (!(value instanceof BrowserWindow)) {
throw new Error('setting error')
}
}
}
module.exports = new Foo()