From 4ebb5d099e9f1589b142bd374645eb6ed7167f0b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Thu, 1 Mar 2018 14:00:14 +0000 Subject: [PATCH] add trigger reset test for null on 2nd output --- test/nodes/core/core/89-trigger_spec.js | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/nodes/core/core/89-trigger_spec.js b/test/nodes/core/core/89-trigger_spec.js index 9faff3bb3..f7aa3b693 100644 --- a/test/nodes/core/core/89-trigger_spec.js +++ b/test/nodes/core/core/89-trigger_spec.js @@ -355,6 +355,34 @@ describe('trigger node', function() { }); }); + it('should be able to reset correctly having not output anything on second edge', function(done) { + var flow = [{"id":"n1", "type":"trigger", "name":"triggerNode", op2type:"nul", op1:"true",op1type:"val", op2:"false", duration:"35", wires:[["n2"]] }, + {id:"n2", type:"helper"} ]; + helper.load(triggerNode, flow, function() { + var n1 = helper.getNode("n1"); + var n2 = helper.getNode("n2"); + var c = 0; + n2.on("input", function(msg) { + try { + msg.should.have.a.property("payload", true); + c += 1; + } + catch(err) { done(err); } + }); + setTimeout( function() { + c.should.equal(3); // should only have had one output. + done(); + },300); + n1.emit("input", {payload:1}); + setTimeout( function() { + n1.emit("input", {payload:2}); + },100); + setTimeout( function() { + n1.emit("input", {payload:3}); + },200); + }); + }); + it('should be able to extend the delay', function(done) { var spy = sinon.stub(RED.util, 'evaluateNodeProperty', function(arg1, arg2, arg3, arg4) { return arg1; }