2011-04-19 20:35:33 +02:00
|
|
|
// DATA_TEMPLATE: empty_table
|
|
|
|
oTest.fnStart( "aoColumns.sTitle" );
|
|
|
|
|
|
|
|
$(document).ready( function () {
|
|
|
|
/* Check the default */
|
|
|
|
var oTable = $('#example').dataTable( {
|
|
|
|
"sAjaxSource": "../../../examples/ajax/sources/objects.txt",
|
|
|
|
"aoColumns": [
|
2011-04-23 11:38:00 +02:00
|
|
|
{ "mDataProp": "engine" },
|
|
|
|
{ "mDataProp": "browser" },
|
|
|
|
{ "mDataProp": "platform" },
|
|
|
|
{ "mDataProp": "version" },
|
|
|
|
{ "mDataProp": "grade" }
|
2011-04-19 20:35:33 +02:00
|
|
|
]
|
|
|
|
} );
|
|
|
|
var oSettings = oTable.fnSettings();
|
|
|
|
|
|
|
|
oTest.fnWaitTest(
|
|
|
|
"If not given, then the columns titles are empty",
|
|
|
|
null,
|
|
|
|
function () {
|
|
|
|
var jqNodes = $('#example thead tr:eq(0) th');
|
|
|
|
var bReturn =
|
|
|
|
jqNodes[0].innerHTML == "Rendering engine" &&
|
|
|
|
jqNodes[1].innerHTML == "Browser" &&
|
|
|
|
jqNodes[2].innerHTML == "Platform(s)" &&
|
|
|
|
jqNodes[3].innerHTML == "Engine version" &&
|
|
|
|
jqNodes[4].innerHTML == "CSS grade";
|
|
|
|
return bReturn;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
oTest.fnWaitTest(
|
|
|
|
"Can set a single column title - and others are read from DOM",
|
|
|
|
function () {
|
|
|
|
oSession.fnRestore();
|
|
|
|
$('#example').dataTable( {
|
|
|
|
"sAjaxSource": "../../../examples/ajax/sources/objects.txt",
|
|
|
|
"aoColumns": [
|
2011-04-23 11:38:00 +02:00
|
|
|
{ "mDataProp": "engine" },
|
|
|
|
{ "mDataProp": "browser", "sTitle": 'unit test' },
|
|
|
|
{ "mDataProp": "platform" },
|
|
|
|
{ "mDataProp": "version" },
|
|
|
|
{ "mDataProp": "grade" }
|
2011-04-19 20:35:33 +02:00
|
|
|
]
|
|
|
|
} );
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
var jqNodes = $('#example thead tr:eq(0) th');
|
|
|
|
var bReturn =
|
|
|
|
jqNodes[0].innerHTML == "Rendering engine" &&
|
|
|
|
jqNodes[1].innerHTML == "unit test" &&
|
|
|
|
jqNodes[2].innerHTML == "Platform(s)" &&
|
|
|
|
jqNodes[3].innerHTML == "Engine version" &&
|
|
|
|
jqNodes[4].innerHTML == "CSS grade";
|
|
|
|
return bReturn;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
oTest.fnWaitTest(
|
|
|
|
"Can set multiple column titles",
|
|
|
|
function () {
|
|
|
|
oSession.fnRestore();
|
|
|
|
$('#example').dataTable( {
|
|
|
|
"sAjaxSource": "../../../examples/ajax/sources/objects.txt",
|
|
|
|
"aoColumns": [
|
2011-04-23 11:38:00 +02:00
|
|
|
{ "mDataProp": "engine" },
|
|
|
|
{ "mDataProp": "browser", "sTitle": 'unit test 1' },
|
|
|
|
{ "mDataProp": "platform" },
|
|
|
|
{ "mDataProp": "version" },
|
|
|
|
{ "mDataProp": "grade", "sTitle": 'unit test 2' }
|
2011-04-19 20:35:33 +02:00
|
|
|
]
|
|
|
|
} );
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
var jqNodes = $('#example thead tr:eq(0) th');
|
|
|
|
var bReturn =
|
|
|
|
jqNodes[0].innerHTML == "Rendering engine" &&
|
|
|
|
jqNodes[1].innerHTML == "unit test 1" &&
|
|
|
|
jqNodes[2].innerHTML == "Platform(s)" &&
|
|
|
|
jqNodes[3].innerHTML == "Engine version" &&
|
|
|
|
jqNodes[4].innerHTML == "unit test 2";
|
|
|
|
return bReturn;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
oTest.fnComplete();
|
|
|
|
} );
|