1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Better fix for css, reverting test

This commit is contained in:
Dave Conway-Jones 2016-06-14 23:55:50 +01:00
parent 8f2f3bf75d
commit e4d5271d58
2 changed files with 9 additions and 9 deletions

View File

@ -112,7 +112,7 @@ module.exports = function(RED) {
var first = true; // is this the first line
var line = msg.payload;
var tmp = "";
var reg = new RegExp("^[-]?[0-9.]+[\.]?[0-9]+$");
var reg = new RegExp("^[-]?[0-9.]*[\.]?[0-9]*$");
// For now we are just going to assume that any \r or \n means an end of line...
// got to be a weird csv that has singleton \r \n in it for another reason...

View File

@ -54,7 +54,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', { a: '1', b: '2', c: '3', d: '4' });
msg.should.have.property('payload', { a: 1, b: 2, c: 3, d: 4 });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -69,7 +69,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', { a: '1', b: '2', c: '3', d: '4' });
msg.should.have.property('payload', { a: 1, b: 2, c: 3, d: 4 });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -84,7 +84,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', { col1: '1', col2: '2', col3: '3', col4: '4' });
msg.should.have.property('payload', { col1: 1, col2: 2, col3: 3, col4: 4 });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -99,7 +99,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', { a: '1', d: '4' });
msg.should.have.property('payload', { a: 1, d: 4 });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -116,7 +116,7 @@ describe('CSV node', function() {
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
//console.log(msg);
msg.should.have.property('payload', { a: '1', b: '-2', c: '+3', d: 4, e: -5, f: 'ab"cd', g: 'with,a,comma' });
msg.should.have.property('payload', { a: 1, b: -2, c: '+3', d: 4, e: -5, f: 'ab"cd', g: 'with,a,comma' });
done();
});
var testString = '"1","-2","+3","04","-05",ab""cd,"with,a,comma"'+String.fromCharCode(10);
@ -134,11 +134,11 @@ describe('CSV node', function() {
n2.on("input", function(msg) {
//console.log(msg);
if (c === 0) {
msg.should.have.property('payload', { w: '1', x: '2', y: '3', z: '4' });
msg.should.have.property('payload', { w: 1, x: 2, y: 3, z: 4 });
c += 1;
}
else {
msg.should.have.property('payload', { w: '5', x: '6', y: '7', z: '8' });
msg.should.have.property('payload', { w: 5, x: 6, y: 7, z: 8 });
done();
}
});
@ -154,7 +154,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', [ { a: '1', b: '2', c: '3', d: '4' },{ a: '5', b: '-6', c: 7, d: '+8' },{ a: '9', b: '0', c: 'a', d: 'b' },{ a: 'c', b: 'd', c: 'e', d: 'f' } ]);
msg.should.have.property('payload', [ { a: 1, b: 2, c: 3, d: 4 },{ a: 5, b: -6, c: 7, d: '+8' },{ a: 9, b: 0, c: 'a', d: 'b' },{ a: 'c', b: 'd', c: 'e', d: 'f' } ]);
done();
});
var testString = "1,2,3,4\n5,-6,07,+8\n9,0,a,b\nc,d,e,f";