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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
// This is the common bit that gets pasted onto the end
let table;
let columns = 30;
let rows = 2500;
let runs = 15;
it('Create the table', function() {
let header = '';
for (let i = 0; i < columns; i++) {
header += '<th>' + i + '</th>';
}
$('#example').append('<thead><tr>' + header + '</tr></thead>');
let data = [];
for (let i = 0; i < rows; i++) {
let line = [];
for (j = 0; j < columns; j++) {
line.push(i + '-' + j);
}
data.push(line);
}
table = $('#example').DataTable({
data: data
});
expect(table.page.info().recordsTotal).toBe(rows);
});
// Repeat the tests
for (let i = 0; i < runs; i++) {
it('Do something in the browser', function() {
table.order([0, 'desc']).draw();
});
it('Cells - order [' + i + ']', function() {
var rowIndexes = table
.rows(null, { order: 'applied' })
.indexes()
.toArray();
var cells = table.cells(rowIndexes, null, { order: 'applied' });
expect(table.page.info().recordsTotal).toBe(rows);
});
it('Do something in the browser to stop timeout', function() {
table.order([0, 'asc']).draw();
});
it('Cells - search [' + i + ']', function() {
var rowIndexes = table
.rows(null, { order: 'applied' })
.indexes()
.toArray();
var cells = table.cells(rowIndexes, null, { search: 'applied' });
expect(table.page.info().recordsTotal).toBe(rows);
});
it('Do something in the browser to stop timeout', function() {
table.order([0, 'desc']).draw();
});
it('Columns [' + i + ']', function() {
var columnIndexes = table
.columns({ order: 'applied' })
.indexes()
.toArray();
var cells = table.cells(columnIndexes, null, { order: 'applied' });
expect(table.page.info().recordsTotal).toBe(rows);
});
it('Do something in the browser', function() {
table.order([0, 'asc']).draw();
});
}
});
|