add output property select to HTML parse node (#1701)

This commit is contained in:
Dave Conway-Jones
2018-05-01 12:42:27 +01:00
committed by Nick O'Leary
parent e8a637498d
commit 3190de873e
4 changed files with 32 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ describe('html node', function() {
});
});
it('should retrieve header contents if asked to by msg.select - alternative property', function(done) {
it('should retrieve header contents if asked to by msg.select - alternative in property', function(done) {
fs.readFile(file, 'utf8', function(err, data) {
var flow = [{id:"n1",type:"html",property:"foo",wires:[["n2"]],func:"return msg;"},
{id:"n2", type:"helper"}];
@@ -79,7 +79,7 @@ describe('html node', function() {
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('topic', 'bar');
should.equal(msg.foo, 'This is a test page for node 70-HTML');
msg.foo[0].should.equal('This is a test page for node 70-HTML');
done();
});
n1.receive({foo:data,topic:"bar",select:"h1"});
@@ -87,6 +87,24 @@ describe('html node', function() {
});
});
it('should retrieve header contents if asked to by msg.select - alternative in and out properties', function(done) {
fs.readFile(file, 'utf8', function(err, data) {
var flow = [{id:"n1",type:"html",property:"foo",outproperty:"bar",tag:"h1",wires:[["n2"]],func:"return msg;"},
{id:"n2", type:"helper"}];
helper.load(htmlNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('topic', 'bar');
msg.bar[0].should.equal('This is a test page for node 70-HTML');
done();
});
n1.receive({foo:data,topic:"bar"});
});
});
});
it('should emit an empty array if no matching elements', function(done) {
fs.readFile(file, 'utf8', function(err, data) {
var flow = [{id:"n1",type:"html",wires:[["n2"]],func:"return msg;"},