Is there anyway to test callback method of jQuery datatable in Angular 6 using karma/jasmine?
I want to test following method's footer callback but I can't figure out any way to do so. I am new in unit testing and cannot finding anything helpful on web.
initializeBugIndexPageSetting() {
let self = this;
$('example').DataTable({
'footerCallback': function (row, data, start, end, display) {
const api = this.api();
// Remove the formatting to get integer data for summation
const intVal = function (i) {
if (i === 'N/A') {
return 0;
}
return i * 1;
};
// Total over this page
const pageInProgrssToResolved = api
.column(14, { page: 'current' })
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
const pageCount = api
.column(5, { page: 'current' })
.data().count();
// Update footer
$(api.column(14).footer()).html((pageInProgrssToResolved / pageCount).toFixed(2));
}
});
}
Little help and guidance.
from Unit test of jQuery datatable's callback method in Angular 6
No comments:
Post a Comment