1
Fork 0

refresh browser tests

This commit is contained in:
SheetJS 2022-05-17 17:48:05 -04:00
parent 0b72cc592b
commit 9f8ec25845
19 changed files with 221 additions and 100 deletions

View File

@ -59,7 +59,7 @@ $(MTSBITS): misc/%: modules/%
.PHONY: clean
clean: ## Remove targets and build artifacts
rm -f $(TARGET) $(FLOWTARGET)
rm -f $(TARGET) $(FLOWTARGET) $(ESMJSTGT) $(MINITGT) $(MINIFLOW)
.PHONY: clean-data
clean-data:

View File

@ -1,27 +0,0 @@
{
"root": "./misc/docs",
"title": "SheetJS js-xlsx",
"author": "sheetjs",
"gitbook": "3.2.2",
"plugins": ["anchorjs", "ga", "sidebar-ad", "-sharing", "-search", "advanced-emoji", "-lunr"],
"pluginsConfig": {
"anchorjs": {
"icon": "#",
"placement": "left",
"visible": "always"
},
"ga": {
"token": "UA-36810333-1"
},
"sidebar-ad": {
"imageUrl": "http://oss.sheetjs.com/assets/img/logo.png",
"url": "http://sheetjs.com"
},
"theme-default": {
"showLevel": false,
"styles": {
"website": "style.css"
}
}
}
}

View File

@ -1,7 +1,7 @@
.PHONY: init
init:
cp ../../dist/xlsx.full.min.js .
if [ ! -e logo.png ]; then curl -O http://sheetjs.com/logo.png; fi
if [ ! -e logo.png ]; then curl -O https://sheetjs.com/logo.png; fi
.PHONY: lint
lint:

View File

