/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/2_js/fnCreatedRow.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/2_js/fnCreatedRow.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: application/javascript
File size: 2238 byte(s)
initial import
1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "fnCreatedRow tests" );
3
4 $(document).ready( function () {
5 var tmp = 0;
6
7 $('#example').dataTable( {
8 "aaData": gaaData,
9 fnCreatedRow: function () {
10 tmp++;
11 }
12 } );
13
14 oTest.fnTest(
15 "Row created is called once for each row on init",
16 null,
17 function () { return tmp===57; }
18 );
19
20 oTest.fnTest(
21 "Created isn't called back on other draws",
22 function () { $('#example th:eq(1)').click(); },
23 function () { return tmp===57; }
24 );
25
26 oTest.fnTest(
27 "Three arguments for the function",
28 function () {
29 oSession.fnRestore();
30 tmp = true;
31
32 $('#example').dataTable( {
33 "aaData": gaaData,
34 fnCreatedRow: function () {
35 if ( arguments.length !== 3 ) {
36 tmp = false;
37 }
38 }
39 } );
40 },
41 function () { return tmp; }
42 );
43
44 oTest.fnTest(
45 "First argument is a TR element",
46 function () {
47 oSession.fnRestore();
48 tmp = true;
49
50 $('#example').dataTable( {
51 "aaData": gaaData,
52 fnCreatedRow: function () {
53 if ( arguments[0].nodeName !== "TR" ) {
54 tmp = false;
55 }
56 }
57 } );
58 },
59 function () { return tmp; }
60 );
61
62 oTest.fnTest(
63 "Second argument is an array with 5 elements",
64 function () {
65 oSession.fnRestore();
66 tmp = true;
67
68 $('#example').dataTable( {
69 "aaData": gaaData,
70 fnCreatedRow: function () {
71 if ( arguments[1].length !== 5 ) {
72 tmp = false;
73 }
74 }
75 } );
76 },
77 function () { return tmp; }
78 );
79
80 oTest.fnTest(
81 "Third argument is the data source for the row",
82 function () {
83 oSession.fnRestore();
84 tmp = true;
85
86 $('#example').dataTable( {
87 "aaData": gaaData,
88 fnCreatedRow: function () {
89 if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
90 tmp = false;
91 }
92 }
93 } );
94 },
95 function () { return tmp; }
96 );
97
98 oTest.fnTest(
99 "TR element is tied to the correct data",
100 function () {
101 oSession.fnRestore();
102 tmp = false;
103
104 $('#example').dataTable( {
105 "aaData": gaaData,
106 fnCreatedRow: function (tr, data, index) {
107 if ( data[1] === "Firefox 1.0" ) {
108 if ( $('td:eq(3)', tr).html() == "1.7" ) {
109 tmp = true;
110 }
111 }
112 }
113 } );
114 },
115 function () { return tmp; }
116 );
117
118
119
120 oTest.fnComplete();
121 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20