chore: fix tests

This commit is contained in:
Gregor Kleen 2020-05-05 15:16:42 +02:00
parent c348b7cb03
commit 53ec21de25
2 changed files with 4 additions and 7 deletions

View File

@ -33,8 +33,6 @@ export class AsyncTable {
_asyncTableHeader;
_asyncTableId;
_asyncTableIdent;
_ths = [];
_pageLinks = [];
_pagesizeForm;
@ -86,14 +84,12 @@ export class AsyncTable {
this._cssIdPrefix = findCssIdPrefix(rawTableId);
this._asyncTableId = rawTableId.replace(this._cssIdPrefix, '');
this._asyncTableIdent = this._asyncTableId.replace(/-table-wrapper$/, '');
if (!this._asyncTableIdent) {
if (!this._asyncTableId) {
throw new Error('Async Table cannot be set up without an ident!');
}
this._windowStorage = new StorageManager([ASYNC_TABLE_STORAGE_KEY, this._asyncTableIdent], ASYNC_TABLE_STORAGE_VERSION, { location: LOCATION.WINDOW });
this._historyStorage = new StorageManager([ASYNC_TABLE_STORAGE_KEY, this._asyncTableIdent], ASYNC_TABLE_STORAGE_VERSION, { location: LOCATION.HISTORY });
this._windowStorage = new StorageManager([ASYNC_TABLE_STORAGE_KEY, this._asyncTableId], ASYNC_TABLE_STORAGE_VERSION, { location: LOCATION.WINDOW });
this._historyStorage = new StorageManager([ASYNC_TABLE_STORAGE_KEY, this._asyncTableId], ASYNC_TABLE_STORAGE_VERSION, { location: LOCATION.HISTORY });
// find scrolltable wrapper
this._scrollTable = this._element.querySelector(ASYNC_TABLE_SCROLLTABLE_SELECTOR);

View File

@ -20,6 +20,7 @@ describe('AsyncTable', () => {
const element = document.createElement('div');
const scrollTable = document.createElement('div');
const table = document.createElement('table');
table.id = 'ident';
scrollTable.classList.add('scrolltable');
scrollTable.appendChild(table);
element.appendChild(scrollTable);