File: every%28%29.js

package info (click to toggle)
datatables.js 1.10.21%2Bdfsg-2%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,604 kB
  • sloc: javascript: 64,254; xml: 10,441; php: 4,623; sh: 523; makefile: 21
file content (103 lines) | stat: -rwxr-xr-x 1,965 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// DATA_TEMPLATE: dom_data
oTest.fnStart( "Every method validation" );

$(document).ready( function () {
	var test = 0;
	var table = $('#example').DataTable();

	oTest.fnTest( 
		"rows().every() will iterate for every row",
		function () {
			test = 0;

			table.rows().every( function () {
				test++;
			} );
		},
		function () { return test === 57; }
	);

	oTest.fnTest( 
		"rows().every() will iterate for every row - to filter set",
		function () {
			test = 0;

			table.search( 'net' ).draw();
			table.rows( { search: 'applied' } ).every( function () {
				test++;
			} );
		},
		function () { return test === 13; }
	);



	oTest.fnTest( 
		"columns().every() will iterate for every column",
		function () {
			test = 0;

			table.search('').draw();
			table.columns().every( function () {
				test++;
			} );
		},
		function () { return test === 5; }
	);

	oTest.fnTest( 
		"columns().every() will iterate for every columns, regardless of options",
		function () {
			test = 0;

			table.search( 'net' ).draw();
			table.columns( { search: 'applied' } ).every( function () {
				test++;
			} );
		},
		function () { return test === 5; }
	);

	oTest.fnTest( 
		"columns().every()'s execution context has the selector options applied",
		function () {
			test = 0;

			table.columns( { search: 'applied' } ).every( function () {
				test = this.nodes().length;
			} );
		},
		function () { return test === 13; }
	);



	oTest.fnTest( 
		"cells().every() will iterate for every cell",
		function () {
			test = 0;

			table.search('').draw();
			table.cells().every( function () {
				test++;
			} );
		},
		function () { return test === 57*5; }
	);

	oTest.fnTest( 
		"cells().every() will iterate for only filtered cells for options",
		function () {
			test = 0;

			table.search( 'net' ).draw();
			table.cells( { search: 'applied' } ).every( function () {
				test++;
			} );
		},
		function () { return test === 5*13; }
	);
	
	
	oTest.fnComplete();
} );