1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
describe('tables - table().body()', function() {
dt.libs({
js: ['jquery', 'datatables'],
css: ['datatables']
});
describe('Check the defaults', function() {
dt.html('basic');
let table;
it('Exists and is a function', function() {
table = $('#example').DataTable();
expect(typeof table.table().body).toBe('function');
});
it('Returns a body node', function() {
let body = table.table().body();
expect(body instanceof HTMLElement).toBe(true);
expect(body.nodeName.toUpperCase()).toBe('TBODY');
});
});
describe('Functional tests', function() {
dt.html('basic');
it('Returns the correct element', function() {
let table = $('#example').DataTable();
$(table.table().body()).addClass('unitTest');
expect($('#example tbody').hasClass('unitTest')).toBe(true);
});
});
});
|