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
|
describe('join()', function() {
dt.libs({
js: ['jquery', 'datatables'],
css: ['datatables']
});
let table;
describe('Check the defaults', function() {
dt.html('basic');
it('Exists and is a function', function() {
table = $('#example').DataTable();
expect(typeof table.join).toBe('function');
});
it('Returns string', function() {
expect(
typeof table
.column(0)
.data()
.join(' ')
).toBe('string');
});
});
describe('Functional tests', function() {
dt.html('basic');
it('Joining 1d data', function() {
table = $('#example').DataTable();
let data = table
.row(2)
.data()
.join(' X ');
expect(data).toBe('Ashton Cox X Junior Technical Author X San Francisco X 66 X 2009/01/12 X $86,000');
});
it('Joining 2d data', function() {
let count = 0;
let data = table
.rows([0, 2])
.data()
.join(' X ');
expect(data).toBe(
'Tiger Nixon,System Architect,Edinburgh,61,2011/04/25,$320,800 X Ashton Cox,Junior Technical Author,San Francisco,66,2009/01/12,$86,000'
);
});
});
});
|