Add newlines between describe/it blocks
This commit is contained in:
parent
709661156a
commit
e63c3c727a
15 changed files with 455 additions and 295 deletions
|
@ -16,8 +16,8 @@ const comparePaths = function(path1, path2) {
|
|||
};
|
||||
|
||||
describe('ipc module', function() {
|
||||
var fixtures;
|
||||
fixtures = path.join(__dirname, 'fixtures');
|
||||
var fixtures = path.join(__dirname, 'fixtures');
|
||||
|
||||
describe('remote.require', function() {
|
||||
it('should returns same object for the same module', function() {
|
||||
var dialog1, dialog2;
|
||||
|
@ -25,36 +25,39 @@ describe('ipc module', function() {
|
|||
dialog2 = remote.require('electron');
|
||||
return assert.equal(dialog1, dialog2);
|
||||
});
|
||||
|
||||
it('should work when object contains id property', function() {
|
||||
var a;
|
||||
a = remote.require(path.join(fixtures, 'module', 'id.js'));
|
||||
return assert.equal(a.id, 1127);
|
||||
});
|
||||
|
||||
return it('should search module from the user app', function() {
|
||||
comparePaths(path.normalize(remote.process.mainModule.filename), path.resolve(__dirname, 'static', 'main.js'));
|
||||
return comparePaths(path.normalize(remote.process.mainModule.paths[0]), path.resolve(__dirname, 'static', 'node_modules'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('remote.createFunctionWithReturnValue', function() {
|
||||
return it('should be called in browser synchronously', function() {
|
||||
var buf, call, result;
|
||||
buf = new Buffer('test');
|
||||
call = remote.require(path.join(fixtures, 'module', 'call.js'));
|
||||
result = call.call(remote.createFunctionWithReturnValue(buf));
|
||||
var buf = new Buffer('test');
|
||||
var call = remote.require(path.join(fixtures, 'module', 'call.js'));
|
||||
var result = call.call(remote.createFunctionWithReturnValue(buf));
|
||||
return assert.equal(result.constructor.name, 'Buffer');
|
||||
});
|
||||
});
|
||||
|
||||
describe('remote object in renderer', function() {
|
||||
it('can change its properties', function() {
|
||||
var property, property2;
|
||||
property = remote.require(path.join(fixtures, 'module', 'property.js'));
|
||||
var 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'));
|
||||
var property2 = remote.require(path.join(fixtures, 'module', 'property.js'));
|
||||
assert.equal(property2.property, 1007);
|
||||
return property.property = 1127;
|
||||
});
|
||||
|
||||
return it('can construct an object from its member', function() {
|
||||
var call, obj;
|
||||
call = remote.require(path.join(fixtures, 'module', 'call.js'));
|
||||
|
@ -62,37 +65,37 @@ describe('ipc module', function() {
|
|||
return assert.equal(obj.test, 'test');
|
||||
});
|
||||
});
|
||||
|
||||
describe('remote value in browser', function() {
|
||||
var print;
|
||||
print = path.join(fixtures, 'module', 'print_name.js');
|
||||
var print = path.join(fixtures, 'module', 'print_name.js');
|
||||
|
||||
it('keeps its constructor name for objects', function() {
|
||||
var buf, print_name;
|
||||
buf = new Buffer('test');
|
||||
print_name = remote.require(print);
|
||||
var buf = new Buffer('test');
|
||||
var print_name = remote.require(print);
|
||||
return assert.equal(print_name.print(buf), 'Buffer');
|
||||
});
|
||||
|
||||
return it('supports instanceof Date', function() {
|
||||
var now, print_name;
|
||||
now = new Date();
|
||||
print_name = remote.require(print);
|
||||
var now = new Date();
|
||||
var print_name = remote.require(print);
|
||||
assert.equal(print_name.print(now), 'Date');
|
||||
return assert.deepEqual(print_name.echo(now), now);
|
||||
});
|
||||
});
|
||||
|
||||
describe('remote promise', function() {
|
||||
return it('can be used as promise in each side', function(done) {
|
||||
var promise;
|
||||
promise = remote.require(path.join(fixtures, 'module', 'promise.js'));
|
||||
var promise = remote.require(path.join(fixtures, 'module', 'promise.js'));
|
||||
return promise.twicePromise(Promise.resolve(1234)).then(function(value) {
|
||||
assert.equal(value, 2468);
|
||||
return done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('ipc.sender.send', function() {
|
||||
return it('should work when sending an object containing id property', function(done) {
|
||||
var obj;
|
||||
obj = {
|
||||
var obj = {
|
||||
id: 1,
|
||||
name: 'ly'
|
||||
};
|
||||
|
@ -103,16 +106,17 @@ describe('ipc module', function() {
|
|||
return ipcRenderer.send('message', obj);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ipc.sendSync', function() {
|
||||
it('can be replied by setting event.returnValue', function() {
|
||||
var msg;
|
||||
msg = ipcRenderer.sendSync('echo', 'test');
|
||||
var msg = ipcRenderer.sendSync('echo', 'test');
|
||||
return assert.equal(msg, 'test');
|
||||
});
|
||||
|
||||
return it('does not crash when reply is not sent and browser is destroyed', function(done) {
|
||||
var w;
|
||||
this.timeout(10000);
|
||||
w = new BrowserWindow({
|
||||
|
||||
var w = new BrowserWindow({
|
||||
show: false
|
||||
});
|
||||
ipcMain.once('send-sync-message', function(event) {
|
||||
|
@ -123,18 +127,19 @@ describe('ipc module', function() {
|
|||
return w.loadURL('file://' + path.join(fixtures, 'api', 'send-sync-message.html'));
|
||||
});
|
||||
});
|
||||
|
||||
return describe('remote listeners', function() {
|
||||
var w;
|
||||
w = null;
|
||||
var w = null;
|
||||
|
||||
afterEach(function() {
|
||||
return w.destroy();
|
||||
});
|
||||
|
||||
return it('can be added and removed correctly', function() {
|
||||
var listener;
|
||||
w = new BrowserWindow({
|
||||
show: false
|
||||
});
|
||||
listener = function() {};
|
||||
var listener = function() {};
|
||||
w.on('test', listener);
|
||||
assert.equal(w.listenerCount('test'), 1);
|
||||
w.removeListener('test', listener);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue