Add spec for changing remote object's properties.

This commit is contained in:
Cheng Zhao 2013-08-14 13:27:50 +08:00
parent 0c31494ffa
commit 00d48b20bd
2 changed files with 13 additions and 1 deletions
spec
api
fixtures/module

View file

@ -4,6 +4,8 @@ path = require 'path'
remote = require 'remote'
describe 'ipc', ->
fixtures = path.join __dirname, '..', 'fixtures'
describe 'remote.require', ->
it 'should returns same object for the same module', ->
dialog1 = remote.require 'dialog'
@ -11,9 +13,18 @@ describe 'ipc', ->
assert.equal dialog1, dialog2
it 'should work when object contains id property', ->
a = remote.require path.join(__dirname, '..', 'fixtures', 'module', 'id.js')
a = remote.require path.join(fixtures, 'module', 'id.js')
assert.equal a.id, 1127
describe 'remote object', ->
it 'can change its properties', ->
property = remote.require path.join(fixtures, 'module', 'property.js')
assert.equal property.property, 1127
property.property = 1007
assert.equal property.property, 1007
property2 = remote.require path.join(fixtures, 'module', 'property.js')
assert.equal property2.property, 1007
describe 'ipc.send', ->
it 'should work when sending an object containing id property', (done) ->
obj = id: 1, name: 'ly'

1
spec/fixtures/module/property.js vendored Normal file
View file

@ -0,0 +1 @@
exports.property = 1127