@ -2,16 +2,15 @@
The `sheet_to_json` utility function generates output arrays suitable for use
with other JS libraries such as data grids for previewing data. After extensive
testing, [`canvas-datagrid`](https://tonygermaneri.github.io/canvas-datagrid/)
stood out as a very high-performance grid with an incredibly simple API.
testing, [`canvas-datagrid`](https://canvas-datagrid.js.org/demo.html) stood
out as a very high-performance grid with an incredibly simple API.
This demo is available at <http://oss.sheetjs.com/sheetjs/datagrid.html>
This demo is available at <https://oss.sheetjs.com/sheetjs/datagrid.html>
## Obtaining the Library
The [`canvas-datagrid` npm nodule](http://npm.im/canvas-datagrid) includes a
minified script `dist/canvas-datagrid.js` that can be directly inserted as a
script tag. The unpkg CDN also exposes the latest version:
The `canvas-datagrid` NodeJS packages include a minified script that can be
directly inserted as a script tag. The unpkg CDN also hosts this script:
```html
<script src="https://unpkg.com/canvas-datagrid/dist/canvas-datagrid.js"></script>

View File

@ -25,10 +25,10 @@ a { text-decoration: none }
<pre>
<b><a href="http://sheetjs.com">SheetJS Data Preview Live Demo</a></b>
<a href="https://github.com/TonyGermaneri/canvas-datagrid">canvas-datagrid component library</a>
<a href="https://canvas-datagrid.js.org/">canvas-datagrid component library</a>
<a href="https://github.com/SheetJS/js-xlsx">Source Code Repo</a>
<a href="https://github.com/SheetJS/js-xlsx/issues">Issues? Something look weird? Click here and report an issue</a>
<a href="https://github.com/SheetJS/sheetjs">Source Code Repo</a>
<a href="https://github.com/SheetJS/sheetjs/issues">Issues? Something look weird? Click here and report an issue</a>
<div id="drop">Drop a spreadsheet file here to see sheet data</div>
<input type="file" name="xlfile" id="xlf" /> ... or click here to select a file

View File

@ -14,7 +14,7 @@ $(TESTS): %: %.ts doit.ts $(TEST_FILES)
# --unstable is required, see https://github.com/denoland/deno_std/issues/1900
$(UNSTABLE): %: %.ts doit.ts $(TEST_FILES)
deno run --allow-read --allow-write --unstable $<
deno run --allow-read --allow-write --unstable --allow-env $<
.PHONY: stream
stream: stream.ts

View File

@ -8,7 +8,7 @@ headless browser is generally indistinguishable from a browser process.
## Chromium Automation with Puppeteer
[Puppeteer](https://npm.im/puppeteer) enables headless Chromium automation.
[Puppeteer](https://pptr.dev/) enables headless Chromium automation.
[`html.js`](./html.js) shows a dedicated script for converting an HTML file to
XLSB using puppeteer. The first argument is the path to the HTML file. The

View File

@ -9,9 +9,8 @@ This demo is available at <https://oss.sheetjs.com/sheetjs/x-spreadsheet.html>
## Obtaining the Library
The [`x-data-spreadsheet` module](http://npm.im/x-data-spreadsheet) includes a
minified script `dist/xspreadsheet.js` that can be directly inserted as a script
tag. The unpkg CDN also exposes the latest version:
The `x-data-spreadsheet` NodeJS packages include a minified script that can be
directly inserted as a script tag. The unpkg CDN also hosts this script:
```html
<script src="https://unpkg.com/x-data-spreadsheet/dist/xspreadsheet.js"></script>

View File

@ -12,14 +12,14 @@ xlsx.zahl.js: test.numbers reframe.node.js
bash -c ./reframe.sh
$(BAREJS): %.js: %.ts $(LIBFILES)
npx esbuild $< --outfile=$@ --platform=browser --target=es5
npx esbuild@0.14.14 $< --outfile=$@ --platform=browser --target=es5
%.node.js: %.node.ts $(LIBFILES) src/numbers.ts
npx esbuild $< --bundle --external:xlsx --outfile=$@ --platform=node
npx esbuild@0.14.14 $< --bundle --external:xlsx --outfile=$@ --platform=node
sed -i '' 's/ts-node/node/g' $@ || sed -i'' 's/ts-node/node/g' $@ || { echo "sed failed"; exit 1; }
%.js: %.ts $(LIBFILES)
npx esbuild $< --bundle --outfile=$@ --platform=browser --format=iife --global-name=$* --target=es5
npx esbuild@0.14.14 $< --bundle --outfile=$@ --platform=browser --format=iife --global-name=$* --target=es5
src/numbers.ts: 83_numbers.ts
cat $< | sed 's/^\/\/<<//g' > $@

View File

@ -6,14 +6,14 @@ ENTRIES=$(subst .ts,.js,$(TSFILES))
all: $(ENTRIES)
index.node.js: index.node.ts $(LIBFILES)
npx esbuild $< --bundle --outfile=$@ --platform=node --format=cjs
npx esbuild@0.14.14 $< --bundle --outfile=$@ --platform=node --format=cjs
%.node.js: %.node.ts $(LIBFILES)
npx esbuild $< --bundle --external:./ --outfile=$@ --platform=node
npx esbuild@0.14.14 $< --bundle --external:./ --outfile=$@ --platform=node
sed -i '' 's/ts-node/node/g' $@
%.js: %.ts $(LIBFILES)
npx esbuild $< --bundle --outfile=$@ --platform=browser --format=iife --global-name=$* --target=es5
npx esbuild@0.14.14 $< --bundle --outfile=$@ --platform=browser --format=iife --global-name=$* --target=es5
.PHONY: clean
clean:

1
tests/cpexcel.full.mjs generated Symbolic link
View File

@ -0,0 +1 @@
../dist/cpexcel.full.mjs

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>JS-XLSX Core Test Runner</title>
<title>SheetJS Core Test Runner</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="mocha.css" />
@ -13,17 +13,7 @@
</style>
</head>
<body>
<h1 id="t"><a href="http://sheetjs.com">JS-XLSX Browser-based Parsing Tests</a></h1>
<table id="tt">
<tr>
<th>File Formats</th>
<td><a href="http://github.com/SheetJS/js-xlsx">Library Source</a></td>
<td><a href="http://SheetJS.github.io/js-xls">Interactive Demo</a></td>
<td><a href="http://npm.im/xlsx">"xlsx" on npm</a></td>
<td><a href="https://travis-ci.org/SheetJS/js-xlsx">node CI status</a></td>
</tr>
<tr><td colspan="5">Tests compiled from <a href="http://github.com/SheetJS/test_files">test_files repo</a> and are located at /test_files<br /></td></tr>
</table>
<h1 id="t"><a href="https://sheetjs.com">SheetJS Browser-based File Tests</a></h1>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);
@ -39,11 +29,16 @@
<script src="base64.js"></script>
<script src="fs_.js"></script>
<script src="fixtures.js"></script>
<script src="cpexcel.js"></script>
<script type="module">
import * as XLSX from './xlsx.mjs';
if(typeof XLSX !== "undefined") globalThis.XLSX = XLSX;
else if(typeof globalThis !== "undefined" && !globalThis.XLSX) globalThis.XLSX = XLSX;
import * as cptable from './cpexcel.full.mjs';
XLSX.set_cptable(cptable);
import XLSX_ZAHL_PAYLOAD from './xlsx.zahl.mjs';
if(typeof XLSX_ZAHL_PAYLOAD !== "undefined") globalThis.XLSX_ZAHL_PAYLOAD = XLSX_ZAHL_PAYLOAD;
else if(typeof globalThis !== "undefined" && !globalThis.XLSX_ZAHL_PAYLOAD) globalThis.XLSX_ZAHL_PAYLOAD = XLSX_ZAHL_PAYLOAD;
//
</script>
<div id="mocha"></div>
<script src="mocha.js"></script>

1
tests/fixtures.js generated

File diff suppressed because one or more lines are too long

View File

@ -19,6 +19,7 @@ function require(s) {
switch(s) {
case 'fs': return fs;
case 'assert': return assert;
case './dist/xlsx.zahl': return XLSX_ZAHL_PAYLOAD;
case './': return XLSX;
}
if(s.slice(-5) == ".json") return JSON.parse(fs.readFileSync(s));

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>JS-XLSX Core Test Runner</title>
<title>SheetJS Core Test Runner</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="mocha.css" />
@ -13,17 +13,7 @@
</style>
</head>
<body>
<h1 id="t"><a href="http://sheetjs.com">JS-XLSX Browser-based Parsing Tests</a></h1>
<table id="tt">
<tr>
<th>File Formats</th>
<td><a href="http://github.com/SheetJS/js-xlsx">Library Source</a></td>
<td><a href="http://SheetJS.github.io/js-xls">Interactive Demo</a></td>
<td><a href="http://npm.im/xlsx">"xlsx" on npm</a></td>
<td><a href="https://travis-ci.org/SheetJS/js-xlsx">node CI status</a></td>
</tr>
<tr><td colspan="5">Tests compiled from <a href="http://github.com/SheetJS/test_files">test_files repo</a> and are located at /test_files<br /></td></tr>
</table>
<h1 id="t"><a href="https://sheetjs.com">SheetJS Browser-based File Tests</a></h1>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>JS-XLSX Core Test Runner</title>
<title>SheetJS Core Test Runner</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="mocha.css" />
@ -13,17 +13,7 @@
</style>
</head>
<body>
<h1 id="t"><a href="http://sheetjs.com">JS-XLSX Browser-based Parsing Tests</a></h1>
<table id="tt">
<tr>
<th>File Formats</th>
<td><a href="http://github.com/SheetJS/js-xlsx">Library Source</a></td>
<td><a href="http://SheetJS.github.io/js-xls">Interactive Demo</a></td>
<td><a href="http://npm.im/xlsx">"xlsx" on npm</a></td>
<td><a href="https://travis-ci.org/SheetJS/js-xlsx">node CI status</a></td>
</tr>
<tr><td colspan="5">Tests compiled from <a href="http://github.com/SheetJS/test_files">test_files repo</a> and are located at /test_files<br /></td></tr>
</table>
<h1 id="t"><a href="https://sheetjs.com">SheetJS Browser-based File Tests</a></h1>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);

View File

@ -132,6 +132,7 @@ var paths = {
dnsxml: dir + 'defined_names_simple.xml',
dnsxlsx: dir + 'defined_names_simple.xlsx',
dnsxlsb: dir + 'defined_names_simple.xlsb',
dnsslk: dir + 'defined_names_simple.slk',
dnuxls: dir + 'defined_names_unicode.xls',
dnuxml: dir + 'defined_names_unicode.xml',
@ -144,6 +145,8 @@ var paths = {
dtxlsx: dir + 'xlsx-stream-d-date-cell.xlsx',
dtxlsb: dir + 'xlsx-stream-d-date-cell.xlsb',
dtfxlsx: dir + 'DataTypesFormats.xlsx',
fstxls: dir + 'formula_stress_test.xls',
fstxml: dir + 'formula_stress_test.xls.xml',
fstxlsx: dir + 'formula_stress_test.xlsx',
@ -165,6 +168,9 @@ var paths = {
lonxls: dir + 'LONumbers.xls',
lonxlsx: dir + 'LONumbers.xlsx',
m19xlsx: dir + 'metadata_2019.xlsx',
m19xlsb: dir + 'metadata_2019.xlsb',
mcxls: dir + 'merge_cells.xls',
mcxml: dir + 'merge_cells.xls.xml',
mcxlsx: dir + 'merge_cells.xlsx',
@ -716,7 +722,6 @@ describe('output formats', function() {
if(T == 'string' && !fmt[2]) return assert.throws(function() {X.write(wb, {type: T, bookType:fmt[0], WTF:1});});
var out = X.write(wb, {type: T, bookType:fmt[0], WTF:1});
var nwb = X.read(out, {type: T, PRN: fmt[0] == 'prn', WTF:1});
console.log(T, fmt[0], nwb);
var nws = nwb.Sheets[nwb.SheetNames[0]];
assert.equal(get_cell(nws, "B2").v, 2);
assert.equal(get_cell(nws, "A1").v, "R");
@ -1149,11 +1154,14 @@ describe('parse features', function() {
].forEach(function(m) { it(m[0], function() {
var wb = X.read(fs.readFileSync(m[1]), {type:TYPE});
var names = wb.Workbook.Names;
if(m[0] != 'slk') {
for(var i = 0; i < names.length; ++i) if(names[i].Name == "SheetJS") break;
assert(i < names.length, "Missing name");
assert.equal(names[i].Sheet, null);
assert.equal(names[i].Ref, "Sheet1!$A$1");
if(m[2]) assert.equal(names[i].Comment, "defined names just suck excel formulae are bad MS should feel bad");
}
for(i = 0; i < names.length; ++i) if(names[i].Name == "SHEETjs") break;
assert(i < names.length, "Missing name");
@ -1339,6 +1347,20 @@ describe('parse features', function() {
});
});
});
describe('data types formats', function() {[
['xlsx', paths.dtfxlsx],
].forEach(function(m) { it(m[0], function() {
var wb = X.read(fs.readFileSync(m[1]), {type: TYPE, cellDates: true});
var ws = wb.Sheets[wb.SheetNames[0]];
var data = X.utils.sheet_to_json(ws, { header: 1, raw: true, rawNumbers: false });
assert(data[0][1] instanceof Date);
assert(data[1][1] instanceof Date);
assert.equal(data[2][1], '$123.00');
assert.equal(data[3][1], '98.76%');
assert.equal(data[4][1], '456.00');
assert.equal(data[5][1], '7,890');
}); }); });
});
describe('write features', function() {
@ -1526,6 +1548,22 @@ describe('roundtrip features', function() {
});
}); }); });
describe('should preserve dynamic array formulae', function() { [
['xlsx', paths.m19xlsx]
].forEach(function(w) { it(w[0], function() {
var wb1 = X.read(fs.readFileSync(w[1]), {xlfn: true, type:TYPE, cellFormula:true, WTF:1});
var wb2 = X.read(X.write(wb1, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B3").D, true);
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B13").D, true);
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "C13").D, true);
get_cell(wb2.Sheets.Sheet1, "B3").D = false;
var wb3 = X.read(X.write(wb2, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B3").D, false);
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B13").D, true);
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "C13").D, true);
}); }); });
describe('should preserve hyperlink', function() { [
['xlsx', paths.hlxlsx, true],
['xlsx', paths.ilxlsx, false],
@ -1642,6 +1680,8 @@ var password_files = [
];
describe('invalid files', function() {
describe('parse', function() { [
['KEY files', 'numbers/Untitled.key'],
['PAGES files', 'numbers/Untitled.pages'],
['password', 'apachepoi_password.xls'],
['passwords', 'apachepoi_xor-encryption-abc.xls'],
['DOC files', 'word_doc.doc']
@ -1759,6 +1799,30 @@ describe('json output', function() {
X.utils.sheet_to_json(ws, {raw:true});
X.utils.sheet_to_json(ws, {raw:true, defval: 'jimjin'});
});
it('should handle skipHidden for rows if requested', function() {
var ws2 = X.utils.aoa_to_sheet(data), json = X.utils.sheet_to_json(ws2);
assert.equal(json[0]["1"], true);
assert.equal(json[2]["3"], "qux");
ws2["!rows"] = [null,{hidden:true},null,null]; json = X.utils.sheet_to_json(ws2, {skipHidden: true});
assert.equal(json[0]["1"], "foo");
assert.equal(json[1]["3"], "qux");
});
it('should handle skipHidden for columns if requested', function() {
var ws2 = X.utils.aoa_to_sheet(data), json = X.utils.sheet_to_json(ws2);
assert.equal(json[1]["2"], "bar");
assert.equal(json[2]["3"], "qux");
ws2["!cols"] = [null,{hidden:true},null,null]; json = X.utils.sheet_to_json(ws2, {skipHidden: 1});
assert.equal(json[1]["2"], void 0);
assert.equal(json[2]["3"], "qux");
});
it('should handle skipHidden when first row is hidden', function() {
var ws2 = X.utils.aoa_to_sheet(data), json = X.utils.sheet_to_json(ws2);
assert.equal(json[0]["1"], true);
assert.equal(json[2]["3"], "qux");
ws2["!rows"] = [{hidden:true},null,null,null]; json = X.utils.sheet_to_json(ws2, {skipHidden: 1});
assert.equal(json[1]["1"], "foo");
assert.equal(json[2]["3"], "qux");
});
it('should disambiguate headers', function() {
var _data = [["S","h","e","e","t","J","S"],[1,2,3,4,5,6,7],[2,3,4,5,6,7,8]];
var _ws = X.utils.aoa_to_sheet(_data);
@ -2058,6 +2122,19 @@ describe.skip('sylk', function() {
}
} : null);
});
describe('date system', function() {
function make_slk(d1904) { return "ID;PSheetJS\nP;Pd\\/m\\/yy\nP;Pd\\/m\\/yyyy\n" + (d1904 != null ? "O;D;V" + d1904 : "") + "\nF;P0;FG0G;X1;Y1\nC;K1\nE"; }
it('should default to 1900', function() {
assert.equal(get_cell(X.read(make_slk(), {type: "binary"}).Sheets.Sheet1, "A1").v, 1);
assert(get_cell(X.read(make_slk(), {type: "binary", cellDates: true}).Sheets.Sheet1, "A1").v.getFullYear() < 1902);
assert.equal(get_cell(X.read(make_slk(5), {type: "binary"}).Sheets.Sheet1, "A1").v, 1);
assert(get_cell(X.read(make_slk(5), {type: "binary", cellDates: true}).Sheets.Sheet1, "A1").v.getFullYear() < 1902);
});
it('should use 1904 when specified', function() {
assert(get_cell(X.read(make_slk(1), {type: "binary", cellDates: true}).Sheets.Sheet1, "A1").v.getFullYear() > 1902);
assert(get_cell(X.read(make_slk(4), {type: "binary", cellDates: true}).Sheets.Sheet1, "A1").v.getFullYear() > 1902);
});
});
});
(typeof Uint8Array !== "undefined" ? describe.skip : describe.skip)('numbers', function() {
@ -2070,6 +2147,16 @@ describe.skip('sylk', function() {
assert.equal(get_cell(ws, "B11").v, true);
assert.equal(get_cell(ws, "B13").v, 50);
});
it('should cap cols at 1000 (ALL)', function() {
var aoa = [[1], [], []]; aoa[1][999] = 2; aoa[2][1000] = 3;
var ws1 = X.utils.aoa_to_sheet(aoa);
var wb1 = X.utils.book_new(); X.utils.book_append_sheet(wb1, ws1, "Sheet1");
var wb2 = X.read(X.write(wb1,{bookType:"numbers",type:'binary',numbers:XLSX_ZAHL}),{type:'binary'});
var ws2 = wb2.Sheets.Sheet1;
assert.equal(ws2["!ref"], "A1:ALL3");
assert.equal(get_cell(ws2, "A1").v, 1);
assert.equal(get_cell(ws2, "ALL2").v, 2);
});
});
if(fs.existsSync(dir + 'dbf/d11.dbf')) describe.skip('dbf', function() {
@ -2222,6 +2309,20 @@ describe('HTML', function() {
assert.equal(X.utils.sheet_to_csv(ws), "A,B\n1,2\n3,4\n4,6");
});
});
describe.skip('empty cell containing html element should increment cell index', function() {
var html = "<table><tr><td>abc</td><td><b> </b></td><td>def</td></tr></table>";
var expectedCellCount = 3;
it('HTML string', function() {
var ws = X.read(html, {type:'string'}).Sheets.Sheet1;
var range = X.utils.decode_range(ws['!ref']);
assert.equal(range.e.c,expectedCellCount - 1);
});
if(domtest) it('DOM', function() {
var ws = X.utils.table_to_sheet(get_dom_element(html));
var range = X.utils.decode_range(ws['!ref']);
assert.equal(range.e.c, expectedCellCount - 1);
});
});
});
describe('js -> file -> js', function() {
@ -2356,7 +2457,7 @@ describe('corner cases', function() {
//assert.equal(d.y, 2018);
}
[true, false].forEach(function(cD) {
[null, 'yyyy-mm-dd'].forEach(function(dNF) {
[void 0, 'yyyy-mm-dd'].forEach(function(dNF) {
var ws1 = X.read(
'7,2018-03-24',
{cellDates: cD, dateNF: dNF, type:'string'}
@ -2370,6 +2471,86 @@ describe('corner cases', function() {
});
});
});
it('should handle \\r and \\n', function() {
var base = "./test_files/crlf/";
[
"crlf.csv",
"crlf.ods",
"crlf.xlsx"
].map(function(path) { return base + path; }).forEach(function(w) {
var wb = X.read(fs.readFileSync(w), {type:TYPE});
var ws = wb.Sheets[wb.SheetNames[0]];
var B1 = get_cell(ws, "B1"), B2 = get_cell(ws, "B2");
var lio = w.match(/\.[^\.]*$/).index, stem = w.slice(0, lio).toLowerCase(), ext = w.slice(lio + 1).toLowerCase()
switch(ext) {
case 'fm3': break;
case '123':
assert.equal(B1.v, "abc\ndef");
// TODO: parse formula // assert.equal(B1.v, "abc\r\ndef");
break;
case 'qpw':
case 'wb1':
case 'wb2':
case 'wb3':
case 'wk1':
case 'wk3':
case 'wk4':
case 'wq1':
assert(B1.v == "abcdef" || B1.v == "abc\ndef");
// TODO: formula -> string values
if(B2 && B2.t != "e" && B2.v != "") assert(B2.v == "abcdef" || B2.v == "abc\r\ndef");
break;
case 'wks':
if(stem.match(/w4/)) {
assert.equal(B1.v, "abc\ndef");
assert(!B2 || B2.t == "z"); // Works4 did not support CODE / CHAR
} else if(stem.match(/q9/)) {
assert.equal(B1.v, "abcdef");
assert.equal(B2.v, "abc\r\ndef");
} else {
assert.equal(B1.v, "abc\ndef");
assert.equal(B2.v, "abc\r\ndef");
}
break;
case 'xls':
if(stem.match(/CRLFR9/i)) {
assert.equal(B1.v, "abc\r\ndef");
} else {
assert.equal(B1.v, "abc\ndef");
}
assert.equal(B2.v, "abc\r\ndef");
break;
case 'rtf':
case 'htm':
assert.equal(B1.v, "abc\ndef");
assert.equal(B2.v, "abc\n\ndef");
break;
case 'xlsx':
case 'xlsb':
case 'xml':
case 'slk':
case 'csv':
assert.equal(B1.v, "abc\ndef");
assert.equal(B2.v, "abc\r\ndef");
break;
case 'fods':
case 'ods':
assert.equal(B1.v, "abc\nDef");
assert.equal(B2.v, "abc\r\ndef");
break;
case 'numbers':
assert.equal(B1.v, "abc\ndef");
// TODO: B2 should be a formula error
break;
default: throw ext;
}
});
});
});
describe.skip('encryption', function() {

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>JS-XLSX Core Test Runner</title>
<title>SheetJS Core Test Runner</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="mocha.css" />
@ -13,17 +13,7 @@
</style>
</head>
<body>
<h1 id="t"><a href="http://sheetjs.com">JS-XLSX Browser-based Parsing Tests</a></h1>
<table id="tt">
<tr>
<th>File Formats</th>
<td><a href="http://github.com/SheetJS/js-xlsx">Library Source</a></td>
<td><a href="http://SheetJS.github.io/js-xls">Interactive Demo</a></td>
<td><a href="http://npm.im/xlsx">"xlsx" on npm</a></td>
<td><a href="https://travis-ci.org/SheetJS/js-xlsx">node CI status</a></td>
</tr>
<tr><td colspan="5">Tests compiled from <a href="http://github.com/SheetJS/test_files">test_files repo</a> and are located at /test_files<br /></td></tr>
</table>
<h1 id="t"><a href="https://sheetjs.com">SheetJS Browser-based File Tests</a></h1>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);

1
tests/xlsx.zahl.mjs generated Symbolic link
View File

@ -0,0 +1 @@
../dist/xlsx.zahl.mjs