| 1 |
// DATA_TEMPLATE: empty_table |
| 2 |
oTest.fnStart( "Sanity checks for DataTables with data from JS - Object data source" ); |
| 3 |
|
| 4 |
oTest.fnTest( |
| 5 |
"jQuery.dataTable function", |
| 6 |
null, |
| 7 |
function () { return typeof jQuery().dataTable == "function"; } |
| 8 |
); |
| 9 |
|
| 10 |
oTest.fnTest( |
| 11 |
"jQuery.dataTableSettings storage array", |
| 12 |
null, |
| 13 |
function () { return typeof jQuery().dataTableSettings == "object"; } |
| 14 |
); |
| 15 |
|
| 16 |
oTest.fnTest( |
| 17 |
"jQuery.dataTableExt plugin object", |
| 18 |
null, |
| 19 |
function () { return typeof jQuery().dataTableExt == "object"; } |
| 20 |
); |
| 21 |
|
| 22 |
$(document).ready( function () { |
| 23 |
var oInit = { |
| 24 |
"aoColumns": [ |
| 25 |
{ "mData": "engine" }, |
| 26 |
{ "mData": "browser" }, |
| 27 |
{ "mData": "platform" }, |
| 28 |
{ "mData": "version" }, |
| 29 |
{ "mData": "grade" } |
| 30 |
], |
| 31 |
"aaData": [ |
| 32 |
{ |
| 33 |
"engine": "Trident", |
| 34 |
"browser": "Internet Explorer 4.0", |
| 35 |
"platform": "Win 95+", |
| 36 |
"version": "4", |
| 37 |
"grade": "X" |
| 38 |
}, |
| 39 |
{ |
| 40 |
"engine": "Trident", |
| 41 |
"browser": "Internet Explorer 5.0", |
| 42 |
"platform": "Win 95+", |
| 43 |
"version": "5", |
| 44 |
"grade": "C" |
| 45 |
}, |
| 46 |
{ |
| 47 |
"engine": "Trident", |
| 48 |
"browser": "Internet Explorer 5.5", |
| 49 |
"platform": "Win 95+", |
| 50 |
"version": "5.5", |
| 51 |
"grade": "A" |
| 52 |
}, |
| 53 |
{ |
| 54 |
"engine": "Trident", |
| 55 |
"browser": "Internet Explorer 6", |
| 56 |
"platform": "Win 98+", |
| 57 |
"version": "6", |
| 58 |
"grade": "A" |
| 59 |
}, |
| 60 |
{ |
| 61 |
"engine": "Trident", |
| 62 |
"browser": "Internet Explorer 7", |
| 63 |
"platform": "Win XP SP2+", |
| 64 |
"version": "7", |
| 65 |
"grade": "A" |
| 66 |
}, |
| 67 |
{ |
| 68 |
"engine": "Trident", |
| 69 |
"browser": "AOL browser (AOL desktop)", |
| 70 |
"platform": "Win XP", |
| 71 |
"version": "6", |
| 72 |
"grade": "A" |
| 73 |
}, |
| 74 |
{ |
| 75 |
"engine": "Gecko", |
| 76 |
"browser": "Firefox 1.0", |
| 77 |
"platform": "Win 98+ / OSX.2+", |
| 78 |
"version": "1.7", |
| 79 |
"grade": "A" |
| 80 |
}, |
| 81 |
{ |
| 82 |
"engine": "Gecko", |
| 83 |
"browser": "Firefox 1.5", |
| 84 |
"platform": "Win 98+ / OSX.2+", |
| 85 |
"version": "1.8", |
| 86 |
"grade": "A" |
| 87 |
}, |
| 88 |
{ |
| 89 |
"engine": "Gecko", |
| 90 |
"browser": "Firefox 2.0", |
| 91 |
"platform": "Win 98+ / OSX.2+", |
| 92 |
"version": "1.8", |
| 93 |
"grade": "A" |
| 94 |
}, |
| 95 |
{ |
| 96 |
"engine": "Gecko", |
| 97 |
"browser": "Firefox 3.0", |
| 98 |
"platform": "Win 2k+ / OSX.3+", |
| 99 |
"version": "1.9", |
| 100 |
"grade": "A" |
| 101 |
}, |
| 102 |
{ |
| 103 |
"engine": "Gecko", |
| 104 |
"browser": "Camino 1.0", |
| 105 |
"platform": "OSX.2+", |
| 106 |
"version": "1.8", |
| 107 |
"grade": "A" |
| 108 |
}, |
| 109 |
{ |
| 110 |
"engine": "Gecko", |
| 111 |
"browser": "Camino 1.5", |
| 112 |
"platform": "OSX.3+", |
| 113 |
"version": "1.8", |
| 114 |
"grade": "A" |
| 115 |
}, |
| 116 |
{ |
| 117 |
"engine": "Gecko", |
| 118 |
"browser": "Netscape 7.2", |
| 119 |
"platform": "Win 95+ / Mac OS 8.6-9.2", |
| 120 |
"version": "1.7", |
| 121 |
"grade": "A" |
| 122 |
}, |
| 123 |
{ |
| 124 |
"engine": "Gecko", |
| 125 |
"browser": "Netscape Browser 8", |
| 126 |
"platform": "Win 98SE+", |
| 127 |
"version": "1.7", |
| 128 |
"grade": "A" |
| 129 |
}, |
| 130 |
{ |
| 131 |
"engine": "Gecko", |
| 132 |
"browser": "Netscape Navigator 9", |
| 133 |
"platform": "Win 98+ / OSX.2+", |
| 134 |
"version": "1.8", |
| 135 |
"grade": "A" |
| 136 |
}, |
| 137 |
{ |
| 138 |
"engine": "Gecko", |
| 139 |
"browser": "Mozilla 1.0", |
| 140 |
"platform": "Win 95+ / OSX.1+", |
| 141 |
"version": "1", |
| 142 |
"grade": "A" |
| 143 |
}, |
| 144 |
{ |
| 145 |
"engine": "Gecko", |
| 146 |
"browser": "Mozilla 1.1", |
| 147 |
"platform": "Win 95+ / OSX.1+", |
| 148 |
"version": "1.1", |
| 149 |
"grade": "A" |
| 150 |
}, |
| 151 |
{ |
| 152 |
"engine": "Gecko", |
| 153 |
"browser": "Mozilla 1.2", |
| 154 |
"platform": "Win 95+ / OSX.1+", |
| 155 |
"version": "1.2", |
| 156 |
"grade": "A" |
| 157 |
}, |
| 158 |
{ |
| 159 |
"engine": "Gecko", |
| 160 |
"browser": "Mozilla 1.3", |
| 161 |
"platform": "Win 95+ / OSX.1+", |
| 162 |
"version": "1.3", |
| 163 |
"grade": "A" |
| 164 |
}, |
| 165 |
{ |
| 166 |
"engine": "Gecko", |
| 167 |
"browser": "Mozilla 1.4", |
| 168 |
"platform": "Win 95+ / OSX.1+", |
| 169 |
"version": "1.4", |
| 170 |
"grade": "A" |
| 171 |
}, |
| 172 |
{ |
| 173 |
"engine": "Gecko", |
| 174 |
"browser": "Mozilla 1.5", |
| 175 |
"platform": "Win 95+ / OSX.1+", |
| 176 |
"version": "1.5", |
| 177 |
"grade": "A" |
| 178 |
}, |
| 179 |
{ |
| 180 |
"engine": "Gecko", |
| 181 |
"browser": "Mozilla 1.6", |
| 182 |
"platform": "Win 95+ / OSX.1+", |
| 183 |
"version": "1.6", |
| 184 |
"grade": "A" |
| 185 |
}, |
| 186 |
{ |
| 187 |
"engine": "Gecko", |
| 188 |
"browser": "Mozilla 1.7", |
| 189 |
"platform": "Win 98+ / OSX.1+", |
| 190 |
"version": "1.7", |
| 191 |
"grade": "A" |
| 192 |
}, |
| 193 |
{ |
| 194 |
"engine": "Gecko", |
| 195 |
"browser": "Mozilla 1.8", |
| 196 |
"platform": "Win 98+ / OSX.1+", |
| 197 |
"version": "1.8", |
| 198 |
"grade": "A" |
| 199 |
}, |
| 200 |
{ |
| 201 |
"engine": "Gecko", |
| 202 |
"browser": "Seamonkey 1.1", |
| 203 |
"platform": "Win 98+ / OSX.2+", |
| 204 |
"version": "1.8", |
| 205 |
"grade": "A" |
| 206 |
}, |
| 207 |
{ |
| 208 |
"engine": "Gecko", |
| 209 |
"browser": "Epiphany 2.20", |
| 210 |
"platform": "Gnome", |
| 211 |
"version": "1.8", |
| 212 |
"grade": "A" |
| 213 |
}, |
| 214 |
{ |
| 215 |
"engine": "Webkit", |
| 216 |
"browser": "Safari 1.2", |
| 217 |
"platform": "OSX.3", |
| 218 |
"version": "125.5", |
| 219 |
"grade": "A" |
| 220 |
}, |
| 221 |
{ |
| 222 |
"engine": "Webkit", |
| 223 |
"browser": "Safari 1.3", |
| 224 |
"platform": "OSX.3", |
| 225 |
"version": "312.8", |
| 226 |
"grade": "A" |
| 227 |
}, |
| 228 |
{ |
| 229 |
"engine": "Webkit", |
| 230 |
"browser": "Safari 2.0", |
| 231 |
"platform": "OSX.4+", |
| 232 |
"version": "419.3", |
| 233 |
"grade": "A" |
| 234 |
}, |
| 235 |
{ |
| 236 |
"engine": "Webkit", |
| 237 |
"browser": "Safari 3.0", |
| 238 |
"platform": "OSX.4+", |
| 239 |
"version": "522.1", |
| 240 |
"grade": "A" |
| 241 |
}, |
| 242 |
{ |
| 243 |
"engine": "Webkit", |
| 244 |
"browser": "OmniWeb 5.5", |
| 245 |
"platform": "OSX.4+", |
| 246 |
"version": "420", |
| 247 |
"grade": "A" |
| 248 |
}, |
| 249 |
{ |
| 250 |
"engine": "Webkit", |
| 251 |
"browser": "iPod Touch / iPhone", |
| 252 |
"platform": "iPod", |
| 253 |
"version": "420.1", |
| 254 |
"grade": "A" |
| 255 |
}, |
| 256 |
{ |
| 257 |
"engine": "Webkit", |
| 258 |
"browser": "S60", |
| 259 |
"platform": "S60", |
| 260 |
"version": "413", |
| 261 |
"grade": "A" |
| 262 |
}, |
| 263 |
{ |
| 264 |
"engine": "Presto", |
| 265 |
"browser": "Opera 7.0", |
| 266 |
"platform": "Win 95+ / OSX.1+", |
| 267 |
"version": "-", |
| 268 |
"grade": "A" |
| 269 |
}, |
| 270 |
{ |
| 271 |
"engine": "Presto", |
| 272 |
"browser": "Opera 7.5", |
| 273 |
"platform": "Win 95+ / OSX.2+", |
| 274 |
"version": "-", |
| 275 |
"grade": "A" |
| 276 |
}, |
| 277 |
{ |
| 278 |
"engine": "Presto", |
| 279 |
"browser": "Opera 8.0", |
| 280 |
"platform": "Win 95+ / OSX.2+", |
| 281 |
"version": "-", |
| 282 |
"grade": "A" |
| 283 |
}, |
| 284 |
{ |
| 285 |
"engine": "Presto", |
| 286 |
"browser": "Opera 8.5", |
| 287 |
"platform": "Win 95+ / OSX.2+", |
| 288 |
"version": "-", |
| 289 |
"grade": "A" |
| 290 |
}, |
| 291 |
{ |
| 292 |
"engine": "Presto", |
| 293 |
"browser": "Opera 9.0", |
| 294 |
"platform": "Win 95+ / OSX.3+", |
| 295 |
"version": "-", |
| 296 |
"grade": "A" |
| 297 |
}, |
| 298 |
{ |
| 299 |
"engine": "Presto", |
| 300 |
"browser": "Opera 9.2", |
| 301 |
"platform": "Win 88+ / OSX.3+", |
| 302 |
"version": "-", |
| 303 |
"grade": "A" |
| 304 |
}, |
| 305 |
{ |
| 306 |
"engine": "Presto", |
| 307 |
"browser": "Opera 9.5", |
| 308 |
"platform": "Win 88+ / OSX.3+", |
| 309 |
"version": "-", |
| 310 |
"grade": "A" |
| 311 |
}, |
| 312 |
{ |
| 313 |
"engine": "Presto", |
| 314 |
"browser": "Opera for Wii", |
| 315 |
"platform": "Wii", |
| 316 |
"version": "-", |
| 317 |
"grade": "A" |
| 318 |
}, |
| 319 |
{ |
| 320 |
"engine": "Presto", |
| 321 |
"browser": "Nokia N800", |
| 322 |
"platform": "N800", |
| 323 |
"version": "-", |
| 324 |
"grade": "A" |
| 325 |
}, |
| 326 |
{ |
| 327 |
"engine": "Presto", |
| 328 |
"browser": "Nintendo DS browser", |
| 329 |
"platform": "Nintendo DS", |
| 330 |
"version": "8.5", |
| 331 |
"grade": "C/A<sup>1</sup>" |
| 332 |
}, |
| 333 |
{ |
| 334 |
"engine": "KHTML", |
| 335 |
"browser": "Konqureror 3.1", |
| 336 |
"platform": "KDE 3.1", |
| 337 |
"version": "3.1", |
| 338 |
"grade": "C" |
| 339 |
}, |
| 340 |
{ |
| 341 |
"engine": "KHTML", |
| 342 |
"browser": "Konqureror 3.3", |
| 343 |
"platform": "KDE 3.3", |
| 344 |
"version": "3.3", |
| 345 |
"grade": "A" |
| 346 |
}, |
| 347 |
{ |
| 348 |
"engine": "KHTML", |
| 349 |
"browser": "Konqureror 3.5", |
| 350 |
"platform": "KDE 3.5", |
| 351 |
"version": "3.5", |
| 352 |
"grade": "A" |
| 353 |
}, |
| 354 |
{ |
| 355 |
"engine": "Tasman", |
| 356 |
"browser": "Internet Explorer 4.5", |
| 357 |
"platform": "Mac OS 8-9", |
| 358 |
"version": "-", |
| 359 |
"grade": "X" |
| 360 |
}, |
| 361 |
{ |
| 362 |
"engine": "Tasman", |
| 363 |
"browser": "Internet Explorer 5.1", |
| 364 |
"platform": "Mac OS 7.6-9", |
| 365 |
"version": "1", |
| 366 |
"grade": "C" |
| 367 |
}, |
| 368 |
{ |
| 369 |
"engine": "Tasman", |
| 370 |
"browser": "Internet Explorer 5.2", |
| 371 |
"platform": "Mac OS 8-X", |
| 372 |
"version": "1", |
| 373 |
"grade": "C" |
| 374 |
}, |
| 375 |
{ |
| 376 |
"engine": "Misc", |
| 377 |
"browser": "NetFront 3.1", |
| 378 |
"platform": "Embedded devices", |
| 379 |
"version": "-", |
| 380 |
"grade": "C" |
| 381 |
}, |
| 382 |
{ |
| 383 |
"engine": "Misc", |
| 384 |
"browser": "NetFront 3.4", |
| 385 |
"platform": "Embedded devices", |
| 386 |
"version": "-", |
| 387 |
"grade": "A" |
| 388 |
}, |
| 389 |
{ |
| 390 |
"engine": "Misc", |
| 391 |
"browser": "Dillo 0.8", |
| 392 |
"platform": "Embedded devices", |
| 393 |
"version": "-", |
| 394 |
"grade": "X" |
| 395 |
}, |
| 396 |
{ |
| 397 |
"engine": "Misc", |
| 398 |
"browser": "Links", |
| 399 |
"platform": "Text only", |
| 400 |
"version": "-", |
| 401 |
"grade": "X" |
| 402 |
}, |
| 403 |
{ |
| 404 |
"engine": "Misc", |
| 405 |
"browser": "Lynx", |
| 406 |
"platform": "Text only", |
| 407 |
"version": "-", |
| 408 |
"grade": "X" |
| 409 |
}, |
| 410 |
{ |
| 411 |
"engine": "Misc", |
| 412 |
"browser": "IE Mobile", |
| 413 |
"platform": "Windows Mobile 6", |
| 414 |
"version": "-", |
| 415 |
"grade": "C" |
| 416 |
}, |
| 417 |
{ |
| 418 |
"engine": "Misc", |
| 419 |
"browser": "PSP browser", |
| 420 |
"platform": "PSP", |
| 421 |
"version": "-", |
| 422 |
"grade": "C" |
| 423 |
}, |
| 424 |
{ |
| 425 |
"engine": "Other browsers", |
| 426 |
"browser": "All others", |
| 427 |
"platform": "-", |
| 428 |
"version": "-", |
| 429 |
"grade": "U" |
| 430 |
} |
| 431 |
] |
| 432 |
}; |
| 433 |
$('#example').dataTable( oInit ); |
| 434 |
|
| 435 |
/* Basic checks */ |
| 436 |
oTest.fnWaitTest( |
| 437 |
"Length changing div exists", |
| 438 |
null, |
| 439 |
function () { return document.getElementById('example_length') != null; } |
| 440 |
); |
| 441 |
|
| 442 |
oTest.fnTest( |
| 443 |
"Filtering div exists", |
| 444 |
null, |
| 445 |
function () { return document.getElementById('example_filter') != null; } |
| 446 |
); |
| 447 |
|
| 448 |
oTest.fnTest( |
| 449 |
"Information div exists", |
| 450 |
null, |
| 451 |
function () { return document.getElementById('example_info') != null; } |
| 452 |
); |
| 453 |
|
| 454 |
oTest.fnTest( |
| 455 |
"Pagination div exists", |
| 456 |
null, |
| 457 |
function () { return document.getElementById('example_paginate') != null; } |
| 458 |
); |
| 459 |
|
| 460 |
oTest.fnTest( |
| 461 |
"Processing div is off by default", |
| 462 |
null, |
| 463 |
function () { return document.getElementById('example_processing') == null; } |
| 464 |
); |
| 465 |
|
| 466 |
oTest.fnWaitTest( |
| 467 |
"10 rows shown on the first page", |
| 468 |
null, |
| 469 |
function () { return $('#example tbody tr').length == 10; } |
| 470 |
); |
| 471 |
|
| 472 |
oTest.fnTest( |
| 473 |
"Initial sort occurred", |
| 474 |
null, |
| 475 |
function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } |
| 476 |
); |
| 477 |
|
| 478 |
/* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ |
| 479 |
oTest.fnTest( |
| 480 |
"Sorting (first click) on second column", |
| 481 |
function () { $('#example thead th:eq(1)').click(); }, |
| 482 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
| 483 |
); |
| 484 |
|
| 485 |
oTest.fnTest( |
| 486 |
"Sorting (second click) on second column", |
| 487 |
function () { $('#example thead th:eq(1)').click(); }, |
| 488 |
function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } |
| 489 |
); |
| 490 |
|
| 491 |
oTest.fnTest( |
| 492 |
"Sorting (third click) on second column", |
| 493 |
function () { $('#example thead th:eq(1)').click(); }, |
| 494 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
| 495 |
); |
| 496 |
|
| 497 |
oTest.fnTest( |
| 498 |
"Sorting (first click) on numeric column", |
| 499 |
function () { $('#example thead th:eq(3)').click(); }, |
| 500 |
function () { return $('#example tbody td:eq(3)').html() == "-"; } |
| 501 |
); |
| 502 |
|
| 503 |
oTest.fnTest( |
| 504 |
"Sorting (second click) on numeric column", |
| 505 |
function () { $('#example thead th:eq(3)').click(); }, |
| 506 |
function () { return $('#example tbody td:eq(3)').html() == "522.1"; } |
| 507 |
); |
| 508 |
|
| 509 |
oTest.fnTest( |
| 510 |
"Sorting multi-column (first click)", |
| 511 |
function () { |
| 512 |
$('#example thead th:eq(0)').click(); |
| 513 |
oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, |
| 514 |
function () { var b = |
| 515 |
$('#example tbody td:eq(0)').html() == "Gecko" && |
| 516 |
$('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } |
| 517 |
); |
| 518 |
|
| 519 |
oTest.fnTest( |
| 520 |
"Sorting multi-column - sorting second column only", |
| 521 |
function () { |
| 522 |
$('#example thead th:eq(1)').click(); }, |
| 523 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
| 524 |
); |
| 525 |
|
| 526 |
/* Basic paging */ |
| 527 |
oTest.fnTest( |
| 528 |
"Paging to second page", |
| 529 |
function () { $('#example_next').click(); }, |
| 530 |
function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } |
| 531 |
); |
| 532 |
|
| 533 |
oTest.fnTest( |
| 534 |
"Paging to first page", |
| 535 |
function () { $('#example_previous').click(); }, |
| 536 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
| 537 |
); |
| 538 |
|
| 539 |
oTest.fnTest( |
| 540 |
"Attempting to page back beyond the first page", |
| 541 |
function () { $('#example_previous').click(); }, |
| 542 |
function () { return $('#example tbody td:eq(1)').html() == "All others"; } |
| 543 |
); |
| 544 |
|
| 545 |
/* Changing length */ |
| 546 |
oTest.fnTest( |
| 547 |
"Changing table length to 25 records", |
| 548 |
function () { $("select[name=example_length]").val('25').change(); }, |
| 549 |
function () { return $('#example tbody tr').length == 25; } |
| 550 |
); |
| 551 |
|
| 552 |
oTest.fnTest( |
| 553 |
"Changing table length to 50 records", |
| 554 |
function () { $("select[name=example_length]").val('50').change(); }, |
| 555 |
function () { return $('#example tbody tr').length == 50; } |
| 556 |
); |
| 557 |
|
| 558 |
oTest.fnTest( |
| 559 |
"Changing table length to 100 records", |
| 560 |
function () { $("select[name=example_length]").val('100').change(); }, |
| 561 |
function () { return $('#example tbody tr').length == 57; } |
| 562 |
); |
| 563 |
|
| 564 |
oTest.fnTest( |
| 565 |
"Changing table length to 10 records", |
| 566 |
function () { $("select[name=example_length]").val('10').change(); }, |
| 567 |
function () { return $('#example tbody tr').length == 10; } |
| 568 |
); |
| 569 |
|
| 570 |
/* |
| 571 |
* Information element |
| 572 |
*/ |
| 573 |
oTest.fnTest( |
| 574 |
"Information on zero config", |
| 575 |
null, |
| 576 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } |
| 577 |
); |
| 578 |
|
| 579 |
oTest.fnTest( |
| 580 |
"Information on second page", |
| 581 |
function () { $('#example_next').click(); }, |
| 582 |
function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } |
| 583 |
); |
| 584 |
|
| 585 |
oTest.fnTest( |
| 586 |
"Information on third page", |
| 587 |
function () { $('#example_next').click(); }, |
| 588 |
function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } |
| 589 |
); |
| 590 |
|
| 591 |
oTest.fnTest( |
| 592 |
"Information on last page", |
| 593 |
function () { |
| 594 |
$('#example_next').click(); |
| 595 |
$('#example_next').click(); |
| 596 |
$('#example_next').click(); |
| 597 |
}, |
| 598 |
function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } |
| 599 |
); |
| 600 |
|
| 601 |
oTest.fnTest( |
| 602 |
"Information back on first page", |
| 603 |
function () { |
| 604 |
$('#example_previous').click(); |
| 605 |
$('#example_previous').click(); |
| 606 |
$('#example_previous').click(); |
| 607 |
$('#example_previous').click(); |
| 608 |
$('#example_previous').click(); |
| 609 |
}, |
| 610 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } |
| 611 |
); |
| 612 |
|
| 613 |
oTest.fnTest( |
| 614 |
"Information with 25 records", |
| 615 |
function () { $("select[name=example_length]").val('25').change(); }, |
| 616 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 25 of 57 entries"; } |
| 617 |
); |
| 618 |
|
| 619 |
oTest.fnTest( |
| 620 |
"Information with 25 records - second page", |
| 621 |
function () { $('#example_next').click(); }, |
| 622 |
function () { return document.getElementById('example_info').innerHTML == "Showing 26 to 50 of 57 entries"; } |
| 623 |
); |
| 624 |
|
| 625 |
oTest.fnTest( |
| 626 |
"Information with 100 records - first page", |
| 627 |
function () { |
| 628 |
$('#example_previous').click(); |
| 629 |
$("select[name=example_length]").val('100').change(); |
| 630 |
}, |
| 631 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } |
| 632 |
); |
| 633 |
|
| 634 |
oTest.fnTest( |
| 635 |
"Information back to 10 records", |
| 636 |
function () { |
| 637 |
$('#example_previous').click(); |
| 638 |
$("select[name=example_length]").val('10').change(); |
| 639 |
}, |
| 640 |
function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } |
| 641 |
); |
| 642 |
|
| 643 |
oTest.fnTest( |
| 644 |
"Information with filter 'Win'", |
| 645 |
function () { $('#example_filter input').val("Win").keyup(); }, |
| 646 |
function () { return document.getElementById('example_info').innerHTML == |
| 647 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
| 648 |
); |
| 649 |
|
| 650 |
oTest.fnTest( |
| 651 |
"Information with filter 'Win' second page", |
| 652 |
function () { $('#example_next').click(); }, |
| 653 |
function () { return document.getElementById('example_info').innerHTML == |
| 654 |
"Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } |
| 655 |
); |
| 656 |
|
| 657 |
oTest.fnTest( |
| 658 |
"Information with filter 'Win' last page", |
| 659 |
function () { |
| 660 |
$('#example_next').click(); |
| 661 |
$('#example_next').click(); |
| 662 |
}, |
| 663 |
function () { return document.getElementById('example_info').innerHTML == |
| 664 |
"Showing 31 to 31 of 31 entries (filtered from 57 total entries)"; } |
| 665 |
); |
| 666 |
|
| 667 |
oTest.fnTest( |
| 668 |
"Information with filter 'Win' back to first page", |
| 669 |
function () { |
| 670 |
$('#example_previous').click(); |
| 671 |
$('#example_previous').click(); |
| 672 |
$('#example_previous').click(); |
| 673 |
}, |
| 674 |
function () { return document.getElementById('example_info').innerHTML == |
| 675 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
| 676 |
); |
| 677 |
|
| 678 |
oTest.fnTest( |
| 679 |
"Information with filter 'Win' second page - second time", |
| 680 |
function () { |
| 681 |
$('#example_next').click(); |
| 682 |
}, |
| 683 |
function () { return document.getElementById('example_info').innerHTML == |
| 684 |
"Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } |
| 685 |
); |
| 686 |
|
| 687 |
oTest.fnTest( |
| 688 |
"Information with filter increased to 'Win 98'", |
| 689 |
function () { $('#example_filter input').val("Win 98").keyup(); }, |
| 690 |
function () { return document.getElementById('example_info').innerHTML == |
| 691 |
"Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } |
| 692 |
); |
| 693 |
|
| 694 |
oTest.fnTest( |
| 695 |
"Information with filter decreased to 'Win'", |
| 696 |
function () { $('#example_filter input').val("Win").keyup(); }, |
| 697 |
function () { return document.getElementById('example_info').innerHTML == |
| 698 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
| 699 |
); |
| 700 |
|
| 701 |
oTest.fnTest( |
| 702 |
"Information with filter 'Win' second page - third time", |
| 703 |
function () { |
| 704 |
$('#example_next').click(); |
| 705 |
}, |
| 706 |
function () { return document.getElementById('example_info').innerHTML == |
| 707 |
"Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } |
| 708 |
); |
| 709 |
|
| 710 |
oTest.fnTest( |
| 711 |
"Information with filter removed", |
| 712 |
function () { $('#example_filter input').val("").keyup(); }, |
| 713 |
function () { return document.getElementById('example_info').innerHTML == |
| 714 |
"Showing 1 to 10 of 57 entries"; } |
| 715 |
); |
| 716 |
|
| 717 |
|
| 718 |
/* |
| 719 |
* Filtering |
| 720 |
*/ |
| 721 |
oTest.fnWaitTest( |
| 722 |
"Filter 'W' - rows", |
| 723 |
function () { |
| 724 |
/* Reset the table such that the old sorting doesn't mess things up */ |
| 725 |
oSession.fnRestore(); |
| 726 |
$('#example').dataTable( oInit ); |
| 727 |
$('#example_filter input').val("W").keyup(); }, |
| 728 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } |
| 729 |
); |
| 730 |
|
| 731 |
oTest.fnTest( |
| 732 |
"Filter 'W' - info", |
| 733 |
null, |
| 734 |
function () { return document.getElementById('example_info').innerHTML == |
| 735 |
"Showing 1 to 10 of 42 entries (filtered from 57 total entries)"; } |
| 736 |
); |
| 737 |
|
| 738 |
oTest.fnTest( |
| 739 |
"Filter 'Wi'", |
| 740 |
function () { $('#example_filter input').val("Wi").keyup(); }, |
| 741 |
function () { return document.getElementById('example_info').innerHTML == |
| 742 |
"Showing 1 to 10 of 32 entries (filtered from 57 total entries)"; } |
| 743 |
); |
| 744 |
|
| 745 |
oTest.fnTest( |
| 746 |
"Filter 'Win'", |
| 747 |
function () { $('#example_filter input').val("Win").keyup(); }, |
| 748 |
function () { return document.getElementById('example_info').innerHTML == |
| 749 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
| 750 |
); |
| 751 |
|
| 752 |
oTest.fnTest( |
| 753 |
"Filter 'Win' - sorting column 1", |
| 754 |
function () { $('#example thead th:eq(1)').click(); }, |
| 755 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "AOL browser (AOL desktop)"; } |
| 756 |
); |
| 757 |
|
| 758 |
oTest.fnTest( |
| 759 |
"Filter 'Win' - sorting column 1 info", |
| 760 |
null, |
| 761 |
function () { return document.getElementById('example_info').innerHTML == |
| 762 |
"Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } |
| 763 |
); |
| 764 |
|
| 765 |
oTest.fnTest( |
| 766 |
"Filter 'Win' - sorting column 1 reverse", |
| 767 |
function () { $('#example thead th:eq(1)').click(); }, |
| 768 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Seamonkey 1.1"; } |
| 769 |
); |
| 770 |
|
| 771 |
oTest.fnTest( |
| 772 |
"Filter 'Win XP' - maintaining reverse sorting col 1", |
| 773 |
function () { $('#example_filter input').val("Win XP").keyup(); }, |
| 774 |
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 7"; } |
| 775 |
); |
| 776 |
|
| 777 |
oTest.fnTest( |
| 778 |
"Filter 'Win XP' - sorting col 3", |
| 779 |
function () { $('#example thead th:eq(3)').click(); }, |
| 780 |
function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "4"; } |
| 781 |
); |
| 782 |
|
| 783 |
oTest.fnTest( |
| 784 |
"Filter 'Win XP' - sorting col 3 - reversed", |
| 785 |
function () { $('#example thead th:eq(3)').click(); }, |
| 786 |
function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "7"; } |
| 787 |
); |
| 788 |
|
| 789 |
oTest.fnTest( |
| 790 |
"Filter 'Win' - sorting col 3 - reversed info", |
| 791 |
null, |
| 792 |
function () { return document.getElementById('example_info').innerHTML == |
| 793 |
"Showing 1 to 6 of 6 entries (filtered from 57 total entries)"; } |
| 794 |
); |
| 795 |
|
| 796 |
oTest.fnTest( |
| 797 |
"Filter 'nothinghere'", |
| 798 |
function () { $('#example_filter input').val("nothinghere").keyup(); }, |
| 799 |
function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == |
| 800 |
"No matching records found"; } |
| 801 |
); |
| 802 |
|
| 803 |
oTest.fnTest( |
| 804 |
"Filter 'nothinghere' - info", |
| 805 |
null, |
| 806 |
function () { return document.getElementById('example_info').innerHTML == |
| 807 |
"Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } |
| 808 |
); |
| 809 |
|
| 810 |
oTest.fnTest( |
| 811 |
"Filter back to blank and 1st column sorting", |
| 812 |
function () { |
| 813 |
$('#example_filter input').val("").keyup(); |
| 814 |
$('#example thead th:eq(0)').click(); |
| 815 |
}, |
| 816 |
function () { return document.getElementById('example_info').innerHTML == |
| 817 |
"Showing 1 to 10 of 57 entries"; } |
| 818 |
); |
| 819 |
|
| 820 |
oTest.fnTest( |
| 821 |
"Prefixing a filter entry", |
| 822 |
function () { |
| 823 |
$('#example_filter input').val("Win").keyup(); |
| 824 |
$('#example_filter input').val("GeckoWin").keyup(); |
| 825 |
}, |
| 826 |
function () { return document.getElementById('example_info').innerHTML == |
| 827 |
"Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } |
| 828 |
); |
| 829 |
|
| 830 |
oTest.fnTest( |
| 831 |
"Prefixing a filter entry with space", |
| 832 |
function () { |
| 833 |
$('#example_filter input').val("Gecko Win").keyup(); |
| 834 |
}, |
| 835 |
function () { return document.getElementById('example_info').innerHTML == |
| 836 |
"Showing 1 to 10 of 17 entries (filtered from 57 total entries)"; } |
| 837 |
); |
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
oTest.fnComplete(); |
| 847 |
} ); |