From 00d48b20bdd6389237c702bde12a5d93ebd20941 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 14 Aug 2013 13:27:50 +0800 Subject: [PATCH] Add spec for changing remote object's properties. --- spec/api/ipc.coffee | 13 ++++++++++++- spec/fixtures/module/property.js | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/module/property.js diff --git a/spec/api/ipc.coffee b/spec/api/ipc.coffee index 4860b96..5215da3 100644 --- a/spec/api/ipc.coffee +++ b/spec/api/ipc.coffee @@ -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' diff --git a/spec/fixtures/module/property.js b/spec/fixtures/module/property.js new file mode 100644 index 0000000..88e596f --- /dev/null +++ b/spec/fixtures/module/property.js @@ -0,0 +1 @@ +exports.property = 1127 -- 2.7.4