mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2014 IBM Corp.
|
||||
* Copyright 2014, 2015 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -73,6 +73,34 @@ describe('Node', function() {
|
||||
testdone();
|
||||
});
|
||||
});
|
||||
|
||||
it('allows multiple close handlers to be registered',function(testdone) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
var callbacksClosed = 0;
|
||||
n.on('close',function(done) {
|
||||
setTimeout(function() {
|
||||
callbacksClosed++;
|
||||
done();
|
||||
},200);
|
||||
});
|
||||
n.on('close',function(done) {
|
||||
setTimeout(function() {
|
||||
callbacksClosed++;
|
||||
done();
|
||||
},200);
|
||||
});
|
||||
n.on('close',function() {
|
||||
callbacksClosed++;
|
||||
});
|
||||
var p = n.close();
|
||||
should.exist(p);
|
||||
p.then(function() {
|
||||
callbacksClosed.should.eql(3);
|
||||
testdone();
|
||||
}).otherwise(function(e) {
|
||||
testdone(e);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user