Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: handle null table container",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "biukam.w@gmail.com"
}
10 changes: 10 additions & 0 deletions packages/vtable/__tests__/options/listTable-null-container.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-nocheck
import { ListTable } from '../../src';

global.__VERSION__ = 'none';

describe('ListTable null container', () => {
test('throws a clear error when the container argument is null', () => {
expect(() => new ListTable(null, { columns: [] })).toThrow("vtable's container is undefined");
});
});
2 changes: 1 addition & 1 deletion packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
if (Env.mode === 'node') {
options = container as BaseTableConstructorOptions;
container = null;
} else if (!(container instanceof HTMLElement)) {
} else if (container && !(container instanceof HTMLElement)) {
options = container as BaseTableConstructorOptions;
if ((container as BaseTableConstructorOptions).container) {
container = (container as BaseTableConstructorOptions).container;
Expand Down
Loading