/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/fnCreatedCell.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/fnCreatedCell.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, 3 months ago) by torben
File MIME type: application/javascript
File size: 2812 byte(s)
initial import
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "fnCreatedCell tests" );
3
4 $(document).ready( function () {
5 var tmp = 0;
6
7 $('#example').dataTable( {
8 "aoColumnDefs": [ {
9 fnCreatedCell: function () {
10 tmp++;
11 },
12 "aTargets": ["_all"]
13 } ]
14 } );
15
16 oTest.fnTest(
17 "Cell created is called once for each cell on init",
18 null,
19 function () { return tmp===285; }
20 );
21
22 oTest.fnTest(
23 "Created isn't called back on other draws",
24 function () { $('#example th:eq(1)').click(); },
25 function () { return tmp===285; }
26 );
27
28 oTest.fnTest(
29 "Four arguments for the function",
30 function () {
31 oSession.fnRestore();
32 tmp = true;
33
34 $('#example').dataTable( {
35 "aoColumnDefs": [ {
36 fnCreatedRow: function () {
37 if ( arguments.length !== 4 ) {
38 tmp = false;
39 }
40 },
41 "aTargets": ["_all"]
42 } ]
43 } );
44 },
45 function () { return tmp; }
46 );
47
48 oTest.fnTest(
49 "First argument is a TD element",
50 function () {
51 oSession.fnRestore();
52 tmp = true;
53
54 $('#example').dataTable( {
55 "aoColumnDefs": [ {
56 fnCreatedRow: function () {
57 if ( arguments[0].nodeName !== "TD" ) {
58 tmp = false;
59 }
60 },
61 "aTargets": ["_all"]
62 } ]
63 } );
64 },
65 function () { return tmp; }
66 );
67
68 oTest.fnTest(
69 "Second argument is the HTML value",
70 function () {
71 oSession.fnRestore();
72 tmp = true;
73
74 $('#example').dataTable( {
75 "aoColumnDefs": [ {
76 fnCreatedRow: function () {
77 if ( arguments[1] != $('td').html() ) {
78 tmp = false;
79 }
80 },
81 "aTargets": ["_all"]
82 } ]
83 } );
84 },
85 function () { return tmp; }
86 );
87
88 oTest.fnTest(
89 "Third argument is the data array",
90 function () {
91 oSession.fnRestore();
92 tmp = true;
93
94 $('#example').dataTable( {
95 "aoColumnDefs": [ {
96 fnCreatedRow: function () {
97 if ( arguments[2].length !== 5 ) {
98 tmp = false;
99 }
100 },
101 "aTargets": ["_all"]
102 } ]
103 } );
104 },
105 function () { return tmp; }
106 );
107
108 oTest.fnTest(
109 "Fourth argument is the data source for the row",
110 function () {
111 oSession.fnRestore();
112 tmp = true;
113
114 $('#example').dataTable( {
115 "aoColumnDefs": [ {
116 fnCreatedRow: function () {
117 if ( arguments[2] !== this.fnSettings().aoData[ arguments[2] ]._aData ) {
118 tmp = false;
119 }
120 },
121 "aTargets": ["_all"]
122 } ]
123 } );
124 },
125 function () { return tmp; }
126 );
127
128 oTest.fnTest(
129 "Fifth argument is the the col index",
130 function () {
131 oSession.fnRestore();
132 tmp = true;
133
134 $('#example').dataTable( {
135 "aoColumnDefs": [ {
136 fnCreatedRow: function () {
137 if ( arguments[1] != $('td:eq('+arguments[4]+')', arguments[0].parentNode).html() ) {
138 tmp = false;
139 }
140 },
141 "aTargets": ["_all"]
142 } ]
143 } );
144 },
145 function () { return tmp; }
146 );
147
148
149
150 oTest.fnComplete();
151 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20