diff DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/aoColumns.bSearchable.js @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/aoColumns.bSearchable.js	Tue Jul 01 11:42:23 2014 -0400
@@ -0,0 +1,79 @@
+// DATA_TEMPLATE: empty_table
+oTest.fnStart( "aoColumns.bSeachable" );
+
+$(document).ready( function () {
+	/* Check the default */
+	var oTable = $('#example').dataTable( {
+		"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
+		"bDeferRender": true
+	} );
+	var oSettings = oTable.fnSettings();
+	
+	oTest.fnWaitTest( 
+		"Columns are searchable by default",
+		function () { oTable.fnFilter("Camino"); },
+		function () {
+			if ( $('#example tbody tr:eq(0) td:eq(1)')[0] )
+				return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/);
+			else
+				return null;
+		}
+	);
+	
+	oTest.fnWaitTest( 
+		"Disabling sorting on a column removes it from the global filter",
+		function () {
+			oSession.fnRestore();
+			oTable = $('#example').dataTable( {
+				"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
+				"bDeferRender": true,
+				"aoColumns": [
+					null,
+					{ "bSearchable": false },
+					null,
+					null,
+					null
+				]
+			} );
+			oSettings = oTable.fnSettings();
+			oTable.fnFilter("Camino");
+		},
+		function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
+	);
+	
+	oTest.fnWaitTest( 
+		"Disabled on one column has no effect on other columns",
+		function () { oTable.fnFilter("Webkit"); },
+		function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
+	);
+	
+	oTest.fnWaitTest( 
+		"Disable filtering on multiple columns",
+		function () {
+			oSession.fnRestore();
+			oTable = $('#example').dataTable( {
+				"sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
+				"bDeferRender": true,
+				"aoColumns": [
+					{ "bSearchable": false },
+					{ "bSearchable": false },
+					null,
+					null,
+					null
+				]
+			} );
+			oSettings = oTable.fnSettings();
+			oTable.fnFilter("Webkit");
+		},
+		function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
+	);
+	
+	oTest.fnWaitTest( 
+		"Filter on second disabled column",
+		function () { oTable.fnFilter("Camino"); },
+		function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
+	);
+	
+	
+	oTest.fnComplete();
+} );
\ No newline at end of file