forked from sheetjs/sheetjs
test cleanup
This commit is contained in:
parent
1dceeffbe9
commit
72d7707152
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
node_modules
|
||||
node_modules
|
||||
misc/coverage.html
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
var parse_StrRun = function(data, length) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
}
|
||||
};
|
||||
|
||||
/* [MS-XLSB] 2.1.7.121 */
|
||||
var parse_RichStr = function(data, length) {
|
||||
|
30
test.js
30
test.js
@ -5,7 +5,6 @@ describe('source',function(){ it('should load', function(){ XLSX = require('./')
|
||||
|
||||
var ex = [".xlsb", ".xlsm", ".xlsx"];
|
||||
if(process.env.FMTS) ex=process.env.FMTS.split(":").map(function(x){return x[0]==="."?x:"."+x;});
|
||||
console.log(ex, process.env.FMTS);
|
||||
var exp = ex.map(function(x){ return x + ".pending"; });
|
||||
function test_file(x){return ex.indexOf(x.substr(-5))>=0||exp.indexOf(x.substr(-13))>=0;}
|
||||
|
||||
@ -113,7 +112,6 @@ describe('options', function() {
|
||||
var found = false;
|
||||
wb.SheetNames.forEach(function(s) {
|
||||
var ws = wb.Sheets[s];
|
||||
console.log(ws);
|
||||
Object.keys(ws).forEach(function(addr) {
|
||||
if(addr[0] === "!" || !ws.hasOwnProperty(addr)) return;
|
||||
if(typeof ws[addr].f !== 'undefined') return found = true;
|
||||
@ -131,4 +129,32 @@ describe('options', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should not generate sheet stubs by default', function() {
|
||||
var wb = XLSX.readFile('./test_files/merge_cells.xlsx');
|
||||
assert.throws(function() { wb.Sheets.Merge.A2.v; });
|
||||
});
|
||||
it('should generate sheet stubs when requested', function() {
|
||||
var wb = XLSX.readFile('./test_files/merge_cells.xlsx', {sheetStubs:true});
|
||||
assert(typeof wb.Sheets.Merge.A2.t !== 'undefined');
|
||||
});
|
||||
it('should not generate number formats by default', function() {
|
||||
var wb = XLSX.readFile('./test_files/number_format.xlsm');
|
||||
wb.SheetNames.forEach(function(s) {
|
||||
var ws = wb.Sheets[s];
|
||||
Object.keys(ws).forEach(function(addr) {
|
||||
if(addr[0] === "!" || !ws.hasOwnProperty(addr)) return;
|
||||
assert(typeof ws[addr].z === 'undefined');
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should generate number formats when requested', function() {
|
||||
var wb = XLSX.readFile('./test_files/number_format.xlsm', {cellNF: true});
|
||||
wb.SheetNames.forEach(function(s) {
|
||||
var ws = wb.Sheets[s];
|
||||
Object.keys(ws).forEach(function(addr) {
|
||||
if(addr[0] === "!" || !ws.hasOwnProperty(addr)) return;
|
||||
assert(typeof ws[addr].t !== 'n' || typeof ws[addr].z !== 'undefined');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
2
xlsx.js
2
xlsx.js
@ -639,7 +639,7 @@ var recordhopper = function(data, cb, opts) {
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
var parse_StrRun = function(data, length) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
}
|
||||
};
|
||||
|
||||
/* [MS-XLSB] 2.1.7.121 */
|
||||
var parse_RichStr = function(data, length) {
|
||||
|
Loading…
Reference in New Issue
Block a user