1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-18 11:52:11 +01:00

Fixed: Unit tests could fail due to interaction between state saving cookies. Now when tests which state save end, they must call fnCookieDestroy.

This commit is contained in:
Allan Jardine 2010-10-17 07:43:17 +01:00
parent 6adec72aae
commit 4e11bf9e9c
5 changed files with 19 additions and 0 deletions

View File

@ -49,5 +49,6 @@ $(document).ready( function () {
function () { return $('#example_filter input').val() == ''; }
);
oTest.fnCookieDestroy( $('#example').dataTable() );
oTest.fnComplete();
} );

View File

@ -35,5 +35,6 @@ $(document).ready( function () {
function () { return $('#example thead th').length == 5; }
);
oTest.fnCookieDestroy( $('#example').dataTable() );
oTest.fnComplete();
} );

View File

@ -34,5 +34,6 @@ $(document).ready( function () {
function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
);
oTest.fnCookieDestroy( $('#example').dataTable() );
oTest.fnComplete();
} );

View File

@ -92,5 +92,6 @@ $(document).ready( function () {
);
oTest.fnCookieDestroy( $('#example').dataTable() );
oTest.fnComplete();
} );

View File

@ -103,6 +103,21 @@ var oTest = {
this._fnNext();
},
/*
* Function: fnCookieDestroy
* Purpose: Destroy a cookie of a given name
* Returns: -
* Inputs: -
*/
"fnCookieDestroy": function ( oTable )
{
var sName = oTable.fnSettings().sCookiePrefix+oTable.fnSettings().sInstance;
var aParts = window.location.pathname.split('/');
var sNameFile = sName + '_' + aParts.pop().replace(/[\/:]/g,"").toLowerCase();
document.cookie = sNameFile+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+
aParts.join('/') + "/";
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *