Debian Codegraph @

old-tests/tests_onhold/4_server-side/sServerMethod.js

raw
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "sServerMethod" );
3
4
5 $(document).ready( function () {
6 /* Check the default */
7 var oTable = $('#example').dataTable( {
8 "bServerSide": true,
9 "sAjaxSource": "../data_sources/method.php?method=get"
10 } );
11
12 oTest.fnWaitTest(
13 "Default method was GET",
14 null,
15 function () {
16 // A valid request will place a single row in the table
17 return $('tbody td').eq(0).html() === '1';
18 }
19 );
20
21 oTest.fnWaitTest(
22 "Can make a POST request",
23 function () {
24 oSession.fnRestore();
25 $('#example').dataTable( {
26 "bServerSide": true,
27 "sAjaxSource": "../data_sources/method.php?method=post",
28 "sServerMethod": "POST"
29 } );
30 },
31 function () {
32 return $('tbody td').eq(0).html() === '1';
33 }
34 );
35
36 oTest.fnWaitTest(
37 "Can make a PUT request",
38 function () {
39 oSession.fnRestore();
40 $('#example').dataTable( {
41 "bServerSide": true,
42 "sAjaxSource": "../data_sources/method.php?method=put",
43 "sServerMethod": "PUT"
44 } );
45 },
46 function () {
47 return $('tbody td').eq(0).html() === '1';
48 }
49 );
50
51 oTest.fnComplete();
52 } );