comparison default/node_modules/tablesaw/test/main.test.js @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 import test from 'ava';
2 // import "console-advanced";
3 import Tablesaw from '../dist/tablesaw.js';
4
5 test('Tablesaw, DOM lib exists', t => {
6 t.is(typeof Tablesaw, "object");
7 t.is(typeof Tablesaw.$, "function");
8 t.not(typeof Tablesaw.Table, "undefined");
9 t.not(typeof Tablesaw.Stack, "undefined");
10 t.not(typeof Tablesaw.ColumnToggle, "undefined");
11 // t.not(typeof Tablesaw.Sortable, "undefined"); // TODO
12 // t.not(typeof Tablesaw.ModeSwitch, "undefined"); // TODO
13 t.not(typeof Tablesaw.MiniMap, "undefined");
14 // t.not(typeof Tablesaw.Btn, "undefined"); // TODO
15 t.not(typeof Tablesaw.CheckAll, "undefined");
16 });
17
18 test('MiniMap.show returns false when attribute is not set', t => {
19 var table = document.createElement( "table" );
20 t.is(Tablesaw.MiniMap.show(table), false);
21 });
22
23 test('MiniMap.show returns true when attribute is set (but value-less)', t => {
24 var table = document.createElement( "table" );
25 table.setAttribute( Tablesaw.MiniMap.attr.init, "" );
26 t.is(Tablesaw.MiniMap.show(table), true);
27 });