Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HeuristicLabWeb.PluginHost/HLWebPluginHost/Content/jQuery/jQueryPlugins/DataTables-1.7.6/media/unit_testing/tests_onhold/3_ajax/fnServerData.js @ 6286

Last change on this file since 6286 was 6286, checked in by dkahn, 13 years ago

#1198 Added jQuery plus plugins

File size: 1.4 KB
Line 
1// DATA_TEMPLATE: empty_table
2oTest.fnStart( "fnServerData for Ajax sourced data" );
3
4$(document).ready( function () {
5  var mPass;
6 
7  oTest.fnTest(
8    "Argument length",
9    function () {
10      $('#example').dataTable( {
11        "sAjaxSource": "../../../examples/examples_support/json_source.txt",
12        "fnServerData": function () {
13          mPass = arguments.length;
14        }
15      } );
16    },
17    function () { return mPass == 3; }
18  );
19 
20  oTest.fnTest(
21    "Url",
22    function () {
23      $('#example').dataTable( {
24        "bDestroy": true,
25        "sAjaxSource": "../../../examples/examples_support/json_source.txt",
26        "fnServerData": function (sUrl, aoData, fnCallback) {
27          mPass = sUrl == "../../../examples/examples_support/json_source.txt";
28        }
29      } );
30    },
31    function () { return mPass; }
32  );
33 
34  oTest.fnTest(
35    "Data array",
36    function () {
37      $('#example').dataTable( {
38        "bDestroy": true,
39        "sAjaxSource": "../../../examples/examples_support/json_source.txt",
40        "fnServerData": function (sUrl, aoData, fnCallback) {
41          mPass = aoData.length==0;
42        }
43      } );
44    },
45    function () { return mPass; }
46  );
47 
48  oTest.fnTest(
49    "Callback function",
50    function () {
51      $('#example').dataTable( {
52        "bDestroy": true,
53        "sAjaxSource": "../../../examples/examples_support/json_source.txt",
54        "fnServerData": function (sUrl, aoData, fnCallback) {
55          mPass = typeof fnCallback == 'function';
56        }
57      } );
58    },
59    function () { return mPass; }
60  );
61 
62 
63  oTest.fnComplete();
64} );
Note: See TracBrowser for help on using the repository browser.