Permalink
Browse files

event emitter test now passes

  • Loading branch information...
1 parent 65bab9d commit 040979533c347d4e7a7cea59c4434123e4ac569b @substack committed Nov 10, 2011
Showing with 15 additions and 3 deletions.
  1. +10 −1 index.js
  2. +5 −2 test/single.js
View
@@ -25,6 +25,12 @@ module.exports = function (obj) {
part.pause();
s.pause();
+
+ var resume = s.resume;
+ s.resume = function () {
+ part.resume();
+ return resume.apply(this, arguments);
+ };
return s;
}
else {
@@ -35,7 +41,10 @@ module.exports = function (obj) {
part.on('data', function (buf) {
s.write(buf);
});
- part.pause();
+
+ part.on('end', function () {
+ s.end();
+ });
return s;
}
});
View
@@ -48,9 +48,12 @@ test('single stream in an event emitter', function (t) {
var ws = words.slice();
var emitter = new EventEmitter;
var iv = setInterval(function () {
- if (ws.length === 0) clearInterval(iv)
+ if (ws.length === 0) {
+ clearInterval(iv);
+ emitter.emit('end');
+ }
else emitter.emit('data', ws.shift())
- }, 20);
+ }, 5);
var s = gutter({
a : 3,

0 comments on commit 0409795

Please sign in to comment.