browser test cleanup (#2039)

* browser test cleanup

* add cases to core.js

* apply feedback
This commit is contained in:
William Law 2020-07-02 15:57:21 -04:00 committed by GitHub
parent 93ec51ec76
commit 8ecbf4dc97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 131 additions and 15 deletions

20
tests/core.js generated
View File

@ -768,6 +768,20 @@ describe('API', function() {
]);
if(assert.deepEqual) assert.deepEqual(data.A2, { l: { Target: 'https://123.com' }, v: 'url', t: 's' });
});
it('decode_range', function() {
var _c = "ABC", _r = "123", _C = "DEF", _R = "456";
var r = X.utils.decode_range(_c + _r + ":" + _C + _R);
assert(r.s != r.e);
assert.equal(r.s.c, X.utils.decode_col(_c)); assert.equal(r.s.r, X.utils.decode_row(_r));
assert.equal(r.e.c, X.utils.decode_col(_C)); assert.equal(r.e.r, X.utils.decode_row(_R));
r = X.utils.decode_range(_c + _r);
assert(r.s != r.e);
assert.equal(r.s.c, X.utils.decode_col(_c)); assert.equal(r.s.r, X.utils.decode_row(_r));
assert.equal(r.e.c, X.utils.decode_col(_c)); assert.equal(r.e.r, X.utils.decode_row(_r));
});
});
function coreprop(props) {
@ -1958,6 +1972,10 @@ describe('CSV', function() {
assert.equal(get_cell(sheet, "C1").t, 's');
assert.equal(get_cell(sheet, "C1").v, '100');
});
it('should interpret CRLF newlines', function() {
var wb = X.read(new Buffer("sep=&\r\n1&2&3\r\n4&5&6"), {type: "buffer"});
assert.equal(wb.Sheets.Sheet1["!ref"], "A1:C2");
});
if(!browser || typeof cptable !== 'undefined') it('should honor codepage for binary strings', function() {
var data = "abc,def\nghi,j\xD3l";
[[1251, 'У'],[1252, 'Ó'], [1253, 'Σ'], [1254, 'Ó'], [1255, '׃'], [1256, 'س'], [10000, '”']].forEach(function(m) {
@ -2333,7 +2351,7 @@ describe('encryption', function() {
if(!browser || typeof cptable !== 'undefined')
describe('multiformat tests', function() {
var mfopts = opts;
var mft = fs.readFileSync('multiformat.lst','utf-8').split("\n").map(function(x) { return x.trim(); });
var mft = fs.readFileSync('multiformat.lst','utf-8').replace(/\r/g,"").split("\n").map(function(x) { return x.trim(); });
var csv = true, formulae = false;
mft.forEach(function(x) {
if(x.charAt(0)!="#") describe('MFT ' + x, function() {

File diff suppressed because one or more lines are too long

View File

@ -33,6 +33,9 @@
./test_files/AutoFilter.ods
./test_files/AutoFilter.xlsx
./test_files/AutoFilter.xlsb
./test_files/BlankSheetTypes.xls
./test_files/BlankSheetTypes.xlsb
./test_files/BlankSheetTypes.xlsm
./test_files/custom_properties.xls
./test_files/custom_properties.xls.xml
./test_files/custom_properties.xlsx
@ -71,6 +74,10 @@
./test_files/formula_stress_test.xlsx
./test_files/formula_stress_test.xlsb
./test_files/formula_stress_test.ods
./test_files/formulae_test_simple.xls
./test_files/formulae_test_simple.xlsb
./test_files/formulae_test_simple.xlsx
./test_files/formulae_test_simple.xml
./test_files/hyperlink_stress_test_2011.xls
./test_files/hyperlink_stress_test_2011.xml
./test_files/hyperlink_stress_test_2011.xlsx
@ -88,10 +95,22 @@
./test_files/merge_cells.xlsx
./test_files/merge_cells.xlsb
./test_files/merge_cells.ods
./test_files/named_ranges_2011.xls.xml
./test_files/named_ranges_2011.xlsb
./test_files/named_ranges_2011.xlsx
./test_files/named_ranges_2011.xls
./test_files/number_format.xls
./test_files/number_format.xls.xml
./test_files/number_format.xlsm
./test_files/number_format.xlsb
./test_files/number_format_entities.xls
./test_files/number_format_entities.xlsb
./test_files/number_format_entities.xlsx
./test_files/number_format_entities.xml
./test_files/NumberFormatCondition.xls
./test_files/NumberFormatCondition.xlsb
./test_files/NumberFormatCondition.xlsm
./test_files/NumberFormatCondition.xml
./test_files/outline.xls
./test_files/outline.biff5
./test_files/outline.xlsx
@ -102,17 +121,44 @@
./test_files/page_margins_2016.xml
./test_files/page_margins_2016.xlsx
./test_files/page_margins_2016.xlsb
./test_files/pivot_table_named_range.xls.xml
./test_files/pivot_table_named_range.xlsb
./test_files/pivot_table_named_range.xlsx
./test_files/pivot_table_test.xls
./test_files/pivot_table_test.xlsb
./test_files/pivot_table_test.xlsm
./test_files/rich_text_stress.xlsb
./test_files/rich_text_stress.xlsb
./test_files/rich_text_stress.xlsx
./test_files/rich_text_stress.xls.xml
./test_files/row_height.xls
./test_files/row_height.biff5
./test_files/row_height.xml
./test_files/row_height.xlsx
./test_files/row_height.xlsb
./test_files/row_height.slk
./test_files/RkNumber.xls
./test_files/RkNumber.xlsb
./test_files/RkNumber.xlsx
./test_files/RkNumber.xls.xml
./test_files/smart_tags_2007.xls
./test_files/smart_tags_2007.xlsb
./test_files/smart_tags_2007.xlsx
./test_files/smart_tags_2007.xml
./test_files/sheet_visibility.xls
./test_files/sheet_visibility.xls
./test_files/sheet_visibility.xml
./test_files/sheet_visibility.xlsx
./test_files/sheet_visibility.xlsb
./test_files/sushi.xls
./test_files/sushi.xlsb
./test_files/sushi.xlsx
./test_files/sushi.xml
./test_files/sushi.ods
./test_files/text_and_numbers.xls
./test_files/text_and_numbers.xlsb
./test_files/text_and_numbers.xlsx
./test_files/text_and_numbers.xml
./test_files/apachepoi_SimpleWithComments.xls
./test_files/2011/apachepoi_SimpleWithComments.xls.xml
./test_files/apachepoi_SimpleWithComments.xlsx

View File

@ -1,10 +1,16 @@
#!/usr/bin/env node
var fs = require('fs');
var paths = fs.readFileSync('tests/fixtures.lst','utf-8').split("\n");
var paths = fs.readFileSync('tests/fixtures.lst','utf-8').replace(/\r/g,"").split("\n");
var aux = [
'multiformat.lst',
'./misc/ssf.json',
'./test_files/biff5/number_format_greek.xls'
]
var fullpaths = paths.concat(aux);
fs.writeFileSync('tests/fixtures.js', fullpaths.map(function(x) { return [x, fs.existsSync(x) ? fs.readFileSync(x).toString('base64') : ""]}).map(function(w) { return "fs['" + w[0] + "'] = '" + w[1] + "';\n"; }).join(""));
fs.writeFileSync('tests/fixtures.js',
fullpaths.map(function(x) {
return [x, fs.existsSync(x) ? fs.readFileSync(x).toString('base64') : ""]
}).map(function(w) {
return "fs['" + w[0] + "'] = '" + w[1] + "';\n";
}).join("")
);