|
| 1 | +'use strict'; |
| 2 | + |
1 | 3 | const assert = require('assert');
|
2 | 4 | const path = require('path');
|
3 | 5 |
|
@@ -98,6 +100,41 @@ describe('ipc module', function() {
|
98 | 100 | });
|
99 | 101 | });
|
100 | 102 |
|
| 103 | + describe('remote class', function() { |
| 104 | + let cl = remote.require(path.join(fixtures, 'module', 'class.js')); |
| 105 | + let base = cl.base; |
| 106 | + let derived = cl.derived; |
| 107 | + |
| 108 | + it('can get methods', function() { |
| 109 | + assert.equal(base.method(), 'method'); |
| 110 | + }); |
| 111 | + |
| 112 | + it('can get properties', function() { |
| 113 | + assert.equal(base.readonly, 'readonly'); |
| 114 | + }); |
| 115 | + |
| 116 | + it('can change properties', function() { |
| 117 | + assert.equal(base.value, 'old'); |
| 118 | + base.value = 'new'; |
| 119 | + assert.equal(base.value, 'new'); |
| 120 | + base.value = 'old'; |
| 121 | + }); |
| 122 | + |
| 123 | + it('has unenumerable methods', function() { |
| 124 | + assert(!base.hasOwnProperty('method')); |
| 125 | + assert(Object.getPrototypeOf(base).hasOwnProperty('method')); |
| 126 | + }); |
| 127 | + |
| 128 | + it('keeps prototype chain in derived class', function() { |
| 129 | + assert.equal(derived.method(), 'method'); |
| 130 | + assert.equal(derived.readonly, 'readonly'); |
| 131 | + assert(!derived.hasOwnProperty('method')); |
| 132 | + let proto = Object.getPrototypeOf(derived); |
| 133 | + assert(!proto.hasOwnProperty('method')); |
| 134 | + assert(Object.getPrototypeOf(proto).hasOwnProperty('method')); |
| 135 | + }); |
| 136 | + }); |
| 137 | + |
101 | 138 | describe('ipc.sender.send', function() {
|
102 | 139 | it('should work when sending an object containing id property', function(done) {
|
103 | 140 | var obj = {
|
|
0 commit comments