├── .buildpath
├── .gitignore
├── .project
├── .settings
├── .jsdtscope
├── org.eclipse.core.resources.prefs
├── org.eclipse.php.core.prefs
├── org.eclipse.wst.jsdt.ui.superType.container
└── org.eclipse.wst.jsdt.ui.superType.name
├── CHANGELOG
├── COPYRIGHT
├── DB_UPDATE
├── README
└── userlist_beta_0.1.1.sql
├── INSTALL
├── media
│ ├── img
│ │ ├── a1.gif
│ │ ├── favicon.ico
│ │ └── logo.jpg
│ └── stile.css
├── pure-ftpd-webui_users-table_0.0.9.sql
├── pure-ftpd-webui_users-table_0.1.1.sql
└── pure-ftpd_users-table_0.0.9.sql
├── LICENSE
├── README
├── blocks
├── db_connect.php
├── default.php
├── footer.php
├── header.php
├── lock.php
└── menu.php
├── config.php
├── daemon_control.php
├── del_user.php
├── drop_user.php
├── edit_settings.php
├── edit_users.php
├── edit_webui_users.php
├── img
├── a1.gif
├── favicon.ico
├── logo.jpg
└── menu
│ ├── bg.gif
│ ├── left.gif
│ ├── left_on.gif
│ ├── right.gif
│ └── right_on.gif
├── index.php
├── install.php
├── lang
├── english.php
└── russian.php
├── media
├── as3
│ ├── ZeroClipboard.as
│ ├── ZeroClipboardPdf.as
│ └── lib
│ │ └── AlivePDF.swc
├── css
│ ├── TableTools.css
│ ├── TableTools_JUI.css
│ ├── demo_page.css
│ ├── demo_table.css
│ ├── demo_table_jui.css
│ ├── jquery-ui-1.7.2.custom.css
│ └── stile.css
├── dataTables.english.txt
├── dataTables.russian.txt
├── images
│ ├── Sorting icons.psd
│ ├── back_disabled.jpg
│ ├── back_enabled.jpg
│ ├── background.png
│ ├── collection.png
│ ├── collection_hover.png
│ ├── copy.png
│ ├── copy_hover.png
│ ├── csv.png
│ ├── csv_hover.png
│ ├── favicon.ico
│ ├── forward_disabled.jpg
│ ├── forward_enabled.jpg
│ ├── pdf.png
│ ├── pdf_hover.png
│ ├── print.png
│ ├── print_hover.png
│ ├── psd
│ │ ├── collection.psd
│ │ ├── copy document.psd
│ │ ├── file_types.psd
│ │ └── printer.psd
│ ├── sort_asc.png
│ ├── sort_asc_disabled.png
│ ├── sort_both.png
│ ├── sort_desc.png
│ ├── sort_desc_disabled.png
│ ├── xls.png
│ └── xls_hover.png
├── js
│ ├── ZeroClipboard.js
│ ├── jquery.dataTables.js
│ ├── jquery.dataTables.min.js
│ └── jquery.js
└── unit_testing
│ ├── controller.js
│ ├── controller.php
│ ├── index.html
│ ├── performance
│ ├── draw.html
│ ├── large.php
│ ├── page.html
│ └── sort.html
│ ├── templates
│ ├── -complex_header.php
│ ├── 2512.php
│ ├── dom_data.php
│ ├── dymanic_table.php
│ ├── empty_table.php
│ ├── js_data.php
│ └── two_tables.php
│ ├── tests_onhold
│ ├── 1_dom
│ │ ├── -complex_header.js
│ │ ├── -iDraw.js
│ │ ├── 2512.js
│ │ ├── 2530-2.js
│ │ ├── 2530.js
│ │ ├── 2569.js
│ │ ├── 2600.js
│ │ ├── 2608.js
│ │ ├── 2635.js
│ │ ├── 2746-stable-sort.js
│ │ ├── 2799.js
│ │ ├── 2840-restore-table-width.js
│ │ ├── 2914-state-save-sort.js
│ │ ├── _zero_config.js
│ │ ├── aaSorting.js
│ │ ├── aaSortingFixed.js
│ │ ├── aoColumns.bSearchable.js
│ │ ├── aoColumns.bSortable.js
│ │ ├── aoColumns.bUseRendered.js
│ │ ├── aoColumns.bVisible.js
│ │ ├── aoColumns.fnRender.js
│ │ ├── aoColumns.iDataSort.js
│ │ ├── aoColumns.sClass.js
│ │ ├── aoColumns.sName.js
│ │ ├── aoColumns.sTitle.js
│ │ ├── aoColumns.sWidth.js
│ │ ├── aoSearchCols.js
│ │ ├── asStripClasses.js
│ │ ├── bAutoWidth.js
│ │ ├── bFilter.js
│ │ ├── bInfiniteScroll.js
│ │ ├── bInfo.js
│ │ ├── bJQueryUI.js
│ │ ├── bLengthChange.js
│ │ ├── bPaginate.js
│ │ ├── bProcessing.js
│ │ ├── bServerSide.js
│ │ ├── bSort.js
│ │ ├── bSortClasses.js
│ │ ├── fnCookieCallback.js
│ │ ├── fnDeleteRow.js
│ │ ├── fnDrawCallback.js
│ │ ├── fnFooterCallback.js
│ │ ├── fnHeaderCallback.js
│ │ ├── fnInfoCallback.js
│ │ ├── fnInitComplete.js
│ │ ├── fnRowCallback.js
│ │ ├── iDisplayLength.js
│ │ ├── oLanguage.oPaginate.js
│ │ ├── oLanguage.sInfo.js
│ │ ├── oLanguage.sInfoEmpty.js
│ │ ├── oLanguage.sInfoPostFix.js
│ │ ├── oLanguage.sLengthMenu.js
│ │ ├── oLanguage.sProcessing.js
│ │ ├── oLanguage.sSearch.js
│ │ ├── oLanguage.sUrl.js
│ │ ├── oLanguage.sZeroRecords.js
│ │ ├── oSearch.js
│ │ ├── sAjaxSource.js
│ │ ├── sDom.js
│ │ └── sPaginationType.js
│ ├── 2_js
│ │ ├── _zero_config.js
│ │ ├── aaSorting.js
│ │ ├── aaSortingFixed.js
│ │ ├── aoColumns.bSearchable.js
│ │ ├── aoColumns.bSortable.js
│ │ ├── aoColumns.bUseRendered.js
│ │ ├── aoColumns.bVisible.js
│ │ ├── aoColumns.fnRender.js
│ │ ├── aoColumns.iDataSort.js
│ │ ├── aoColumns.sClass.js
│ │ ├── aoColumns.sName.js
│ │ ├── aoColumns.sTitle.js
│ │ ├── aoColumns.sWidth.js
│ │ ├── aoSearchCols.js
│ │ ├── asStripClasses.js
│ │ ├── bAutoWidth.js
│ │ ├── bFilter.js
│ │ ├── bInfo.js
│ │ ├── bLengthChange.js
│ │ ├── bPaginate.js
│ │ ├── bProcessing.js
│ │ ├── bServerSide.js
│ │ ├── bSort.js
│ │ ├── bSortClasses.js
│ │ ├── fnDrawCallback.js
│ │ ├── fnFooterCallback.js
│ │ ├── fnHeaderCallback.js
│ │ ├── fnInitComplete.js
│ │ ├── fnRowCallback.js
│ │ ├── iDisplayLength.js
│ │ ├── oLanguage.oPaginate.js
│ │ ├── oLanguage.sInfo.js
│ │ ├── oLanguage.sInfoEmpty.js
│ │ ├── oLanguage.sInfoPostFix.js
│ │ ├── oLanguage.sLengthMenu.js
│ │ ├── oLanguage.sProcessing.js
│ │ ├── oLanguage.sSearch.js
│ │ ├── oLanguage.sUrl.js
│ │ ├── oLanguage.sZeroRecords.js
│ │ ├── oSearch.js
│ │ ├── sAjaxSource.js
│ │ ├── sDom.js
│ │ └── sPaginationType.js
│ ├── 3_ajax
│ │ ├── _zero_config.js
│ │ ├── aaSorting.js
│ │ ├── aaSortingFixed.js
│ │ ├── aoColumns.bSearchable.js
│ │ ├── aoColumns.bSortable.js
│ │ ├── aoColumns.bUseRendered.js
│ │ ├── aoColumns.bVisible.js
│ │ ├── aoColumns.fnRender.js
│ │ ├── aoColumns.iDataSort.js
│ │ ├── aoColumns.sClass.js
│ │ ├── aoColumns.sName.js
│ │ ├── aoColumns.sTitle.js
│ │ ├── aoColumns.sWidth.js
│ │ ├── aoSearchCols.js
│ │ ├── asStripClasses.js
│ │ ├── bAutoWidth.js
│ │ ├── bFilter.js
│ │ ├── bInfo.js
│ │ ├── bLengthChange.js
│ │ ├── bPaginate.js
│ │ ├── bProcessing.js
│ │ ├── bServerSide.js
│ │ ├── bSort.js
│ │ ├── bSortClasses.js
│ │ ├── fnDrawCallback.js
│ │ ├── fnHeaderCallback.js
│ │ ├── fnInitComplete.js
│ │ ├── fnRowCallback.js
│ │ ├── fnServerData.js
│ │ ├── iDisplayLength.js
│ │ ├── oLanguage.oPaginate.js
│ │ ├── oLanguage.sInfo.js
│ │ ├── oLanguage.sInfoEmpty.js
│ │ ├── oLanguage.sInfoPostFix.js
│ │ ├── oLanguage.sLengthMenu.js
│ │ ├── oLanguage.sProcessing.js
│ │ ├── oLanguage.sSearch.js
│ │ ├── oLanguage.sUrl.js
│ │ ├── oLanguage.sZeroRecords.js
│ │ ├── oSearch.js
│ │ ├── sAjaxSource.js
│ │ ├── sDom.js
│ │ └── sPaginationType.js
│ └── 4_server-side
│ │ ├── -iDraw.js
│ │ ├── 2440.js
│ │ ├── 2569.js
│ │ ├── 2600.js
│ │ ├── _zero_config.js
│ │ ├── aaSorting.js
│ │ ├── aaSortingFixed.js
│ │ ├── aoColumns.bSearchable.js
│ │ ├── aoColumns.bSortable.js
│ │ ├── aoColumns.bUseRendered.js
│ │ ├── aoColumns.bVisible.js
│ │ ├── aoColumns.fnRender.js
│ │ ├── aoColumns.sClass.js
│ │ ├── aoColumns.sName.js
│ │ ├── aoColumns.sTitle.js
│ │ ├── aoColumns.sWidth.js
│ │ ├── aoSearchCols.js
│ │ ├── asStripClasses.js
│ │ ├── bAutoWidth.js
│ │ ├── bFilter.js
│ │ ├── bInfiniteScroll.js
│ │ ├── bInfo.js
│ │ ├── bLengthChange.js
│ │ ├── bPaginate.js
│ │ ├── bProcessing.js
│ │ ├── bServerSide.js
│ │ ├── bSort.js
│ │ ├── bSortClasses.js
│ │ ├── fnDrawCallback.js
│ │ ├── fnHeaderCallback.js
│ │ ├── fnInitComplete.js
│ │ ├── fnRowCallback.js
│ │ ├── iDisplayLength.js
│ │ ├── oLanguage.oPaginate.js
│ │ ├── oLanguage.sInfo.js
│ │ ├── oLanguage.sInfoEmpty.js
│ │ ├── oLanguage.sInfoPostFix.js
│ │ ├── oLanguage.sLengthMenu.js
│ │ ├── oLanguage.sProcessing.js
│ │ ├── oLanguage.sSearch.js
│ │ ├── oLanguage.sUrl.js
│ │ ├── oLanguage.sZeroRecords.js
│ │ ├── oSearch.js
│ │ ├── sAjaxSource.js
│ │ ├── sDom.js
│ │ └── sPaginationType.js
│ └── unit_test.js
├── version.php
└── webui_users.php
/.buildpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.project
2 | /.settings
3 | /.buildpath
4 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | pure-ftpd-webui
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.jsdt.core.javascriptValidator
15 |
16 |
17 |
18 |
19 | org.eclipse.wst.validation.validationbuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.dltk.core.scriptbuilder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.php.core.PHPNature
31 | org.eclipse.wst.jsdt.core.jsNature
32 | org.eclipse.wst.common.project.facet.core.nature
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | =\=\=\=\=\=\=
2 | <<<<<<<=HEAD
3 | >>>>>>>=78f94db497772cbefac9329abb2348cb215f685c
4 | eclipse.preferences.version=1
5 | encoding/=UTF-8
6 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.php.core.prefs:
--------------------------------------------------------------------------------
1 | <<<<<<< HEAD
2 | #Sat Jan 28 12:33:28 GMT+06:00 2012
3 | =======
4 | #Wed Aug 17 11:19:15 ALMT 2011
5 | >>>>>>> 78f94db497772cbefac9329abb2348cb215f685c
6 | eclipse.preferences.version=1
7 | include_path=0;/pure-ftpd-webui
8 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/CHANGELOG:
--------------------------------------------------------------------------------
1 | 2012.04.07 0.2.0
2 | +++++++++++++++++++++
3 | 1. Added function to set default setting, such as FTP directory, ul/dl speed limit, etc.
4 | 2. Added configuration file.
5 | 3. Several bug fixes.
6 |
7 | 2012.04.06 0.1.2a
8 | +++++++++++++++++++++
9 | 1. Added function for check database connection (ticket #1).
10 | 2. Fixed charset (ticket #2).
11 | 3. Added quota set functionality.
12 |
13 | 2011.06.05 Beta 0.1.1
14 | +++++++++++++++++++++
15 | 1. Multilanguage support added.
16 | 2. English language added.
17 | 3. Installer now in English.
18 | 4. Pure-FTPd users table changed (added field 'language').
19 | 5. Added interface to create/delete/change Pure-FTPd WebUI administrators accounts.
20 |
21 | 2011.06.04 Beta 0.1.0
22 | +++++++++++++++++++++
23 | 1. Added web based installation. It's create MySQL database, MySQL user for Pure-FTPd WebUI,
24 | Pure-FTPd Users table, Pure-FTPd WebUI users table, Pure-FTPd WebUI config.
25 | 2. Some interface changes.
26 | 3. Bug fixes.
--------------------------------------------------------------------------------
/COPYRIGHT:
--------------------------------------------------------------------------------
1 | Pure-FTPd WebUI
2 | Copyright © 2010-2013
3 | Yevgeniy Valeyev, Karaganda, Kazakhstan
4 |
5 | Developed by:
6 | Yevgeniy Valeyev;
7 |
8 | License:
9 | This software is distributed under the GNU General Public License (GPL).
10 |
11 | Disclaimer of warranty:
12 | Pure-FTPd WebUI is provided as is with NO WARRANTY OF ANY KIND, including the warranty
13 | of design, merchantability, and fitness for a particular purpose.
14 |
15 | Additional copyrights:
16 | Pure-FTPd ftp daemon by Frank DENIS
17 |
18 | All other trademarks, servicemarks, registered trademarks, and
19 | registered servicemarks are the property of their respective owner(s).
--------------------------------------------------------------------------------
/DB_UPDATE/README:
--------------------------------------------------------------------------------
1 | To update your Pure-FTPd WebUI users table, run following command from server console:
2 | mysql -u root -p pureftpd < userlist_beta_0.1.1.sql
--------------------------------------------------------------------------------
/DB_UPDATE/userlist_beta_0.1.1.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE userlist ADD `language` varchar(50) COLLATE utf8_bin DEFAULT NULL;
--------------------------------------------------------------------------------
/INSTALL/media/img/a1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/INSTALL/media/img/a1.gif
--------------------------------------------------------------------------------
/INSTALL/media/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/INSTALL/media/img/favicon.ico
--------------------------------------------------------------------------------
/INSTALL/media/img/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/INSTALL/media/img/logo.jpg
--------------------------------------------------------------------------------
/INSTALL/media/stile.css:
--------------------------------------------------------------------------------
1 | /* CSS Document */
2 |
3 | body {
4 | background:url("img/a1.gif") repeat-x scroll 0 0 #F9F9F7;
5 | }
6 |
7 | .main_border {
8 | position: fixed;
9 | top: 16%;
10 | left: 23%;
11 | background-color:#605F62;
12 | margin-left:auto;
13 | margin-right:auto;
14 | border-radius: 10px;
15 | -webkit-border-radius: 10px;
16 | -moz-border-radius: 10px;
17 | box-shadow:10px 10px 20px #777;
18 | -webkit-box-shadow:10px 10px 20px #777;
19 | -moz-box-shadow:10px 10px 20px #777;
20 | background-image: url("img/logo.jpg");
21 | background-size: auto auto;
22 | background-repeat: no-repeat;
23 | background-position: 95% 5%;
24 | }
25 |
26 | p {
27 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
28 | font-size:11px;
29 | margin:15px;
30 | color:#fff;
31 | }
32 |
33 | p.text_title {
34 | font-size:13px;
35 | font-weight:bold;
36 | color:#fff;
37 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
38 | text-shadow:1px 1px 1px #000000;
39 | }
40 |
41 | p.error {
42 | font-size:11px;
43 | font-weight:bold;
44 | color:#EB0303;
45 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
46 | /* text-shadow:1px 1px 1px #C2C4C1;*/
47 | }
48 |
49 | p.warning {
50 | font-size:11px;
51 | font-weight:bold;
52 | color:#F1F800;
53 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
54 | /* text-shadow:1px 1px 1px #C2C4C1;*/
55 | }
56 |
57 | p.info {
58 | font-size:11px;
59 | font-weight:bold;
60 | color:#5CD4FE;
61 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
62 | /* text-shadow:1px 1px 1px #C2C4C1;*/
63 | }
64 |
65 | a {
66 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
67 | font-size:11px;
68 | color:#00BD54;
69 | }
70 |
71 | p.link {
72 | font-family:"Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
73 | font-size:11px;
74 | color:#00BD54;
75 | float:right;
76 | margin-right: 40px;
77 | margin-left: -50px;
78 | margin-bottom: 40px;
79 | margin-top: -50px;
80 | }
--------------------------------------------------------------------------------
/INSTALL/pure-ftpd-webui_users-table_0.0.9.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `userlist` (
2 | `id` int(3) NOT NULL AUTO_INCREMENT,
3 | `user` varchar(50) COLLATE utf8_bin NOT NULL,
4 | `pass` varchar(50) COLLATE utf8_bin NOT NULL,
5 | PRIMARY KEY (`id`)
6 | ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--------------------------------------------------------------------------------
/INSTALL/pure-ftpd-webui_users-table_0.1.1.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `userlist` (
2 | `id` int(3) NOT NULL AUTO_INCREMENT,
3 | `user` varchar(50) COLLATE utf8_bin NOT NULL,
4 | `pass` varchar(50) COLLATE utf8_bin NOT NULL,
5 | `language` varchar(50) COLLATE utf8_bin DEFAULT NULL,
6 | PRIMARY KEY (`id`)
7 | ) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--------------------------------------------------------------------------------
/INSTALL/pure-ftpd_users-table_0.0.9.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `ftpd` (
2 | `id` int(11) NOT NULL AUTO_INCREMENT,
3 | `User` varchar(16) NOT NULL DEFAULT '',
4 | `status` enum('0','1') NOT NULL DEFAULT '0',
5 | `Password` varchar(64) NOT NULL DEFAULT '',
6 | `Uid` varchar(11) NOT NULL DEFAULT '2001',
7 | `Gid` varchar(11) NOT NULL DEFAULT '2001',
8 | `Dir` varchar(128) NOT NULL DEFAULT '/media/FTP',
9 | `ULBandwidth` int(5) NOT NULL DEFAULT '0',
10 | `DLBandwidth` int(5) NOT NULL DEFAULT '0',
11 | `comment` tinytext NOT NULL,
12 | `ipaccess` varchar(15) NOT NULL DEFAULT '*',
13 | `QuotaSize` bigint(20) NOT NULL DEFAULT '0',
14 | `QuotaFiles` int(11) NOT NULL DEFAULT '0',
15 | PRIMARY KEY (`User`),
16 | KEY `id` (`id`)
17 | ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
18 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Pure-FTPd WebUI README
2 | ======================
3 |
4 | Pure-FTPd WebUI Homepage:
5 | http://pure-ftpd-webui.org/
6 |
7 | Table of contents
8 | -----------------
9 | A. Requirements
10 | B. Installation
11 |
12 | A. Requirements
13 | ---------------
14 |
15 | Pure-FTPd WebUI system requirements:
16 |
17 | * Apache webserver
18 | * PHP 5 or higher, php-mysql
19 | * MySQL
20 | * Pure-FTPd ftp daemon
21 |
22 | B. Installation
23 | ----------------------
24 |
25 | 1. Download and unpack
26 | Download and unpack the Pure-FTPd WebUI archive to your webserver's document root folder.
27 |
28 | 2. Set permissions
29 | Make sure the Pure-FTPd WebUI directory are writable to your webserver user.
30 |
31 | 3. Configure pure-ftpd
32 | Configure pure-ftpd to use "ftpd" as table for credentials in your pure-ftpd mysql.conf
33 | and make sure it uses md5 as encryption for the password.
34 |
35 | 4. Run installation
36 | Go to http://your_server/pure-ftpd-webui/install.php
37 |
--------------------------------------------------------------------------------
/blocks/db_connect.php:
--------------------------------------------------------------------------------
1 | Could not connect:" . mysql_error() . "
";
7 | die (mysql_error());
8 | }
9 | $table = FALSE;
10 | $table = mysql_select_db ("$mysql_database", $db);
11 | if (!$table) {
12 | $info = "Could not connect:" . mysql_error() . "
";
13 | die (mysql_error());
14 | }
15 | ?>
16 |
--------------------------------------------------------------------------------
/blocks/default.php:
--------------------------------------------------------------------------------
1 |
53 |
--------------------------------------------------------------------------------
/blocks/footer.php:
--------------------------------------------------------------------------------
1 |
4 | ");
5 | ?>
--------------------------------------------------------------------------------
/blocks/header.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/blocks/lock.php:
--------------------------------------------------------------------------------
1 |
50 |
--------------------------------------------------------------------------------
/blocks/menu.php:
--------------------------------------------------------------------------------
1 |
2 |
55 |
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/img/a1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/a1.gif
--------------------------------------------------------------------------------
/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/favicon.ico
--------------------------------------------------------------------------------
/img/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/logo.jpg
--------------------------------------------------------------------------------
/img/menu/bg.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/menu/bg.gif
--------------------------------------------------------------------------------
/img/menu/left.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/menu/left.gif
--------------------------------------------------------------------------------
/img/menu/left_on.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/menu/left_on.gif
--------------------------------------------------------------------------------
/img/menu/right.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/menu/right.gif
--------------------------------------------------------------------------------
/img/menu/right_on.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/img/menu/right_on.gif
--------------------------------------------------------------------------------
/media/as3/lib/AlivePDF.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/as3/lib/AlivePDF.swc
--------------------------------------------------------------------------------
/media/css/demo_page.css:
--------------------------------------------------------------------------------
1 |
2 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 | * General page setup
4 | */
5 | #dt_example {
6 | font: 80%/1.45em "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
7 | margin: 0;
8 | padding: 0;
9 | color: #333;
10 | background-color: #fff;
11 | overflow: scroll;
12 | }
13 |
14 |
15 | #dt_example #container {
16 | width: 90%;
17 | margin: 30px auto;
18 | padding: 0;
19 | }
20 |
21 |
22 | #dt_example #footer {
23 | margin: 50px auto 0 auto;
24 | padding: 0;
25 | }
26 |
27 | #dt_example #demo {
28 | margin: 30px auto 0 auto;
29 | }
30 |
31 | #dt_example .demo_jui {
32 | margin: 30px auto 0 auto;
33 | }
34 |
35 | #dt_example .big {
36 | font-size: 1.3em;
37 | font-weight: bold;
38 | line-height: 1.6em;
39 | color: #4E6CA3;
40 | }
41 |
42 | #dt_example .spacer {
43 | height: 20px;
44 | clear: both;
45 | }
46 |
47 | #dt_example .clear {
48 | clear: both;
49 | }
50 |
51 | #dt_example pre {
52 | padding: 15px;
53 | background-color: #F5F5F5;
54 | border: 1px solid #CCCCCC;
55 | }
56 |
57 | #dt_example h1 {
58 | margin-top: 2em;
59 | font-size: 1.3em;
60 | font-weight: normal;
61 | line-height: 1.6em;
62 | color: #4E6CA3;
63 | border-bottom: 1px solid #B0BED9;
64 | clear: both;
65 | }
66 |
67 | #dt_example h2 {
68 | font-size: 1.2em;
69 | font-weight: normal;
70 | line-height: 1.6em;
71 | color: #4E6CA3;
72 | clear: both;
73 | }
74 |
75 | #dt_example a {
76 | color: #006621;
77 | text-decoration: none;
78 | }
79 |
80 | #dt_example a:hover {
81 | text-decoration: none;
82 | }
83 |
84 | #dt_example ul {
85 | color: #4E6CA3;
86 | }
87 |
88 | .css_right {
89 | float: right;
90 | }
91 |
92 | .css_left {
93 | float: left;
94 | }
--------------------------------------------------------------------------------
/media/dataTables.english.txt:
--------------------------------------------------------------------------------
1 | {
2 | "sProcessing": "Wait...",
3 | "sLengthMenu": "Show _MENU_ entries",
4 | "sZeroRecords": "No data available in table.",
5 | "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
6 | "sInfoEmpty": "Showing 0 to 0 of 0 entries",
7 | "sInfoFiltered": "(filtered from _MAX_ total entries)",
8 | "sInfoPostFix": "",
9 | "sSearch": "Search:",
10 | "sUrl": "",
11 | "oPaginate": {
12 | "sFirst": "First",
13 | "sPrevious": "Previous",
14 | "sNext": "Next",
15 | "sLast": "Last"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/media/dataTables.russian.txt:
--------------------------------------------------------------------------------
1 | {
2 | "sProcessing": "Подождите...",
3 | "sLengthMenu": "Показать _MENU_ записей",
4 | "sZeroRecords": "Записи отсутствуют.",
5 | "sInfo": "Записи с _START_ до _END_ из _TOTAL_ записей",
6 | "sInfoEmpty": "Записи с 0 до 0 из 0 записей",
7 | "sInfoFiltered": "(отфильтровано из _MAX_ записей)",
8 | "sInfoPostFix": "",
9 | "sSearch": "Поиск:",
10 | "sUrl": "",
11 | "oPaginate": {
12 | "sFirst": "Первая",
13 | "sPrevious": "Предыдущая",
14 | "sNext": "Следующая",
15 | "sLast": "Последняя"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/media/images/Sorting icons.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/Sorting icons.psd
--------------------------------------------------------------------------------
/media/images/back_disabled.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/back_disabled.jpg
--------------------------------------------------------------------------------
/media/images/back_enabled.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/back_enabled.jpg
--------------------------------------------------------------------------------
/media/images/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/background.png
--------------------------------------------------------------------------------
/media/images/collection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/collection.png
--------------------------------------------------------------------------------
/media/images/collection_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/collection_hover.png
--------------------------------------------------------------------------------
/media/images/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/copy.png
--------------------------------------------------------------------------------
/media/images/copy_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/copy_hover.png
--------------------------------------------------------------------------------
/media/images/csv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/csv.png
--------------------------------------------------------------------------------
/media/images/csv_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/csv_hover.png
--------------------------------------------------------------------------------
/media/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/favicon.ico
--------------------------------------------------------------------------------
/media/images/forward_disabled.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/forward_disabled.jpg
--------------------------------------------------------------------------------
/media/images/forward_enabled.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/forward_enabled.jpg
--------------------------------------------------------------------------------
/media/images/pdf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/pdf.png
--------------------------------------------------------------------------------
/media/images/pdf_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/pdf_hover.png
--------------------------------------------------------------------------------
/media/images/print.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/print.png
--------------------------------------------------------------------------------
/media/images/print_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/print_hover.png
--------------------------------------------------------------------------------
/media/images/psd/collection.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/psd/collection.psd
--------------------------------------------------------------------------------
/media/images/psd/copy document.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/psd/copy document.psd
--------------------------------------------------------------------------------
/media/images/psd/file_types.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/psd/file_types.psd
--------------------------------------------------------------------------------
/media/images/psd/printer.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/psd/printer.psd
--------------------------------------------------------------------------------
/media/images/sort_asc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/sort_asc.png
--------------------------------------------------------------------------------
/media/images/sort_asc_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/sort_asc_disabled.png
--------------------------------------------------------------------------------
/media/images/sort_both.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/sort_both.png
--------------------------------------------------------------------------------
/media/images/sort_desc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/sort_desc.png
--------------------------------------------------------------------------------
/media/images/sort_desc_disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/sort_desc_disabled.png
--------------------------------------------------------------------------------
/media/images/xls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/xls.png
--------------------------------------------------------------------------------
/media/images/xls_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mazay/pure-ftpd-webui/3510ea5d3298521ef32f5db63d765cda3954cbb1/media/images/xls_hover.png
--------------------------------------------------------------------------------
/media/unit_testing/controller.js:
--------------------------------------------------------------------------------
1 | var giTotalTestCount = 0;
2 | var giActiveModule = 0;
3 | var giModuleTests;
4 | var giStartTime;
5 | var giTest;
6 | var gbStop = false;
7 | var gtoTest;
8 |
9 | function fnTestStart ( sTestInfo )
10 | {
11 | gaoTest[ giActiveModule ].iTests++;
12 | document.getElementById('test_info').innerHTML +=
13 | (giActiveModule+1)+'.'+(giModuleTests+1)+'. '+sTestInfo+'... ';
14 | document.getElementById('test_number').innerHTML = giTotalTestCount+1;
15 | giModuleTests++;
16 | giTotalTestCount++;
17 |
18 | /* Set a timer to catch stalled script */
19 | gtoTest = setTimeout( function () {
20 | fnMessage( 'WARNING - test script stalled. Likely a JS error' );
21 | gbStop = true;
22 | }, 3000 );
23 | }
24 |
25 | function fnTestResult ( bResult )
26 | {
27 | clearTimeout( gtoTest );
28 | if ( bResult )
29 | {
30 | fnMessage( 'Passed' );
31 | }
32 | else
33 | {
34 | fnMessage( 'FAILED' );
35 | gbStop = true;
36 | fnEnd( false );
37 | }
38 | }
39 |
40 | function fnUnitStart( iTest )
41 | {
42 | if ( !gbStop )
43 | {
44 | giModuleTests = 0;
45 | window.parent.test_arena.location.href =
46 | (iTest==0?"":"../")+'templates/'+gaoTest[iTest].sTemplate+'.php?scripts='+gaoTest[iTest].sTest;
47 | giTest = iTest;
48 | }
49 | }
50 |
51 | function fnStartMessage( sMessage )
52 | {
53 | fnMessage( ' '+gaoTest[giTest].sGroup+' - '+sMessage+'' );
54 | }
55 |
56 | function fnMessage( sMessage )
57 | {
58 | var nInfo = document.getElementById('test_info');
59 | nInfo.innerHTML += sMessage+' ';
60 | nInfo.scrollTop = nInfo.scrollHeight;
61 | }
62 |
63 | function fnUnitComplete()
64 | {
65 | if ( giActiveModule < gaoTest.length - 1 )
66 | {
67 | fnUnitStart( ++giActiveModule );
68 | }
69 | else
70 | {
71 | fnEnd( true );
72 | }
73 | }
74 |
75 | function fnEnd( bSuccess )
76 | {
77 | var iEndTime = new Date().getTime();
78 | var sTime = ' This test run took '+parseInt((iEndTime-giStartTime)/1000, 10)+
79 | ' second(s) to complete.';
80 |
81 | if ( bSuccess )
82 | {
83 | $('#test_running').html( 'Tests complete. '+giTotalTestCount+' tests were run.'+sTime );
84 | }
85 | else
86 | {
87 | $('#test_running').html( 'Unit tests failed at test '+giTotalTestCount+'.'+sTime );
88 | }
89 | }
90 |
91 | $(document).ready( function () {
92 | giStartTime = new Date().getTime();
93 | fnUnitStart( giActiveModule );
94 | } );
--------------------------------------------------------------------------------
/media/unit_testing/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/media/unit_testing/templates/dymanic_table.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 | DataTables unit testing
14 |
18 |
19 |
20 |
21 |
26 | '."\n";
31 | }
32 | ?>
33 |
34 |
35 |
36 |
37 | DataTables dynamic table template
38 |
39 |
40 | Live example
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/media/unit_testing/templates/empty_table.php:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 | DataTables unit testing
14 |
18 |
19 |
20 |
21 | '."\n";
26 | }
27 | ?>
28 |
29 |
30 |
31 |
32 | DataTables empty table template
33 |
34 |
35 | Live example
36 |
37 |
38 |
39 |
40 | Rendering engine |
41 | Browser |
42 | Platform(s) |
43 | Engine version |
44 | CSS grade |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/-complex_header.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: -complex_header
2 | oTest.fnStart( "Complex header" );
3 |
4 |
5 | $(document).ready( function () {
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Sorting on colspan has no effect",
10 | function () { $('#example thead th:eq(1)').click(); },
11 | function () { return $('#example tbody tr td:eq(1)').html() == "Firefox 1.0"; }
12 | );
13 |
14 | oTest.fnTest(
15 | "Sorting on non-unique TH and first TH has no effect",
16 | function () { $('#example thead th:eq(2)').click(); },
17 | function () { return $('#example tbody tr td:eq(1)').html() == "Firefox 1.0"; }
18 | );
19 |
20 | oTest.fnTest(
21 | "Sorting on non-unique TH and second TH will not sort",
22 | function () { $('#example thead th:eq(6)').click(); },
23 | function () { return $('#example tbody tr td:eq(4)').html() == "A"; }
24 | );
25 |
26 | oTest.fnTest(
27 | "Sorting on non-unique TH and second TH will not sort - reserve",
28 | function () { $('#example thead th:eq(6)').click(); },
29 | function () { return $('#example tbody tr td:eq(4)').html() == "A"; }
30 | );
31 |
32 | oTest.fnTest(
33 | "Sorting on unique TH will sort",
34 | function () { $('#example thead th:eq(5)').click(); },
35 | function () { return $('#example tbody tr td:eq(3)').html() == "-"; }
36 | );
37 |
38 | oTest.fnTest(
39 | "Sorting on unique TH will sort - reserve",
40 | function () { $('#example thead th:eq(5)').click(); },
41 | function () { return $('#example tbody tr td:eq(3)').html() == "522.1"; }
42 | );
43 |
44 | oTest.fnTest(
45 | "Sorting on unique rowspan TH will sort",
46 | function () { $('#example thead th:eq(0)').click(); },
47 | function () { return $('#example tbody tr td:eq(0)').html() == "Gecko"; }
48 | );
49 |
50 |
51 | oTest.fnComplete();
52 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/-iDraw.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "iDraw - check that iDraw increments for each draw" );
3 |
4 |
5 | $(document).ready( function () {
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "After first draw, iDraw is 1",
11 | null,
12 | function () { return oSettings.iDraw == 1; }
13 | );
14 |
15 | oTest.fnTest(
16 | "After second draw, iDraw is 2",
17 | function () { oTable.fnDraw() },
18 | function () { return oSettings.iDraw == 2; }
19 | );
20 |
21 | oTest.fnTest(
22 | "After sort",
23 | function () { oTable.fnSort([[1,'asc']]) },
24 | function () { return oSettings.iDraw == 3; }
25 | );
26 |
27 | oTest.fnTest(
28 | "After filter",
29 | function () { oTable.fnFilter('gecko') },
30 | function () { return oSettings.iDraw == 4; }
31 | );
32 |
33 | oTest.fnTest(
34 | "After another filter",
35 | function () { oTable.fnFilter('gec') },
36 | function () { return oSettings.iDraw == 5; }
37 | );
38 |
39 |
40 | oTest.fnComplete();
41 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2512.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: 2512
2 | oTest.fnStart( "Check filtering with BR and HTML entity" );
3 |
4 |
5 | $(document).ready( function () {
6 | $('#example').dataTable();
7 |
8 | /* Basic checks */
9 | oTest.fnTest(
10 | "Check filtering",
11 | function () { $('#example').dataTable().fnFilter('testsearchstring'); },
12 | function () { return $('#example tbody tr').length == 1; }
13 | );
14 |
15 |
16 | oTest.fnComplete();
17 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2530-2.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "User given with is left when no scrolling" );
3 |
4 | $(document).ready( function () {
5 | $('#example')[0].style.width = "80%";
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Check user width is left",
10 | null,
11 | function () { return $('#example').width() == 640; }
12 | );
13 |
14 | oTest.fnComplete();
15 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2530.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dymanic_table
2 | oTest.fnStart( "2530 - Check width's when dealing with empty strings" );
3 |
4 |
5 | $(document).ready( function () {
6 | $('#example').dataTable( {
7 | "aaData": [
8 | ['','Internet Explorer 4.0','Win 95+','4','X'],
9 | ['','Internet Explorer 5.0','Win 95+','5','C']
10 | ],
11 | "aoColumns": [
12 | { "sTitle": "", "sWidth": "40px" },
13 | { "sTitle": "Browser" },
14 | { "sTitle": "Platform" },
15 | { "sTitle": "Version", "sClass": "center" },
16 | { "sTitle": "Grade", "sClass": "center" }
17 | ]
18 | } );
19 |
20 | /* Basic checks */
21 | oTest.fnTest(
22 | "Check calculated widths",
23 | null,
24 | function () { return $('#example tbody tr td:eq(0)').width() < 100; }
25 | );
26 |
27 |
28 | oTest.fnComplete();
29 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2569.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "Destroy with hidden columns" );
3 |
4 | $(document).ready( function () {
5 | $('#example').dataTable( {
6 | "aoColumnDefs": [
7 | { "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },
8 | { "bVisible": false, "aTargets": [ 3 ] }
9 | ]
10 | } );
11 | $('#example').dataTable().fnDestroy();
12 |
13 | oTest.fnTest(
14 | "Check that the number of columns in table is correct",
15 | null,
16 | function () { return $('#example tbody tr:eq(0) td').length == 5; }
17 | );
18 |
19 |
20 | oTest.fnTest(
21 | "And with scrolling",
22 | function () {
23 | $('#example').dataTable( {
24 | "sScrollY": 200,
25 | "aoColumnDefs": [
26 | { "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },
27 | { "bVisible": false, "aTargets": [ 3 ] }
28 | ]
29 | } );
30 | $('#example').dataTable().fnDestroy();
31 | },
32 | function () { return $('#example tbody tr:eq(0) td').length == 5; }
33 | );
34 |
35 | oTest.fnComplete();
36 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2600.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "2600 - Display rewind when changing length" );
3 |
4 | $(document).ready( function () {
5 | $('#example').dataTable();
6 |
7 | oTest.fnTest(
8 | "Info correct on init",
9 | null,
10 | function () { return $('#example_info').html() == "Showing 1 to 10 of 57 entries"; }
11 | );
12 |
13 | oTest.fnTest(
14 | "Page 2",
15 | function () { $('#example_next').click(); },
16 | function () { return $('#example_info').html() == "Showing 11 to 20 of 57 entries"; }
17 | );
18 |
19 | oTest.fnTest(
20 | "Page 3",
21 | function () { $('#example_next').click(); },
22 | function () { return $('#example_info').html() == "Showing 21 to 30 of 57 entries"; }
23 | );
24 |
25 | oTest.fnTest(
26 | "Page 4",
27 | function () { $('#example_next').click(); },
28 | function () { return $('#example_info').html() == "Showing 31 to 40 of 57 entries"; }
29 | );
30 |
31 | oTest.fnTest(
32 | "Page 5",
33 | function () { $('#example_next').click(); },
34 | function () { return $('#example_info').html() == "Showing 41 to 50 of 57 entries"; }
35 | );
36 |
37 | oTest.fnTest(
38 | "Rewind",
39 | function () { $('#example_length select').val('100'); $('#example_length select').change(); },
40 | function () { return $('#example_info').html() == "Showing 1 to 57 of 57 entries"; }
41 | );
42 |
43 | oTest.fnComplete();
44 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2608.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "2608 - State saving escaping filters" );
3 |
4 | $(document).ready( function () {
5 | $('#example').dataTable( {
6 | "bStateSave": true
7 | } );
8 |
9 | oTest.fnTest(
10 | "Set the filter",
11 | function () {
12 | $('#example_filter input').val( '\\s*CVM\\s*$' );
13 | $('#example_filter input').keyup();
14 | },
15 | function () { return $('#example_filter input').val() == '\\s*CVM\\s*$'; }
16 | );
17 |
18 | oTest.fnTest(
19 | "Destroy the table and remake it - checking the filter was saved",
20 | function () {
21 | $('#example').dataTable( {
22 | "bStateSave": true,
23 | "bDestroy": true
24 | } );
25 | },
26 | function () { return $('#example_filter input').val() == '\\s*CVM\\s*$'; }
27 | );
28 |
29 | oTest.fnTest(
30 | "Do it again without state saving and make sure filter is empty",
31 | function () {
32 | $('#example').dataTable( {
33 | "bDestroy": true
34 | } );
35 | },
36 | function () { return $('#example_filter input').val() == ''; }
37 | );
38 |
39 | oTest.fnTest(
40 | "Clean up",
41 | function () {
42 | $('#example').dataTable( {
43 | "bStateSave": true,
44 | "bDestroy": true
45 | } );
46 | $('#example_filter input').val( '' );
47 | $('#example_filter input').keyup();
48 | },
49 | function () { return $('#example_filter input').val() == ''; }
50 | );
51 |
52 | oTest.fnCookieDestroy( $('#example').dataTable() );
53 | oTest.fnComplete();
54 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2635.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "2635 - Hiding column and state saving" );
3 |
4 | $(document).ready( function () {
5 | $('#example').dataTable( {
6 | "bStateSave": true
7 | } );
8 |
9 | oTest.fnTest(
10 | "Set the hidden column",
11 | function () {
12 | $('#example').dataTable().fnSetColumnVis( 2, false );
13 | },
14 | function () { return $('#example thead th').length == 4; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Destroy the table and remake it - checking one column was removed",
19 | function () {
20 | $('#example').dataTable( {
21 | "bStateSave": true,
22 | "bDestroy": true
23 | } );
24 | },
25 | function () { return $('#example thead th').length == 4; }
26 | );
27 |
28 | oTest.fnTest(
29 | "Do it again without state saving and make sure we are back to 5 columns",
30 | function () {
31 | $('#example').dataTable( {
32 | "bDestroy": true
33 | } );
34 | },
35 | function () { return $('#example thead th').length == 5; }
36 | );
37 |
38 | oTest.fnCookieDestroy( $('#example').dataTable() );
39 | oTest.fnComplete();
40 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2799.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: two_tables
2 | oTest.fnStart( "Initialise two tables" );
3 |
4 | $(document).ready( function () {
5 | $('table.display').dataTable();
6 |
7 | oTest.fnTest(
8 | "Check that initialisation was okay",
9 | null,
10 | function () { return true; }
11 | );
12 |
13 | oTest.fnComplete();
14 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2840-restore-table-width.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "2840 - Restore table width on fnDestory" );
3 |
4 | $(document).ready( function () {
5 | document.cookie = "";
6 | $('#example').dataTable( {
7 | "sScrollX": "100%",
8 | "sScrollXInner": "110%"
9 | } );
10 | $('#example').dataTable().fnDestroy();
11 |
12 | oTest.fnTest(
13 | "Width after destroy",
14 | null,
15 | function () { return $('#example').width() == "800"; }
16 | );
17 |
18 | oTest.fnComplete();
19 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/2914-state-save-sort.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "2914 - State saving with an empty array" );
3 |
4 | $(document).ready( function () {
5 | document.cookie = "";
6 | $('#example').dataTable( {
7 | "bStateSave": true,
8 | "aaSorting": []
9 | } );
10 |
11 | oTest.fnTest(
12 | "No sort",
13 | null,
14 | function () { return $('#example tbody td:eq(3)').html() == "4"; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Next page",
19 | function () {
20 | $('#example').dataTable().fnPageChange( 'next' );
21 | },
22 | function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
23 | );
24 |
25 | oTest.fnTest(
26 | "Destroy the table and remake it - checking we are still on the next page",
27 | function () {
28 | $('#example').dataTable( {
29 | "bStateSave": true,
30 | "aaSorting": [],
31 | "bDestroy": true
32 | } );
33 | },
34 | function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
35 | );
36 |
37 | oTest.fnCookieDestroy( $('#example').dataTable() );
38 | oTest.fnComplete();
39 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/aaSortingFixed.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "aaSortingFixed" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "No fixed sorting by default",
11 | null,
12 | function () {
13 | return oSettings.aaSortingFixed == null;
14 | }
15 | );
16 |
17 |
18 | oTest.fnTest(
19 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)",
20 | function () {
21 | oSession.fnRestore();
22 | $('#example').dataTable( {
23 | "aaSortingFixed": [['0','asc']]
24 | } );
25 | $('#example thead th:eq(1)').click();
26 | },
27 | function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
28 | );
29 |
30 | oTest.fnTest(
31 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)",
32 | function () {
33 | $('#example thead th:eq(1)').click();
34 | },
35 | function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
36 | );
37 |
38 | oTest.fnTest(
39 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)",
40 | function () {
41 | oSession.fnRestore();
42 | $('#example').dataTable( {
43 | "aaSortingFixed": [['3','asc']]
44 | } );
45 | $('#example thead th:eq(1)').click();
46 | },
47 | function () { return $('#example tbody td:eq(1)').html() == "All others"; }
48 | );
49 |
50 | oTest.fnTest(
51 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)",
52 | function () {
53 | $('#example thead th:eq(1)').click();
54 | },
55 | function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; }
56 | );
57 |
58 |
59 | oTest.fnComplete();
60 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/aoColumns.bSearchable.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "aoColumns.bSeachable" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Columns are searchable by default",
11 | function () { oTable.fnFilter("Camino"); },
12 | function () { return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/); }
13 | );
14 |
15 | oTest.fnTest(
16 | "Disabling sorting on a column removes it from the global filter",
17 | function () {
18 | oSession.fnRestore();
19 | oTable = $('#example').dataTable( {
20 | "aoColumns": [
21 | null,
22 | { "bSearchable": false },
23 | null,
24 | null,
25 | null
26 | ]
27 | } );
28 | oSettings = oTable.fnSettings();
29 | oTable.fnFilter("Camino");
30 | },
31 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
32 | );
33 |
34 | oTest.fnTest(
35 | "Disabled on one column has no effect on other columns",
36 | function () { oTable.fnFilter("Webkit"); },
37 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
38 | );
39 |
40 | oTest.fnTest(
41 | "Disable filtering on multiple columns",
42 | function () {
43 | oSession.fnRestore();
44 | oTable = $('#example').dataTable( {
45 | "aoColumns": [
46 | { "bSearchable": false },
47 | { "bSearchable": false },
48 | null,
49 | null,
50 | null
51 | ]
52 | } );
53 | oSettings = oTable.fnSettings();
54 | oTable.fnFilter("Webkit");
55 | },
56 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
57 | );
58 |
59 | oTest.fnTest(
60 | "Filter on second disabled column",
61 | function () { oTable.fnFilter("Camino"); },
62 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
63 | );
64 |
65 |
66 | oTest.fnComplete();
67 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/aoColumns.sName.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "aoColumns.sName" );
3 |
4 | /* This has no effect at all in DOM methods - so we just check that it has applied the name */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aoColumns": [
10 | null,
11 | null,
12 | null,
13 | { "sName": 'unit test' },
14 | null
15 | ]
16 | } );
17 | var oSettings = oTable.fnSettings();
18 |
19 | oTest.fnTest(
20 | "Names are stored in the columns object",
21 | null,
22 | function () { return oSettings.aoColumns[3].sName =="unit test"; }
23 | );
24 |
25 |
26 | oTest.fnComplete();
27 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/aoColumns.sTitle.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "aoColumns.sTitle" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Column names are read from the DOM by default",
11 | null,
12 | function () {
13 | var jqNodes = $('#example thead tr:eq(0) th');
14 | var bReturn =
15 | jqNodes[0].innerHTML == "Rendering engine" &&
16 | jqNodes[1].innerHTML == "Browser" &&
17 | jqNodes[2].innerHTML == "Platform(s)" &&
18 | jqNodes[3].innerHTML == "Engine version" &&
19 | jqNodes[4].innerHTML == "CSS grade";
20 | return bReturn;
21 | }
22 | );
23 |
24 | oTest.fnTest(
25 | "Can set a single column title - and others are read from DOM",
26 | function () {
27 | oSession.fnRestore();
28 | $('#example').dataTable( {
29 | "aoColumns": [
30 | null,
31 | { "sTitle": 'unit test' },
32 | null,
33 | null,
34 | null
35 | ]
36 | } );
37 | },
38 | function () {
39 | var jqNodes = $('#example thead tr:eq(0) th');
40 | var bReturn =
41 | jqNodes[0].innerHTML == "Rendering engine" &&
42 | jqNodes[1].innerHTML == "unit test" &&
43 | jqNodes[2].innerHTML == "Platform(s)" &&
44 | jqNodes[3].innerHTML == "Engine version" &&
45 | jqNodes[4].innerHTML == "CSS grade";
46 | return bReturn;
47 | }
48 | );
49 |
50 | oTest.fnTest(
51 | "Can set multiple column titles",
52 | function () {
53 | oSession.fnRestore();
54 | $('#example').dataTable( {
55 | "aoColumns": [
56 | null,
57 | { "sTitle": 'unit test 1' },
58 | null,
59 | null,
60 | { "sTitle": 'unit test 2' }
61 | ]
62 | } );
63 | },
64 | function () {
65 | var jqNodes = $('#example thead tr:eq(0) th');
66 | var bReturn =
67 | jqNodes[0].innerHTML == "Rendering engine" &&
68 | jqNodes[1].innerHTML == "unit test 1" &&
69 | jqNodes[2].innerHTML == "Platform(s)" &&
70 | jqNodes[3].innerHTML == "Engine version" &&
71 | jqNodes[4].innerHTML == "unit test 2";
72 | return bReturn;
73 | }
74 | );
75 |
76 |
77 | oTest.fnComplete();
78 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/aoColumns.sWidth.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "aoColumns.sWidth" );
3 |
4 | /* NOTE - we need to disable the auto width for the majority of these test in order to preform
5 | * these tests as the auto width will convert the width to a px value. We can do 'non-exact' tests
6 | * with auto width enabled however to ensure it scales columns as required
7 | */
8 |
9 | $(document).ready( function () {
10 | /* Check the default */
11 | var oTable = $('#example').dataTable( {
12 | "bAutoWidth": false,
13 | "aoColumns": [
14 | null,
15 | { "sWidth": '40%' },
16 | null,
17 | null,
18 | null
19 | ]
20 | } );
21 | var oSettings = oTable.fnSettings();
22 |
23 | oTest.fnTest(
24 | "With auto width disabled the width for one column is appled",
25 | null,
26 | function () { return $('#example thead th:eq(1)')[0].style.width == "40%"; }
27 | );
28 |
29 | oTest.fnTest(
30 | "With auto width disabled the width for one column is appled",
31 | function () {
32 | oSession.fnRestore();
33 | oTable = $('#example').dataTable( {
34 | "bAutoWidth": false,
35 | "aoColumns": [
36 | null,
37 | null,
38 | { "sWidth": '20%' },
39 | { "sWidth": '30%' },
40 | null
41 | ]
42 | } );
43 | },
44 | function () {
45 | var bReturn =
46 | $('#example thead th:eq(2)')[0].style.width == "20%" &&
47 | $('#example thead th:eq(3)')[0].style.width == "30%";
48 | return bReturn;
49 | }
50 | );
51 |
52 |
53 | oTest.fnTest(
54 | "With auto width, it will make the smallest column the largest with percentage width given",
55 | function () {
56 | oSession.fnRestore();
57 | oTable = $('#example').dataTable( {
58 | "aoColumns": [
59 | null,
60 | null,
61 | null,
62 | { "sWidth": '40%' },
63 | null
64 | ]
65 | } );
66 | },
67 | function () {
68 | var anThs = $('#example thead th');
69 | var a0 = anThs[0].offsetWidth;
70 | var a1 = anThs[1].offsetWidth;
71 | var a2 = anThs[2].offsetWidth;
72 | var a3 = anThs[3].offsetWidth;
73 | var a4 = anThs[4].offsetWidth;
74 |
75 | if ( a3>a0 && a3>a1 && a3>a2 && a3>a4 )
76 | return true;
77 | else
78 | return false;
79 | }
80 | );
81 |
82 |
83 | oTest.fnComplete();
84 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/bFilter.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "bFilter" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Filtering div exists by default",
10 | null,
11 | function () { return document.getElementById('example_filter') != null; }
12 | );
13 |
14 | /* Check can disable */
15 | oTest.fnTest(
16 | "Fltering can be disabled",
17 | function () {
18 | oSession.fnRestore();
19 | $('#example').dataTable( {
20 | "bFilter": false
21 | } );
22 | },
23 | function () { return document.getElementById('example_filter') == null; }
24 | );
25 |
26 | /* Enable makes no difference */
27 | oTest.fnTest(
28 | "Filtering enabled override",
29 | function () {
30 | oSession.fnRestore();
31 | $('#example').dataTable( {
32 | "bFilter": true
33 | } );
34 | },
35 | function () { return document.getElementById('example_filter') != null; }
36 | );
37 |
38 |
39 | oTest.fnComplete();
40 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/bInfo.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "bInfo" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Info div exists by default",
10 | null,
11 | function () { return document.getElementById('example_info') != null; }
12 | );
13 |
14 | /* Check can disable */
15 | oTest.fnTest(
16 | "Info can be disabled",
17 | function () {
18 | oSession.fnRestore();
19 | $('#example').dataTable( {
20 | "bInfo": false
21 | } );
22 | },
23 | function () { return document.getElementById('example_info') == null; }
24 | );
25 |
26 | /* Enable makes no difference */
27 | oTest.fnTest(
28 | "Info enabled override",
29 | function () {
30 | oSession.fnRestore();
31 | $('#example').dataTable( {
32 | "bInfo": true
33 | } );
34 | },
35 | function () { return document.getElementById('example_info') != null; }
36 | );
37 |
38 |
39 | oTest.fnComplete();
40 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/bJQueryUI.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "bJQueryUI" );
3 |
4 | $(document).ready( function () {
5 | $('#example').dataTable( {
6 | "bJQueryUI": true
7 | } );
8 |
9 | oTest.fnTest(
10 | "Header elements are fully wrapped by DIVs",
11 | null,
12 | function () {
13 | var test = true;
14 | $('#example thead th').each( function () {
15 | if ( this.childNodes > 1 ) {
16 | test = false;
17 | }
18 | } );
19 | return test;
20 | }
21 | );
22 |
23 | oTest.fnTest(
24 | "One div for each header element",
25 | null,
26 | function () {
27 | return $('#example thead th div').length == 5;
28 | }
29 | );
30 |
31 | oTest.fnTest(
32 | "One span for each header element, nested as child of div",
33 | null,
34 | function () {
35 | return $('#example thead th div>span').length == 5;
36 | }
37 | );
38 |
39 | oTest.fnComplete();
40 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/bLengthChange.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "bLengthChange" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Length div exists by default",
10 | null,
11 | function () { return document.getElementById('example_length') != null; }
12 | );
13 |
14 | oTest.fnTest(
15 | "Four default options",
16 | null,
17 | function () { return $("select[name=example_length] option").length == 4; }
18 | );
19 |
20 | oTest.fnTest(
21 | "Default options",
22 | null,
23 | function () {
24 | var opts = $("select[name='example_length'] option");
25 | return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
26 | opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
27 | }
28 | );
29 |
30 | oTest.fnTest(
31 | "Info takes length into account",
32 | null,
33 | function () { return document.getElementById('example_info').innerHTML ==
34 | "Showing 1 to 10 of 57 entries"; }
35 | );
36 |
37 | /* Check can disable */
38 | oTest.fnTest(
39 | "Change length can be disabled",
40 | function () {
41 | oSession.fnRestore();
42 | $('#example').dataTable( {
43 | "bLengthChange": false
44 | } );
45 | },
46 | function () { return document.getElementById('example_length') == null; }
47 | );
48 |
49 | oTest.fnTest(
50 | "Information takes length disabled into account",
51 | null,
52 | function () { return document.getElementById('example_info').innerHTML ==
53 | "Showing 1 to 10 of 57 entries"; }
54 | );
55 |
56 | /* Enable makes no difference */
57 | oTest.fnTest(
58 | "Length change enabled override",
59 | function () {
60 | oSession.fnRestore();
61 | $('#example').dataTable( {
62 | "bLengthChange": true
63 | } );
64 | },
65 | function () { return document.getElementById('example_length') != null; }
66 | );
67 |
68 |
69 |
70 | oTest.fnComplete();
71 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/bPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "bPaginate" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Pagiantion div exists by default",
10 | null,
11 | function () { return document.getElementById('example_paginate') != null; }
12 | );
13 |
14 | oTest.fnTest(
15 | "Information div takes paging into account",
16 | null,
17 | function () { return document.getElementById('example_info').innerHTML ==
18 | "Showing 1 to 10 of 57 entries"; }
19 | );
20 |
21 | /* Check can disable */
22 | oTest.fnTest(
23 | "Pagiantion can be disabled",
24 | function () {
25 | oSession.fnRestore();
26 | $('#example').dataTable( {
27 | "bPaginate": false
28 | } );
29 | },
30 | function () { return document.getElementById('example_paginate') == null; }
31 | );
32 |
33 | oTest.fnTest(
34 | "Information div takes paging disabled into account",
35 | null,
36 | function () { return document.getElementById('example_info').innerHTML ==
37 | "Showing 1 to 57 of 57 entries"; }
38 | );
39 |
40 | /* Enable makes no difference */
41 | oTest.fnTest(
42 | "Pagiantion enabled override",
43 | function () {
44 | oSession.fnRestore();
45 | $('#example').dataTable( {
46 | "bPaginate": true
47 | } );
48 | },
49 | function () { return document.getElementById('example_paginate') != null; }
50 | );
51 |
52 |
53 |
54 | oTest.fnComplete();
55 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/bServerSide.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "bServerSide" );
3 |
4 | /* Not interested in server-side processing here other than to check that it is off */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable();
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Server side is off by default",
13 | null,
14 | function () { return oSettings.oFeatures.bServerSide == false; }
15 | );
16 |
17 | oTest.fnComplete();
18 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/fnDeleteRow.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "fnDeleteRow" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Check that the default data is sane",
11 | null,
12 | function () { return oSettings.asDataSearch.join(' ').match(/4.0/g).length == 3; }
13 | );
14 |
15 | oTest.fnTest(
16 | "Remove the first data row, and check that hte search data has been updated",
17 | function () { oTable.fnDeleteRow( 0 ); },
18 | function () { return oSettings.asDataSearch.join(' ').match(/4.0/g).length == 2; }
19 | );
20 |
21 | oTest.fnTest(
22 | "Check that the info element has been updated",
23 | null,
24 | function () { return $('#example_info').html() == "Showing 1 to 10 of 56 entries"; }
25 | );
26 |
27 |
28 |
29 | oTest.fnComplete();
30 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/fnDrawCallback.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "fnDrawCallback" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable();
9 | var oSettings = oTable.fnSettings();
10 | var mPass;
11 |
12 | oTest.fnTest(
13 | "Default should be null",
14 | null,
15 | function () { return oSettings.fnDrawCallback == null; }
16 | );
17 |
18 |
19 | oTest.fnTest(
20 | "One argument passed",
21 | function () {
22 | oSession.fnRestore();
23 |
24 | mPass = -1;
25 | $('#example').dataTable( {
26 | "fnDrawCallback": function ( ) {
27 | mPass = arguments.length;
28 | }
29 | } );
30 | },
31 | function () { return mPass == 1; }
32 | );
33 |
34 |
35 | oTest.fnTest(
36 | "That one argument is the settings object",
37 | function () {
38 | oSession.fnRestore();
39 |
40 | oTable = $('#example').dataTable( {
41 | "fnDrawCallback": function ( oSettings ) {
42 | mPass = oSettings;
43 | }
44 | } );
45 | },
46 | function () { return oTable.fnSettings() == mPass; }
47 | );
48 |
49 |
50 | oTest.fnTest(
51 | "fnRowCallback called once on first draw",
52 | function () {
53 | oSession.fnRestore();
54 |
55 | mPass = 0;
56 | $('#example').dataTable( {
57 | "fnDrawCallback": function ( ) {
58 | mPass++;
59 | }
60 | } );
61 | },
62 | function () { return mPass == 1; }
63 | );
64 |
65 | oTest.fnTest(
66 | "fnRowCallback called once on each draw there after as well",
67 | function () {
68 | $('#example_next').click();
69 | $('#example_next').click();
70 | $('#example_next').click();
71 | },
72 | function () { return mPass == 4; }
73 | );
74 |
75 |
76 |
77 |
78 |
79 | oTest.fnComplete();
80 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/fnInitComplete.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "fnInitComplete" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable();
9 | var oSettings = oTable.fnSettings();
10 | var mPass;
11 |
12 | oTest.fnTest(
13 | "Default should be null",
14 | null,
15 | function () { return oSettings.fnInitComplete == null; }
16 | );
17 |
18 |
19 | oTest.fnTest(
20 | "One argument passed (for DOM!)",
21 | function () {
22 | oSession.fnRestore();
23 |
24 | mPass = -1;
25 | $('#example').dataTable( {
26 | "fnInitComplete": function ( ) {
27 | mPass = arguments.length;
28 | }
29 | } );
30 | },
31 | function () { return mPass == 1; }
32 | );
33 |
34 |
35 | oTest.fnTest(
36 | "That one argument is the settings object",
37 | function () {
38 | oSession.fnRestore();
39 |
40 | oTable = $('#example').dataTable( {
41 | "fnInitComplete": function ( oSettings ) {
42 | mPass = oSettings;
43 | }
44 | } );
45 | },
46 | function () { return oTable.fnSettings() == mPass; }
47 | );
48 |
49 |
50 | oTest.fnTest(
51 | "fnInitComplete called once on first draw",
52 | function () {
53 | oSession.fnRestore();
54 |
55 | mPass = 0;
56 | $('#example').dataTable( {
57 | "fnInitComplete": function ( ) {
58 | mPass++;
59 | }
60 | } );
61 | },
62 | function () { return mPass == 1; }
63 | );
64 |
65 | oTest.fnTest(
66 | "fnInitComplete never called there after",
67 | function () {
68 | $('#example_next').click();
69 | $('#example_next').click();
70 | $('#example_next').click();
71 | },
72 | function () { return mPass == 1; }
73 | );
74 |
75 |
76 | oTest.fnWaitTest(
77 | "10 rows in the table on complete",
78 | function () {
79 | oSession.fnRestore();
80 |
81 | mPass = 0;
82 | $('#example').dataTable( {
83 | "fnInitComplete": function ( ) {
84 | mPass = $('#example tbody tr').length;
85 | }
86 | } );
87 | },
88 | function () { return mPass == 10; }
89 | );
90 |
91 |
92 |
93 | oTest.fnComplete();
94 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/fnRowCallback.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "fnRowCallback" );
3 |
4 | /* Note - fnRowCallback MUST return the first arguments (modified or not) */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable();
9 | var oSettings = oTable.fnSettings();
10 | var mPass;
11 |
12 | oTest.fnTest(
13 | "Default should be null",
14 | null,
15 | function () { return oSettings.fnRowCallback == null; }
16 | );
17 |
18 |
19 | oTest.fnTest(
20 | "Four arguments passed",
21 | function () {
22 | oSession.fnRestore();
23 |
24 | mPass = -1;
25 | $('#example').dataTable( {
26 | "fnRowCallback": function ( nTr ) {
27 | mPass = arguments.length;
28 | return nTr;
29 | }
30 | } );
31 | },
32 | function () { return mPass == 4; }
33 | );
34 |
35 |
36 | oTest.fnTest(
37 | "fnRowCallback called once for each drawn row",
38 | function () {
39 | oSession.fnRestore();
40 |
41 | mPass = 0;
42 | $('#example').dataTable( {
43 | "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
44 | mPass++;
45 | return nTr;
46 | }
47 | } );
48 | },
49 | function () { return mPass == 10; }
50 | );
51 |
52 | oTest.fnTest(
53 | "fnRowCallback allows us to alter row information",
54 | function () {
55 | oSession.fnRestore();
56 | $('#example').dataTable( {
57 | "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
58 | $(nTr).addClass('unit_test');
59 | return nTr;
60 | }
61 | } );
62 | },
63 | function () { return $('#example tbody tr:eq(1)').hasClass('unit_test'); }
64 | );
65 |
66 | oTest.fnTest(
67 | "Data array has length matching columns",
68 | function () {
69 | oSession.fnRestore();
70 |
71 | mPass = true;
72 | $('#example').dataTable( {
73 | "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
74 | if ( asData.length != 5 )
75 | mPass = false;
76 | return nTr;
77 | }
78 | } );
79 | },
80 | function () { return mPass; }
81 | );
82 |
83 | oTest.fnTest(
84 | "Data array has length matching columns",
85 | function () {
86 | oSession.fnRestore();
87 |
88 | mPass = true;
89 | var iCount = 0;
90 | $('#example').dataTable( {
91 | "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) {
92 | if ( iCount != iDrawIndex )
93 | mPass = false;
94 | iCount++;
95 | return nTr;
96 | }
97 | } );
98 | },
99 | function () { return mPass; }
100 | );
101 |
102 |
103 |
104 | oTest.fnComplete();
105 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/iDisplayLength.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "iDisplayLength" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable();
7 |
8 | oTest.fnTest(
9 | "Default length is ten",
10 | null,
11 | function () { return $('#example tbody tr').length == 10; }
12 | );
13 |
14 | oTest.fnTest(
15 | "Select menu shows 10",
16 | null,
17 | function () { return $('#example_length select').val() == 10; }
18 | );
19 |
20 |
21 | oTest.fnTest(
22 | "Set initial length to 25",
23 | function () {
24 | oSession.fnRestore();
25 | $('#example').dataTable( {
26 | "iDisplayLength": 25
27 | } );
28 | },
29 | function () { return $('#example tbody tr').length == 25; }
30 | );
31 |
32 | oTest.fnTest(
33 | "Select menu shows 25",
34 | null,
35 | function () { return $('#example_length select').val() == 25; }
36 | );
37 |
38 |
39 | oTest.fnTest(
40 | "Set initial length to 100",
41 | function () {
42 | oSession.fnRestore();
43 | $('#example').dataTable( {
44 | "iDisplayLength": 100
45 | } );
46 | },
47 | function () { return $('#example tbody tr').length == 57; }
48 | );
49 |
50 | oTest.fnTest(
51 | "Select menu shows 25",
52 | null,
53 | function () { return $('#example_length select').val() == 100; }
54 | );
55 |
56 |
57 | oTest.fnTest(
58 | "Set initial length to 23 (unknown select menu length)",
59 | function () {
60 | oSession.fnRestore();
61 | $('#example').dataTable( {
62 | "iDisplayLength": 23
63 | } );
64 | },
65 | function () { return $('#example tbody tr').length == 23; }
66 | );
67 |
68 | oTest.fnTest(
69 | "Select menu shows 10 (since 23 is unknow)",
70 | null,
71 | function () { return $('#example_length select').val() == 10; }
72 | );
73 |
74 |
75 | oTest.fnComplete();
76 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.oPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.oPaginate" );
3 |
4 | /* Note that the paging language information only has relevence in full numbers */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( { "sPaginationType": "full_numbers" } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "oLanguage.oPaginate defaults",
13 | null,
14 | function () {
15 | var bReturn =
16 | oSettings.oLanguage.oPaginate.sFirst == "First" &&
17 | oSettings.oLanguage.oPaginate.sPrevious == "Previous" &&
18 | oSettings.oLanguage.oPaginate.sNext == "Next" &&
19 | oSettings.oLanguage.oPaginate.sLast == "Last";
20 | return bReturn;
21 | }
22 | );
23 |
24 | oTest.fnTest(
25 | "oLanguage.oPaginate defaults are in the DOM",
26 | null,
27 | function () {
28 | var bReturn =
29 | $('#example_paginate .first').html() == "First" &&
30 | $('#example_paginate .previous').html() == "Previous" &&
31 | $('#example_paginate .next').html() == "Next" &&
32 | $('#example_paginate .last').html() == "Last";
33 | return bReturn;
34 | }
35 | );
36 |
37 |
38 | oTest.fnTest(
39 | "oLanguage.oPaginate can be defined",
40 | function () {
41 | oSession.fnRestore();
42 | oTable = $('#example').dataTable( {
43 | "sPaginationType": "full_numbers",
44 | "oLanguage": {
45 | "oPaginate": {
46 | "sFirst": "unit1",
47 | "sPrevious": "test2",
48 | "sNext": "unit3",
49 | "sLast": "test4"
50 | }
51 | }
52 | } );
53 | oSettings = oTable.fnSettings();
54 | },
55 | function () {
56 | var bReturn =
57 | oSettings.oLanguage.oPaginate.sFirst == "unit1" &&
58 | oSettings.oLanguage.oPaginate.sPrevious == "test2" &&
59 | oSettings.oLanguage.oPaginate.sNext == "unit3" &&
60 | oSettings.oLanguage.oPaginate.sLast == "test4";
61 | return bReturn;
62 | }
63 | );
64 |
65 | oTest.fnTest(
66 | "oLanguage.oPaginate definitions are in the DOM",
67 | null,
68 | function () {
69 | var bReturn =
70 | $('#example_paginate .first').html() == "unit1" &&
71 | $('#example_paginate .previous').html() == "test2" &&
72 | $('#example_paginate .next').html() == "unit3" &&
73 | $('#example_paginate .last').html() == "test4";
74 | return bReturn;
75 | }
76 | );
77 |
78 |
79 | oTest.fnComplete();
80 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.sInfoEmpty.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.sInfoEmpty" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Info empty language is 'Showing 0 to 0 of 0 entries' by default",
11 | function () { oTable.fnFilter("nothinghere"); },
12 | function () { return oSettings.oLanguage.sInfoEmpty == "Showing 0 to 0 of 0 entries"; }
13 | );
14 |
15 | oTest.fnTest(
16 | "Info empty language default is in the DOM",
17 | null,
18 | function () {
19 | var bReturn = document.getElementById('example_info').innerHTML.replace(
20 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
21 | "Showing 0 to 0 of 0 entries";
22 | return bReturn;
23 | }
24 | );
25 |
26 |
27 | oTest.fnTest(
28 | "Info empty language can be defined",
29 | function () {
30 | oSession.fnRestore();
31 | oTable = $('#example').dataTable( {
32 | "oLanguage": {
33 | "sInfoEmpty": "unit test"
34 | }
35 | } );
36 | oSettings = oTable.fnSettings();
37 | oTable.fnFilter("nothinghere");
38 | },
39 | function () { return oSettings.oLanguage.sInfoEmpty == "unit test"; }
40 | );
41 |
42 | oTest.fnTest(
43 | "Info empty language default is in the DOM",
44 | null,
45 | function () {
46 | var bReturn = document.getElementById('example_info').innerHTML.replace(
47 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
48 | "unit test";
49 | return bReturn;
50 | }
51 | );
52 |
53 |
54 | oTest.fnTest(
55 | "Macro's not replaced",
56 | function () {
57 | oSession.fnRestore();
58 | oTable = $('#example').dataTable( {
59 | "oLanguage": {
60 | "sInfoEmpty": "unit _START_ _END_ _TOTAL_ test"
61 | }
62 | } );
63 | oTable.fnFilter("nothinghere");
64 | },
65 | function () {
66 | var bReturn = document.getElementById('example_info').innerHTML.replace(
67 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
68 | "unit _START_ _END_ _TOTAL_ test";
69 | return bReturn;
70 | }
71 | );
72 |
73 |
74 | oTest.fnComplete();
75 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.sInfoPostFix.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.sInfoPostFix" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Info post fix language is '' (blank) by default",
11 | null,
12 | function () { return oSettings.oLanguage.sInfoPostFix == ""; }
13 | );
14 |
15 | oTest.fnTest(
16 | "Width no post fix, the basic info shows",
17 | null,
18 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; }
19 | );
20 |
21 |
22 | oTest.fnTest(
23 | "Info post fix language can be defined",
24 | function () {
25 | oSession.fnRestore();
26 | oTable = $('#example').dataTable( {
27 | "oLanguage": {
28 | "sInfoPostFix": "unit test"
29 | }
30 | } );
31 | oSettings = oTable.fnSettings();
32 | },
33 | function () { return oSettings.oLanguage.sInfoPostFix == "unit test"; }
34 | );
35 |
36 | oTest.fnTest(
37 | "Info empty language default is in the DOM",
38 | null,
39 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit test"; }
40 | );
41 |
42 |
43 | oTest.fnTest(
44 | "Macros have no effect in the post fix",
45 | function () {
46 | oSession.fnRestore();
47 | oTable = $('#example').dataTable( {
48 | "oLanguage": {
49 | "sInfoPostFix": "unit _START_ _END_ _TOTAL_ test"
50 | }
51 | } );
52 | },
53 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit _START_ _END_ _TOTAL_ test"; }
54 | );
55 |
56 |
57 | oTest.fnTest(
58 | "Post fix is applied after fintering info",
59 | function () {
60 | oSession.fnRestore();
61 | oTable = $('#example').dataTable( {
62 | "oLanguage": {
63 | "sInfoPostFix": "unit test"
64 | }
65 | } );
66 | oTable.fnFilter("nothinghere");
67 | },
68 | function () { return document.getElementById('example_info').innerHTML = "Showing 0 to 0 of 0 entries unit (filtered from 57 total entries) test"; }
69 | );
70 |
71 |
72 | oTest.fnComplete();
73 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.sProcessing.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.sProcessing" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bProcessing": true
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Processing language is 'Processing...' by default",
13 | null,
14 | function () { return oSettings.oLanguage.sProcessing == "Processing..."; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Processing language default is in the DOM",
19 | null,
20 | function () { return document.getElementById('example_processing').innerHTML = "Processing..."; }
21 | );
22 |
23 |
24 | oTest.fnTest(
25 | "Processing language can be defined",
26 | function () {
27 | oSession.fnRestore();
28 | oTable = $('#example').dataTable( {
29 | "bProcessing": true,
30 | "oLanguage": {
31 | "sProcessing": "unit test"
32 | }
33 | } );
34 | oSettings = oTable.fnSettings();
35 | },
36 | function () { return oSettings.oLanguage.sProcessing == "unit test"; }
37 | );
38 |
39 | oTest.fnTest(
40 | "Processing language definition is in the DOM",
41 | null,
42 | function () { return document.getElementById('example_processing').innerHTML = "unit test"; }
43 | );
44 |
45 |
46 | oTest.fnComplete();
47 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.sSearch.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.sSearch" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Search language is 'Search:' by default",
11 | null,
12 | function () { return oSettings.oLanguage.sSearch == "Search:"; }
13 | );
14 |
15 | oTest.fnTest(
16 | "Search language default is in the DOM",
17 | null,
18 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
19 | == "Search: "; }
20 | );
21 |
22 |
23 | oTest.fnTest(
24 | "Search language can be defined",
25 | function () {
26 | oSession.fnRestore();
27 | oTable = $('#example').dataTable( {
28 | "oLanguage": {
29 | "sSearch": "unit test"
30 | }
31 | } );
32 | oSettings = oTable.fnSettings();
33 | },
34 | function () { return oSettings.oLanguage.sSearch == "unit test"; }
35 | );
36 |
37 | oTest.fnTest(
38 | "Info language definition is in the DOM",
39 | null,
40 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
41 | == "unit test "; }
42 | );
43 |
44 |
45 | oTest.fnTest(
46 | "Blank search has a no (separator) inserted",
47 | function () {
48 | oSession.fnRestore();
49 | oTable = $('#example').dataTable( {
50 | "oLanguage": {
51 | "sSearch": ""
52 | }
53 | } );
54 | oSettings = oTable.fnSettings();
55 | },
56 | function () { return document.getElementById('example_filter').childNodes.length == 1; }
57 | );
58 |
59 |
60 | oTest.fnComplete();
61 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.sUrl.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.sUrl" );
3 |
4 | /* Note that we only test the internal storage of language information pulled form a file here
5 | * as the other language tests will check it goes into the DOM correctly
6 | */
7 |
8 | $(document).ready( function () {
9 | /* Check the default */
10 | var oTable = $('#example').dataTable();
11 | var oSettings = oTable.fnSettings();
12 |
13 | oTest.fnTest(
14 | "sUrl is blank by default",
15 | null,
16 | function () { return oSettings.oLanguage.sUrl == ""; }
17 | );
18 |
19 |
20 | oTest.fnWaitTest(
21 | "Loading of German file loads language information",
22 | function () {
23 | oSession.fnRestore();
24 | oTable = $('#example').dataTable( {
25 | "oLanguage": {
26 | "sUrl": "../../../examples/examples_support/de_DE.txt"
27 | }
28 | } );
29 | oSettings = oTable.fnSettings();
30 | },
31 | function () {
32 | var bReturn =
33 | oSettings.oLanguage.sProcessing == "Bitte warten..." &&
34 | oSettings.oLanguage.sLengthMenu == "_MENU_ Einträge anzeigen" &&
35 | oSettings.oLanguage.sZeroRecords == "Keine Einträge vorhanden." &&
36 | oSettings.oLanguage.sInfo == "_START_ bis _END_ von _TOTAL_ Einträgen" &&
37 | oSettings.oLanguage.sInfoEmpty == "0 bis 0 von 0 Einträgen" &&
38 | oSettings.oLanguage.sInfoFiltered == "(gefiltert von _MAX_ Einträgen)" &&
39 | oSettings.oLanguage.sInfoPostFix == "" &&
40 | oSettings.oLanguage.sSearch == "Suchen" &&
41 | oSettings.oLanguage.oPaginate.sFirst == "Erster" &&
42 | oSettings.oLanguage.oPaginate.sPrevious == "Zurück" &&
43 | oSettings.oLanguage.oPaginate.sNext == "Nächster" &&
44 | oSettings.oLanguage.oPaginate.sLast == "Letzter";
45 |
46 | return bReturn;
47 | }
48 | );
49 |
50 | /* One DOM check just to ensure that they go into the DOM */
51 | oTest.fnTest(
52 | "Loaded language goes into the DOM",
53 | null,
54 | function () { return document.getElementById('example_info').innerHTML = "1 bis 10 von 57 Einträgen"; }
55 | );
56 |
57 |
58 | oTest.fnComplete();
59 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/oLanguage.sZeroRecords.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "oLanguage.sZeroRecords" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable();
7 | var oSettings = oTable.fnSettings();
8 |
9 | oTest.fnTest(
10 | "Zero records language is 'No matching records found' by default",
11 | null,
12 | function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; }
13 | );
14 |
15 | oTest.fnTest(
16 | "Text is shown when empty table (after filtering)",
17 | function () { oTable.fnFilter('nothinghere'); },
18 | function () { return $('#example tbody tr td')[0].innerHTML == "No matching records found" }
19 | );
20 |
21 |
22 |
23 | oTest.fnTest(
24 | "Zero records language can be defined",
25 | function () {
26 | oSession.fnRestore();
27 | oTable = $('#example').dataTable( {
28 | "oLanguage": {
29 | "sZeroRecords": "unit test"
30 | }
31 | } );
32 | oSettings = oTable.fnSettings();
33 | },
34 | function () { return oSettings.oLanguage.sZeroRecords == "unit test"; }
35 | );
36 |
37 | oTest.fnTest(
38 | "Text is shown when empty table (after filtering)",
39 | function () { oTable.fnFilter('nothinghere2'); },
40 | function () { return $('#example tbody tr td')[0].innerHTML == "unit test" }
41 | );
42 |
43 |
44 | oTest.fnComplete();
45 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/1_dom/sAjaxSource.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: dom_data
2 | oTest.fnStart( "sAjaxSource" );
3 |
4 | /* Not interested in ajax source here other than to check it's default */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable();
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Server side is off by default",
13 | null,
14 | function () { return oSettings.sAjaxSource == null; }
15 | );
16 |
17 | oTest.fnComplete();
18 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/aaSortingFixed.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "aaSortingFixed" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "No fixed sorting by default",
13 | null,
14 | function () {
15 | return oSettings.aaSortingFixed == null;
16 | }
17 | );
18 |
19 |
20 | oTest.fnTest(
21 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)",
22 | function () {
23 | oSession.fnRestore();
24 | $('#example').dataTable( {
25 | "aaData": gaaData,
26 | "aaSortingFixed": [['0','asc']]
27 | } );
28 | $('#example thead th:eq(1)').click();
29 | },
30 | function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
31 | );
32 |
33 | oTest.fnTest(
34 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)",
35 | function () {
36 | $('#example thead th:eq(1)').click();
37 | },
38 | function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
39 | );
40 |
41 | oTest.fnTest(
42 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)",
43 | function () {
44 | oSession.fnRestore();
45 | $('#example').dataTable( {
46 | "aaData": gaaData,
47 | "aaSortingFixed": [['3','asc']]
48 | } );
49 | $('#example thead th:eq(1)').click();
50 | },
51 | function () { return $('#example tbody td:eq(1)').html() == "All others"; }
52 | );
53 |
54 | oTest.fnTest(
55 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)",
56 | function () {
57 | $('#example thead th:eq(1)').click();
58 | },
59 | function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; }
60 | );
61 |
62 |
63 | oTest.fnComplete();
64 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/aoColumns.bSearchable.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "aoColumns.bSeachable" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Columns are searchable by default",
13 | function () { oTable.fnFilter("Camino"); },
14 | function () { return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/); }
15 | );
16 |
17 | oTest.fnTest(
18 | "Disabling sorting on a column removes it from the global filter",
19 | function () {
20 | oSession.fnRestore();
21 | oTable = $('#example').dataTable( {
22 | "aaData": gaaData,
23 | "aoColumns": [
24 | null,
25 | { "bSearchable": false },
26 | null,
27 | null,
28 | null
29 | ]
30 | } );
31 | oSettings = oTable.fnSettings();
32 | oTable.fnFilter("Camino");
33 | },
34 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
35 | );
36 |
37 | oTest.fnTest(
38 | "Disabled on one column has no effect on other columns",
39 | function () { oTable.fnFilter("Webkit"); },
40 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
41 | );
42 |
43 | oTest.fnTest(
44 | "Disable filtering on multiple columns",
45 | function () {
46 | oSession.fnRestore();
47 | oTable = $('#example').dataTable( {
48 | "aaData": gaaData,
49 | "aoColumns": [
50 | { "bSearchable": false },
51 | { "bSearchable": false },
52 | null,
53 | null,
54 | null
55 | ]
56 | } );
57 | oSettings = oTable.fnSettings();
58 | oTable.fnFilter("Webkit");
59 | },
60 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
61 | );
62 |
63 | oTest.fnTest(
64 | "Filter on second disabled column",
65 | function () { oTable.fnFilter("Camino"); },
66 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
67 | );
68 |
69 |
70 | oTest.fnComplete();
71 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/aoColumns.sName.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "aoColumns.sName" );
3 |
4 | /* This has no effect at all in DOM methods - so we just check that it has applied the name */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aaData": gaaData,
10 | "aoColumns": [
11 | null,
12 | null,
13 | null,
14 | { "sName": 'unit test' },
15 | null
16 | ]
17 | } );
18 | var oSettings = oTable.fnSettings();
19 |
20 | oTest.fnTest(
21 | "Names are stored in the columns object",
22 | null,
23 | function () { return oSettings.aoColumns[3].sName =="unit test"; }
24 | );
25 |
26 |
27 | oTest.fnComplete();
28 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/aoColumns.sTitle.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "aoColumns.sTitle" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "If not given, then the columns titles are empty",
13 | null,
14 | function () {
15 | var jqNodes = $('#example thead tr:eq(0) th');
16 | var bReturn =
17 | jqNodes[0].innerHTML == "Rendering engine" &&
18 | jqNodes[1].innerHTML == "Browser" &&
19 | jqNodes[2].innerHTML == "Platform(s)" &&
20 | jqNodes[3].innerHTML == "Engine version" &&
21 | jqNodes[4].innerHTML == "CSS grade";
22 | return bReturn;
23 | }
24 | );
25 |
26 | oTest.fnTest(
27 | "Can set a single column title - and others are read from DOM",
28 | function () {
29 | oSession.fnRestore();
30 | $('#example').dataTable( {
31 | "aaData": gaaData,
32 | "aoColumns": [
33 | null,
34 | { "sTitle": 'unit test' },
35 | null,
36 | null,
37 | null
38 | ]
39 | } );
40 | },
41 | function () {
42 | var jqNodes = $('#example thead tr:eq(0) th');
43 | var bReturn =
44 | jqNodes[0].innerHTML == "Rendering engine" &&
45 | jqNodes[1].innerHTML == "unit test" &&
46 | jqNodes[2].innerHTML == "Platform(s)" &&
47 | jqNodes[3].innerHTML == "Engine version" &&
48 | jqNodes[4].innerHTML == "CSS grade";
49 | return bReturn;
50 | }
51 | );
52 |
53 | oTest.fnTest(
54 | "Can set multiple column titles",
55 | function () {
56 | oSession.fnRestore();
57 | $('#example').dataTable( {
58 | "aaData": gaaData,
59 | "aoColumns": [
60 | null,
61 | { "sTitle": 'unit test 1' },
62 | null,
63 | null,
64 | { "sTitle": 'unit test 2' }
65 | ]
66 | } );
67 | },
68 | function () {
69 | var jqNodes = $('#example thead tr:eq(0) th');
70 | var bReturn =
71 | jqNodes[0].innerHTML == "Rendering engine" &&
72 | jqNodes[1].innerHTML == "unit test 1" &&
73 | jqNodes[2].innerHTML == "Platform(s)" &&
74 | jqNodes[3].innerHTML == "Engine version" &&
75 | jqNodes[4].innerHTML == "unit test 2";
76 | return bReturn;
77 | }
78 | );
79 |
80 |
81 | oTest.fnComplete();
82 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/aoColumns.sWidth.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "aoColumns.sWidth" );
3 |
4 | /* NOTE - we need to disable the auto width for the majority of these test in order to preform
5 | * these tests as the auto width will convert the width to a px value. We can do 'non-exact' tests
6 | * with auto width enabled however to ensure it scales columns as required
7 | */
8 |
9 | $(document).ready( function () {
10 | /* Check the default */
11 | var oTable = $('#example').dataTable( {
12 | "aaData": gaaData,
13 | "bAutoWidth": false,
14 | "aoColumns": [
15 | null,
16 | { "sWidth": '40%' },
17 | null,
18 | null,
19 | null
20 | ]
21 | } );
22 | var oSettings = oTable.fnSettings();
23 |
24 | oTest.fnTest(
25 | "With auto width disabled the width for one column is appled",
26 | null,
27 | function () { return $('#example thead th:eq(1)')[0].style.width == "40%"; }
28 | );
29 |
30 | oTest.fnTest(
31 | "With auto width disabled the width for one column is appled",
32 | function () {
33 | oSession.fnRestore();
34 | oTable = $('#example').dataTable( {
35 | "aaData": gaaData,
36 | "bAutoWidth": false,
37 | "aoColumns": [
38 | null,
39 | null,
40 | { "sWidth": '20%' },
41 | { "sWidth": '30%' },
42 | null
43 | ]
44 | } );
45 | },
46 | function () {
47 | var bReturn =
48 | $('#example thead th:eq(2)')[0].style.width == "20%" &&
49 | $('#example thead th:eq(3)')[0].style.width == "30%";
50 | return bReturn;
51 | }
52 | );
53 |
54 |
55 | oTest.fnTest(
56 | "With auto width, it will make the smallest column the largest with percentage width given",
57 | function () {
58 | oSession.fnRestore();
59 | oTable = $('#example').dataTable( {
60 | "aaData": gaaData,
61 | "aoColumns": [
62 | null,
63 | null,
64 | null,
65 | { "sWidth": '40%' },
66 | null
67 | ]
68 | } );
69 | },
70 | function () {
71 | var anThs = $('#example thead th');
72 | var a0 = anThs[0].offsetWidth;
73 | var a1 = anThs[1].offsetWidth;
74 | var a2 = anThs[2].offsetWidth;
75 | var a3 = anThs[3].offsetWidth;
76 | var a4 = anThs[4].offsetWidth;
77 |
78 | if ( a3>a0 && a3>a1 && a3>a2 && a3>a4 )
79 | return true;
80 | else
81 | return false;
82 | }
83 | );
84 |
85 |
86 | oTest.fnComplete();
87 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/bFilter.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "bFilter" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 |
10 | oTest.fnTest(
11 | "Filtering div exists by default",
12 | null,
13 | function () { return document.getElementById('example_filter') != null; }
14 | );
15 |
16 | /* Check can disable */
17 | oTest.fnTest(
18 | "Fltering can be disabled",
19 | function () {
20 | oSession.fnRestore();
21 | $('#example').dataTable( {
22 | "aaData": gaaData,
23 | "bFilter": false
24 | } );
25 | },
26 | function () { return document.getElementById('example_filter') == null; }
27 | );
28 |
29 | /* Enable makes no difference */
30 | oTest.fnTest(
31 | "Filtering enabled override",
32 | function () {
33 | oSession.fnRestore();
34 | $('#example').dataTable( {
35 | "aaData": gaaData,
36 | "bFilter": true
37 | } );
38 | },
39 | function () { return document.getElementById('example_filter') != null; }
40 | );
41 |
42 |
43 | oTest.fnComplete();
44 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/bInfo.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "bInfo" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 |
10 | oTest.fnTest(
11 | "Info div exists by default",
12 | null,
13 | function () { return document.getElementById('example_info') != null; }
14 | );
15 |
16 | /* Check can disable */
17 | oTest.fnTest(
18 | "Info can be disabled",
19 | function () {
20 | oSession.fnRestore();
21 | $('#example').dataTable( {
22 | "aaData": gaaData,
23 | "bInfo": false
24 | } );
25 | },
26 | function () { return document.getElementById('example_info') == null; }
27 | );
28 |
29 | /* Enable makes no difference */
30 | oTest.fnTest(
31 | "Info enabled override",
32 | function () {
33 | oSession.fnRestore();
34 | $('#example').dataTable( {
35 | "aaData": gaaData,
36 | "bInfo": true
37 | } );
38 | },
39 | function () { return document.getElementById('example_info') != null; }
40 | );
41 |
42 |
43 | oTest.fnComplete();
44 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/bLengthChange.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "bLengthChange" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 |
10 | oTest.fnTest(
11 | "Length div exists by default",
12 | null,
13 | function () { return document.getElementById('example_length') != null; }
14 | );
15 |
16 | oTest.fnTest(
17 | "Four default options",
18 | null,
19 | function () { return $("select[name=example_length] option").length == 4; }
20 | );
21 |
22 | oTest.fnTest(
23 | "Default options",
24 | null,
25 | function () {
26 | var opts = $("select[name='example_length'] option");
27 | return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
28 | opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
29 | }
30 | );
31 |
32 | oTest.fnTest(
33 | "Info takes length into account",
34 | null,
35 | function () { return document.getElementById('example_info').innerHTML ==
36 | "Showing 1 to 10 of 57 entries"; }
37 | );
38 |
39 | /* Check can disable */
40 | oTest.fnTest(
41 | "Change length can be disabled",
42 | function () {
43 | oSession.fnRestore();
44 | $('#example').dataTable( {
45 | "aaData": gaaData,
46 | "bLengthChange": false
47 | } );
48 | },
49 | function () { return document.getElementById('example_length') == null; }
50 | );
51 |
52 | oTest.fnTest(
53 | "Information takes length disabled into account",
54 | null,
55 | function () { return document.getElementById('example_info').innerHTML ==
56 | "Showing 1 to 10 of 57 entries"; }
57 | );
58 |
59 | /* Enable makes no difference */
60 | oTest.fnTest(
61 | "Length change enabled override",
62 | function () {
63 | oSession.fnRestore();
64 | $('#example').dataTable( {
65 | "aaData": gaaData,
66 | "bLengthChange": true
67 | } );
68 | },
69 | function () { return document.getElementById('example_length') != null; }
70 | );
71 |
72 |
73 |
74 | oTest.fnComplete();
75 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/bPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "bPaginate" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 |
10 | oTest.fnTest(
11 | "Pagiantion div exists by default",
12 | null,
13 | function () { return document.getElementById('example_paginate') != null; }
14 | );
15 |
16 | oTest.fnTest(
17 | "Information div takes paging into account",
18 | null,
19 | function () { return document.getElementById('example_info').innerHTML ==
20 | "Showing 1 to 10 of 57 entries"; }
21 | );
22 |
23 | /* Check can disable */
24 | oTest.fnTest(
25 | "Pagiantion can be disabled",
26 | function () {
27 | oSession.fnRestore();
28 | $('#example').dataTable( {
29 | "aaData": gaaData,
30 | "bPaginate": false
31 | } );
32 | },
33 | function () { return document.getElementById('example_paginate') == null; }
34 | );
35 |
36 | oTest.fnTest(
37 | "Information div takes paging disabled into account",
38 | null,
39 | function () { return document.getElementById('example_info').innerHTML ==
40 | "Showing 1 to 57 of 57 entries"; }
41 | );
42 |
43 | /* Enable makes no difference */
44 | oTest.fnTest(
45 | "Pagiantion enabled override",
46 | function () {
47 | oSession.fnRestore();
48 | $('#example').dataTable( {
49 | "aaData": gaaData,
50 | "bPaginate": true
51 | } );
52 | },
53 | function () { return document.getElementById('example_paginate') != null; }
54 | );
55 |
56 |
57 |
58 | oTest.fnComplete();
59 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/bServerSide.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "bServerSide" );
3 |
4 | /* Not interested in server-side processing here other than to check that it is off */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aaData": gaaData
10 | } );
11 | var oSettings = oTable.fnSettings();
12 |
13 | oTest.fnTest(
14 | "Server side is off by default",
15 | null,
16 | function () { return oSettings.oFeatures.bServerSide == false; }
17 | );
18 |
19 | oTest.fnComplete();
20 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/fnDrawCallback.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "fnDrawCallback" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aaData": gaaData
10 | } );
11 | var oSettings = oTable.fnSettings();
12 | var mPass;
13 |
14 | oTest.fnTest(
15 | "Default should be null",
16 | null,
17 | function () { return oSettings.fnDrawCallback == null; }
18 | );
19 |
20 |
21 | oTest.fnTest(
22 | "One argument passed",
23 | function () {
24 | oSession.fnRestore();
25 |
26 | mPass = -1;
27 | $('#example').dataTable( {
28 | "aaData": gaaData,
29 | "fnDrawCallback": function ( ) {
30 | mPass = arguments.length;
31 | }
32 | } );
33 | },
34 | function () { return mPass == 1; }
35 | );
36 |
37 |
38 | oTest.fnTest(
39 | "That one argument is the settings object",
40 | function () {
41 | oSession.fnRestore();
42 |
43 | oTable = $('#example').dataTable( {
44 | "aaData": gaaData,
45 | "fnDrawCallback": function ( oSettings ) {
46 | mPass = oSettings;
47 | }
48 | } );
49 | },
50 | function () { return oTable.fnSettings() == mPass; }
51 | );
52 |
53 |
54 | oTest.fnTest(
55 | "fnRowCallback called once on first draw",
56 | function () {
57 | oSession.fnRestore();
58 |
59 | mPass = 0;
60 | $('#example').dataTable( {
61 | "aaData": gaaData,
62 | "fnDrawCallback": function ( ) {
63 | mPass++;
64 | }
65 | } );
66 | },
67 | function () { return mPass == 1; }
68 | );
69 |
70 | oTest.fnTest(
71 | "fnRowCallback called once on each draw there after as well",
72 | function () {
73 | $('#example_next').click();
74 | $('#example_next').click();
75 | $('#example_next').click();
76 | },
77 | function () { return mPass == 4; }
78 | );
79 |
80 |
81 |
82 |
83 |
84 | oTest.fnComplete();
85 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/fnInitComplete.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "fnInitComplete" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aaData": gaaData
10 | } );
11 | var oSettings = oTable.fnSettings();
12 | var mPass;
13 |
14 | oTest.fnTest(
15 | "Default should be null",
16 | null,
17 | function () { return oSettings.fnInitComplete == null; }
18 | );
19 |
20 |
21 | oTest.fnTest(
22 | "One argument passed (for DOM!)",
23 | function () {
24 | oSession.fnRestore();
25 |
26 | mPass = -1;
27 | $('#example').dataTable( {
28 | "aaData": gaaData,
29 | "fnInitComplete": function ( ) {
30 | mPass = arguments.length;
31 | }
32 | } );
33 | },
34 | function () { return mPass == 1; }
35 | );
36 |
37 |
38 | oTest.fnTest(
39 | "That one argument is the settings object",
40 | function () {
41 | oSession.fnRestore();
42 |
43 | oTable = $('#example').dataTable( {
44 | "aaData": gaaData,
45 | "fnInitComplete": function ( oSettings ) {
46 | mPass = oSettings;
47 | }
48 | } );
49 | },
50 | function () { return oTable.fnSettings() == mPass; }
51 | );
52 |
53 |
54 | oTest.fnTest(
55 | "fnInitComplete called once on first draw",
56 | function () {
57 | oSession.fnRestore();
58 |
59 | mPass = 0;
60 | $('#example').dataTable( {
61 | "aaData": gaaData,
62 | "fnInitComplete": function ( ) {
63 | mPass++;
64 | }
65 | } );
66 | },
67 | function () { return mPass == 1; }
68 | );
69 |
70 | oTest.fnTest(
71 | "fnInitComplete never called there after",
72 | function () {
73 | $('#example_next').click();
74 | $('#example_next').click();
75 | $('#example_next').click();
76 | },
77 | function () { return mPass == 1; }
78 | );
79 |
80 |
81 |
82 | oTest.fnComplete();
83 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/iDisplayLength.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "iDisplayLength" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 |
10 | oTest.fnTest(
11 | "Default length is ten",
12 | null,
13 | function () { return $('#example tbody tr').length == 10; }
14 | );
15 |
16 | oTest.fnTest(
17 | "Select menu shows 10",
18 | null,
19 | function () { return $('#example_length select').val() == 10; }
20 | );
21 |
22 |
23 | oTest.fnTest(
24 | "Set initial length to 25",
25 | function () {
26 | oSession.fnRestore();
27 | $('#example').dataTable( {
28 | "aaData": gaaData,
29 | "iDisplayLength": 25
30 | } );
31 | },
32 | function () { return $('#example tbody tr').length == 25; }
33 | );
34 |
35 | oTest.fnTest(
36 | "Select menu shows 25",
37 | null,
38 | function () { return $('#example_length select').val() == 25; }
39 | );
40 |
41 |
42 | oTest.fnTest(
43 | "Set initial length to 100",
44 | function () {
45 | oSession.fnRestore();
46 | $('#example').dataTable( {
47 | "aaData": gaaData,
48 | "iDisplayLength": 100
49 | } );
50 | },
51 | function () { return $('#example tbody tr').length == 57; }
52 | );
53 |
54 | oTest.fnTest(
55 | "Select menu shows 25",
56 | null,
57 | function () { return $('#example_length select').val() == 100; }
58 | );
59 |
60 |
61 | oTest.fnTest(
62 | "Set initial length to 23 (unknown select menu length)",
63 | function () {
64 | oSession.fnRestore();
65 | $('#example').dataTable( {
66 | "aaData": gaaData,
67 | "iDisplayLength": 23
68 | } );
69 | },
70 | function () { return $('#example tbody tr').length == 23; }
71 | );
72 |
73 | oTest.fnTest(
74 | "Select menu shows 10 (since 23 is unknow)",
75 | null,
76 | function () { return $('#example_length select').val() == 10; }
77 | );
78 |
79 |
80 | oTest.fnComplete();
81 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.oPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.oPaginate" );
3 |
4 | /* Note that the paging language information only has relevence in full numbers */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aaData": gaaData,
10 | "sPaginationType": "full_numbers"
11 | } );
12 | var oSettings = oTable.fnSettings();
13 |
14 | oTest.fnTest(
15 | "oLanguage.oPaginate defaults",
16 | null,
17 | function () {
18 | var bReturn =
19 | oSettings.oLanguage.oPaginate.sFirst == "First" &&
20 | oSettings.oLanguage.oPaginate.sPrevious == "Previous" &&
21 | oSettings.oLanguage.oPaginate.sNext == "Next" &&
22 | oSettings.oLanguage.oPaginate.sLast == "Last";
23 | return bReturn;
24 | }
25 | );
26 |
27 | oTest.fnTest(
28 | "oLanguage.oPaginate defaults are in the DOM",
29 | null,
30 | function () {
31 | var bReturn =
32 | $('#example_paginate .first').html() == "First" &&
33 | $('#example_paginate .previous').html() == "Previous" &&
34 | $('#example_paginate .next').html() == "Next" &&
35 | $('#example_paginate .last').html() == "Last";
36 | return bReturn;
37 | }
38 | );
39 |
40 |
41 | oTest.fnTest(
42 | "oLanguage.oPaginate can be defined",
43 | function () {
44 | oSession.fnRestore();
45 | oTable = $('#example').dataTable( {
46 | "aaData": gaaData,
47 | "sPaginationType": "full_numbers",
48 | "oLanguage": {
49 | "oPaginate": {
50 | "sFirst": "unit1",
51 | "sPrevious": "test2",
52 | "sNext": "unit3",
53 | "sLast": "test4"
54 | }
55 | }
56 | } );
57 | oSettings = oTable.fnSettings();
58 | },
59 | function () {
60 | var bReturn =
61 | oSettings.oLanguage.oPaginate.sFirst == "unit1" &&
62 | oSettings.oLanguage.oPaginate.sPrevious == "test2" &&
63 | oSettings.oLanguage.oPaginate.sNext == "unit3" &&
64 | oSettings.oLanguage.oPaginate.sLast == "test4";
65 | return bReturn;
66 | }
67 | );
68 |
69 | oTest.fnTest(
70 | "oLanguage.oPaginate definitions are in the DOM",
71 | null,
72 | function () {
73 | var bReturn =
74 | $('#example_paginate .first').html() == "unit1" &&
75 | $('#example_paginate .previous').html() == "test2" &&
76 | $('#example_paginate .next').html() == "unit3" &&
77 | $('#example_paginate .last').html() == "test4";
78 | return bReturn;
79 | }
80 | );
81 |
82 |
83 | oTest.fnComplete();
84 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.sInfoEmpty.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.sInfoEmpty" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Info empty language is 'Showing 0 to 0 of 0 entries' by default",
13 | function () { oTable.fnFilter("nothinghere"); },
14 | function () { return oSettings.oLanguage.sInfoEmpty == "Showing 0 to 0 of 0 entries"; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Info empty language default is in the DOM",
19 | null,
20 | function () {
21 | var bReturn = document.getElementById('example_info').innerHTML.replace(
22 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
23 | "Showing 0 to 0 of 0 entries";
24 | return bReturn;
25 | }
26 | );
27 |
28 |
29 | oTest.fnTest(
30 | "Info empty language can be defined",
31 | function () {
32 | oSession.fnRestore();
33 | oTable = $('#example').dataTable( {
34 | "aaData": gaaData,
35 | "oLanguage": {
36 | "sInfoEmpty": "unit test"
37 | }
38 | } );
39 | oSettings = oTable.fnSettings();
40 | oTable.fnFilter("nothinghere");
41 | },
42 | function () { return oSettings.oLanguage.sInfoEmpty == "unit test"; }
43 | );
44 |
45 | oTest.fnTest(
46 | "Info empty language default is in the DOM",
47 | null,
48 | function () {
49 | var bReturn = document.getElementById('example_info').innerHTML.replace(
50 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
51 | "unit test";
52 | return bReturn;
53 | }
54 | );
55 |
56 |
57 | oTest.fnTest(
58 | "Macro's not replaced",
59 | function () {
60 | oSession.fnRestore();
61 | oTable = $('#example').dataTable( {
62 | "aaData": gaaData,
63 | "oLanguage": {
64 | "sInfoEmpty": "unit _START_ _END_ _TOTAL_ test"
65 | }
66 | } );
67 | oTable.fnFilter("nothinghere");
68 | },
69 | function () {
70 | var bReturn = document.getElementById('example_info').innerHTML.replace(
71 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
72 | "unit _START_ _END_ _TOTAL_ test";
73 | return bReturn;
74 | }
75 | );
76 |
77 |
78 | oTest.fnComplete();
79 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.sInfoPostFix.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.sInfoPostFix" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Info post fix language is '' (blank) by default",
13 | null,
14 | function () { return oSettings.oLanguage.sInfoPostFix == ""; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Width no post fix, the basic info shows",
19 | null,
20 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; }
21 | );
22 |
23 |
24 | oTest.fnTest(
25 | "Info post fix language can be defined",
26 | function () {
27 | oSession.fnRestore();
28 | oTable = $('#example').dataTable( {
29 | "aaData": gaaData,
30 | "oLanguage": {
31 | "sInfoPostFix": "unit test"
32 | }
33 | } );
34 | oSettings = oTable.fnSettings();
35 | },
36 | function () { return oSettings.oLanguage.sInfoPostFix == "unit test"; }
37 | );
38 |
39 | oTest.fnTest(
40 | "Info empty language default is in the DOM",
41 | null,
42 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit test"; }
43 | );
44 |
45 |
46 | oTest.fnTest(
47 | "Macros have no effect in the post fix",
48 | function () {
49 | oSession.fnRestore();
50 | oTable = $('#example').dataTable( {
51 | "aaData": gaaData,
52 | "oLanguage": {
53 | "sInfoPostFix": "unit _START_ _END_ _TOTAL_ test"
54 | }
55 | } );
56 | },
57 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit _START_ _END_ _TOTAL_ test"; }
58 | );
59 |
60 |
61 | oTest.fnTest(
62 | "Post fix is applied after fintering info",
63 | function () {
64 | oSession.fnRestore();
65 | oTable = $('#example').dataTable( {
66 | "aaData": gaaData,
67 | "oLanguage": {
68 | "sInfoPostFix": "unit test"
69 | }
70 | } );
71 | oTable.fnFilter("nothinghere");
72 | },
73 | function () { return document.getElementById('example_info').innerHTML = "Showing 0 to 0 of 0 entries unit (filtered from 57 total entries) test"; }
74 | );
75 |
76 |
77 | oTest.fnComplete();
78 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.sProcessing.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.sProcessing" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData,
8 | "bProcessing": true
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnTest(
13 | "Processing language is 'Processing...' by default",
14 | null,
15 | function () { return oSettings.oLanguage.sProcessing == "Processing..."; }
16 | );
17 |
18 | oTest.fnTest(
19 | "Processing language default is in the DOM",
20 | null,
21 | function () { return document.getElementById('example_processing').innerHTML = "Processing..."; }
22 | );
23 |
24 |
25 | oTest.fnTest(
26 | "Processing language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "aaData": gaaData,
31 | "bProcessing": true,
32 | "oLanguage": {
33 | "sProcessing": "unit test"
34 | }
35 | } );
36 | oSettings = oTable.fnSettings();
37 | },
38 | function () { return oSettings.oLanguage.sProcessing == "unit test"; }
39 | );
40 |
41 | oTest.fnTest(
42 | "Processing language definition is in the DOM",
43 | null,
44 | function () { return document.getElementById('example_processing').innerHTML = "unit test"; }
45 | );
46 |
47 |
48 | oTest.fnComplete();
49 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.sSearch.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.sSearch" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Search language is 'Search:' by default",
13 | null,
14 | function () { return oSettings.oLanguage.sSearch == "Search:"; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Search language default is in the DOM",
19 | null,
20 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
21 | == "Search: "; }
22 | );
23 |
24 |
25 | oTest.fnTest(
26 | "Search language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "aaData": gaaData,
31 | "oLanguage": {
32 | "sSearch": "unit test"
33 | }
34 | } );
35 | oSettings = oTable.fnSettings();
36 | },
37 | function () { return oSettings.oLanguage.sSearch == "unit test"; }
38 | );
39 |
40 | oTest.fnTest(
41 | "Info language definition is in the DOM",
42 | null,
43 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
44 | == "unit test "; }
45 | );
46 |
47 |
48 | oTest.fnTest(
49 | "Blank search has a no (separator) inserted",
50 | function () {
51 | oSession.fnRestore();
52 | oTable = $('#example').dataTable( {
53 | "aaData": gaaData,
54 | "oLanguage": {
55 | "sSearch": ""
56 | }
57 | } );
58 | oSettings = oTable.fnSettings();
59 | },
60 | function () { return document.getElementById('example_filter').childNodes.length == 1; }
61 | );
62 |
63 |
64 | oTest.fnComplete();
65 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.sUrl.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.sUrl" );
3 |
4 | /* Note that we only test the internal storage of language information pulled form a file here
5 | * as the other language tests will check it goes into the DOM correctly
6 | */
7 |
8 | $(document).ready( function () {
9 | /* Check the default */
10 | var oTable = $('#example').dataTable( {
11 | "aaData": gaaData
12 | } );
13 | var oSettings = oTable.fnSettings();
14 |
15 | oTest.fnTest(
16 | "sUrl is blank by default",
17 | null,
18 | function () { return oSettings.oLanguage.sUrl == ""; }
19 | );
20 |
21 |
22 | oTest.fnWaitTest(
23 | "Loading of German file loads language information",
24 | function () {
25 | oSession.fnRestore();
26 | oTable = $('#example').dataTable( {
27 | "aaData": gaaData,
28 | "oLanguage": {
29 | "sUrl": "../../../examples/examples_support/de_DE.txt"
30 | }
31 | } );
32 | oSettings = oTable.fnSettings();
33 | },
34 | function () {
35 | var bReturn =
36 | oSettings.oLanguage.sProcessing == "Bitte warten..." &&
37 | oSettings.oLanguage.sLengthMenu == "_MENU_ Einträge anzeigen" &&
38 | oSettings.oLanguage.sZeroRecords == "Keine Einträge vorhanden." &&
39 | oSettings.oLanguage.sInfo == "_START_ bis _END_ von _TOTAL_ Einträgen" &&
40 | oSettings.oLanguage.sInfoEmpty == "0 bis 0 von 0 Einträgen" &&
41 | oSettings.oLanguage.sInfoFiltered == "(gefiltert von _MAX_ Einträgen)" &&
42 | oSettings.oLanguage.sInfoPostFix == "" &&
43 | oSettings.oLanguage.sSearch == "Suchen" &&
44 | oSettings.oLanguage.oPaginate.sFirst == "Erster" &&
45 | oSettings.oLanguage.oPaginate.sPrevious == "Zurück" &&
46 | oSettings.oLanguage.oPaginate.sNext == "Nächster" &&
47 | oSettings.oLanguage.oPaginate.sLast == "Letzter";
48 |
49 | return bReturn;
50 | }
51 | );
52 |
53 | /* One DOM check just to ensure that they go into the DOM */
54 | oTest.fnTest(
55 | "Loaded language goes into the DOM",
56 | null,
57 | function () { return document.getElementById('example_info').innerHTML = "1 bis 10 von 57 Einträgen"; }
58 | );
59 |
60 |
61 | oTest.fnComplete();
62 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/oLanguage.sZeroRecords.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "oLanguage.sZeroRecords" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "aaData": gaaData
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnTest(
12 | "Zero records language is 'No matching records found' by default",
13 | null,
14 | function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Text is shown when empty table (after filtering)",
19 | function () { oTable.fnFilter('nothinghere'); },
20 | function () { return $('#example tbody tr td')[0].innerHTML == "No matching records found" }
21 | );
22 |
23 |
24 |
25 | oTest.fnTest(
26 | "Zero records language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "aaData": gaaData,
31 | "oLanguage": {
32 | "sZeroRecords": "unit test"
33 | }
34 | } );
35 | oSettings = oTable.fnSettings();
36 | },
37 | function () { return oSettings.oLanguage.sZeroRecords == "unit test"; }
38 | );
39 |
40 | oTest.fnTest(
41 | "Text is shown when empty table (after filtering)",
42 | function () { oTable.fnFilter('nothinghere2'); },
43 | function () { return $('#example tbody tr td')[0].innerHTML == "unit test" }
44 | );
45 |
46 |
47 | oTest.fnComplete();
48 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/2_js/sAjaxSource.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: js_data
2 | oTest.fnStart( "sAjaxSource" );
3 |
4 | /* Not interested in ajax source here other than to check it's default */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "aaData": gaaData
10 | } );
11 | var oSettings = oTable.fnSettings();
12 |
13 | oTest.fnTest(
14 | "Server side is off by default",
15 | null,
16 | function () { return oSettings.sAjaxSource == null; }
17 | );
18 |
19 | oTest.fnComplete();
20 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/aaSortingFixed.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aaSortingFixed" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "No fixed sorting by default",
13 | null,
14 | function () {
15 | return oSettings.aaSortingFixed == null;
16 | }
17 | );
18 |
19 |
20 | oTest.fnWaitTest(
21 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)",
22 | function () {
23 | oSession.fnRestore();
24 | $('#example').dataTable( {
25 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
26 | "aaSortingFixed": [['0','asc']],
27 | "fnInitComplete": function () {
28 | $('#example thead th:eq(1)').click();
29 | }
30 | } );
31 | //
32 | },
33 | function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
34 | );
35 |
36 | oTest.fnWaitTest(
37 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)",
38 | function () {
39 | $('#example thead th:eq(1)').click();
40 | },
41 | function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
42 | );
43 |
44 | oTest.fnWaitTest(
45 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)",
46 | function () {
47 | oSession.fnRestore();
48 | $('#example').dataTable( {
49 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
50 | "aaSortingFixed": [['3','asc']]
51 | } );
52 | $('#example thead th:eq(1)').click();
53 | },
54 | function () { return $('#example tbody td:eq(1)').html() == "All others"; }
55 | );
56 |
57 | oTest.fnWaitTest(
58 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)",
59 | function () {
60 | $('#example thead th:eq(1)').click();
61 | },
62 | function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; }
63 | );
64 |
65 |
66 | oTest.fnComplete();
67 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/aoColumns.bSearchable.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.bSeachable" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "Columns are searchable by default",
13 | function () { oTable.fnFilter("Camino"); },
14 | function () {
15 | if ( $('#example tbody tr:eq(0) td:eq(1)')[0] )
16 | return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/);
17 | else
18 | return null;
19 | }
20 | );
21 |
22 | oTest.fnWaitTest(
23 | "Disabling sorting on a column removes it from the global filter",
24 | function () {
25 | oSession.fnRestore();
26 | oTable = $('#example').dataTable( {
27 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
28 | "aoColumns": [
29 | null,
30 | { "bSearchable": false },
31 | null,
32 | null,
33 | null
34 | ]
35 | } );
36 | oSettings = oTable.fnSettings();
37 | oTable.fnFilter("Camino");
38 | },
39 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
40 | );
41 |
42 | oTest.fnWaitTest(
43 | "Disabled on one column has no effect on other columns",
44 | function () { oTable.fnFilter("Webkit"); },
45 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; }
46 | );
47 |
48 | oTest.fnWaitTest(
49 | "Disable filtering on multiple columns",
50 | function () {
51 | oSession.fnRestore();
52 | oTable = $('#example').dataTable( {
53 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
54 | "aoColumns": [
55 | { "bSearchable": false },
56 | { "bSearchable": false },
57 | null,
58 | null,
59 | null
60 | ]
61 | } );
62 | oSettings = oTable.fnSettings();
63 | oTable.fnFilter("Webkit");
64 | },
65 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
66 | );
67 |
68 | oTest.fnWaitTest(
69 | "Filter on second disabled column",
70 | function () { oTable.fnFilter("Camino"); },
71 | function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
72 | );
73 |
74 |
75 | oTest.fnComplete();
76 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/aoColumns.sName.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.sName" );
3 |
4 | /* This has no effect at all in DOM methods - so we just check that it has applied the name */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
10 | "aoColumns": [
11 | null,
12 | null,
13 | null,
14 | { "sName": 'unit test' },
15 | null
16 | ]
17 | } );
18 | var oSettings = oTable.fnSettings();
19 |
20 | oTest.fnWaitTest(
21 | "Names are stored in the columns object",
22 | null,
23 | function () { return oSettings.aoColumns[3].sName =="unit test"; }
24 | );
25 |
26 |
27 | oTest.fnComplete();
28 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/aoColumns.sTitle.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.sTitle" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "If not given, then the columns titles are empty",
13 | null,
14 | function () {
15 | var jqNodes = $('#example thead tr:eq(0) th');
16 | var bReturn =
17 | jqNodes[0].innerHTML == "Rendering engine" &&
18 | jqNodes[1].innerHTML == "Browser" &&
19 | jqNodes[2].innerHTML == "Platform(s)" &&
20 | jqNodes[3].innerHTML == "Engine version" &&
21 | jqNodes[4].innerHTML == "CSS grade";
22 | return bReturn;
23 | }
24 | );
25 |
26 | oTest.fnWaitTest(
27 | "Can set a single column title - and others are read from DOM",
28 | function () {
29 | oSession.fnRestore();
30 | $('#example').dataTable( {
31 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
32 | "aoColumns": [
33 | null,
34 | { "sTitle": 'unit test' },
35 | null,
36 | null,
37 | null
38 | ]
39 | } );
40 | },
41 | function () {
42 | var jqNodes = $('#example thead tr:eq(0) th');
43 | var bReturn =
44 | jqNodes[0].innerHTML == "Rendering engine" &&
45 | jqNodes[1].innerHTML == "unit test" &&
46 | jqNodes[2].innerHTML == "Platform(s)" &&
47 | jqNodes[3].innerHTML == "Engine version" &&
48 | jqNodes[4].innerHTML == "CSS grade";
49 | return bReturn;
50 | }
51 | );
52 |
53 | oTest.fnWaitTest(
54 | "Can set multiple column titles",
55 | function () {
56 | oSession.fnRestore();
57 | $('#example').dataTable( {
58 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
59 | "aoColumns": [
60 | null,
61 | { "sTitle": 'unit test 1' },
62 | null,
63 | null,
64 | { "sTitle": 'unit test 2' }
65 | ]
66 | } );
67 | },
68 | function () {
69 | var jqNodes = $('#example thead tr:eq(0) th');
70 | var bReturn =
71 | jqNodes[0].innerHTML == "Rendering engine" &&
72 | jqNodes[1].innerHTML == "unit test 1" &&
73 | jqNodes[2].innerHTML == "Platform(s)" &&
74 | jqNodes[3].innerHTML == "Engine version" &&
75 | jqNodes[4].innerHTML == "unit test 2";
76 | return bReturn;
77 | }
78 | );
79 |
80 |
81 | oTest.fnComplete();
82 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/aoColumns.sWidth.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.sWidth" );
3 |
4 | /* NOTE - we need to disable the auto width for the majority of these test in order to preform
5 | * these tests as the auto width will convert the width to a px value. We can do 'non-exact' tests
6 | * with auto width enabled however to ensure it scales columns as required
7 | */
8 |
9 | $(document).ready( function () {
10 | /* Check the default */
11 | var oTable = $('#example').dataTable( {
12 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
13 | "bAutoWidth": false,
14 | "aoColumns": [
15 | null,
16 | { "sWidth": '40%' },
17 | null,
18 | null,
19 | null
20 | ]
21 | } );
22 | var oSettings = oTable.fnSettings();
23 |
24 | oTest.fnWaitTest(
25 | "With auto width disabled the width for one column is appled",
26 | null,
27 | function () { return $('#example thead th:eq(1)')[0].style.width == "40%"; }
28 | );
29 |
30 | oTest.fnWaitTest(
31 | "With auto width disabled the width for one column is appled",
32 | function () {
33 | oSession.fnRestore();
34 | oTable = $('#example').dataTable( {
35 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
36 | "bAutoWidth": false,
37 | "aoColumns": [
38 | null,
39 | null,
40 | { "sWidth": '20%' },
41 | { "sWidth": '30%' },
42 | null
43 | ]
44 | } );
45 | },
46 | function () {
47 | var bReturn =
48 | $('#example thead th:eq(2)')[0].style.width == "20%" &&
49 | $('#example thead th:eq(3)')[0].style.width == "30%";
50 | return bReturn;
51 | }
52 | );
53 |
54 |
55 | oTest.fnWaitTest(
56 | "With auto width, it will make the smallest column the largest with percentage width given",
57 | function () {
58 | oSession.fnRestore();
59 | oTable = $('#example').dataTable( {
60 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
61 | "aoColumns": [
62 | null,
63 | null,
64 | null,
65 | { "sWidth": '40%' },
66 | null
67 | ]
68 | } );
69 | },
70 | function () {
71 | var anThs = $('#example thead th');
72 | var a0 = anThs[0].offsetWidth;
73 | var a1 = anThs[1].offsetWidth;
74 | var a2 = anThs[2].offsetWidth;
75 | var a3 = anThs[3].offsetWidth;
76 | var a4 = anThs[4].offsetWidth;
77 |
78 | if ( a3>a0 && a3>a1 && a3>a2 && a3>a4 )
79 | return true;
80 | else
81 | return false;
82 | }
83 | );
84 |
85 |
86 | oTest.fnComplete();
87 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/bFilter.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bFilter" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 |
10 | oTest.fnWaitTest(
11 | "Filtering div exists by default",
12 | null,
13 | function () { return document.getElementById('example_filter') != null; }
14 | );
15 |
16 | /* Check can disable */
17 | oTest.fnWaitTest(
18 | "Fltering can be disabled",
19 | function () {
20 | oSession.fnRestore();
21 | $('#example').dataTable( {
22 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
23 | "bFilter": false
24 | } );
25 | },
26 | function () { return document.getElementById('example_filter') == null; }
27 | );
28 |
29 | /* Enable makes no difference */
30 | oTest.fnWaitTest(
31 | "Filtering enabled override",
32 | function () {
33 | oSession.fnRestore();
34 | $('#example').dataTable( {
35 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
36 | "bFilter": true
37 | } );
38 | },
39 | function () { return document.getElementById('example_filter') != null; }
40 | );
41 |
42 |
43 | oTest.fnComplete();
44 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/bInfo.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bInfo" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 |
10 | oTest.fnWaitTest(
11 | "Info div exists by default",
12 | null,
13 | function () { return document.getElementById('example_info') != null; }
14 | );
15 |
16 | /* Check can disable */
17 | oTest.fnWaitTest(
18 | "Info can be disabled",
19 | function () {
20 | oSession.fnRestore();
21 | $('#example').dataTable( {
22 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
23 | "bInfo": false
24 | } );
25 | },
26 | function () { return document.getElementById('example_info') == null; }
27 | );
28 |
29 | /* Enable makes no difference */
30 | oTest.fnWaitTest(
31 | "Info enabled override",
32 | function () {
33 | oSession.fnRestore();
34 | $('#example').dataTable( {
35 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
36 | "bInfo": true
37 | } );
38 | },
39 | function () { return document.getElementById('example_info') != null; }
40 | );
41 |
42 |
43 | oTest.fnComplete();
44 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/bLengthChange.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bLengthChange" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 |
10 | oTest.fnWaitTest(
11 | "Length div exists by default",
12 | null,
13 | function () { return document.getElementById('example_length') != null; }
14 | );
15 |
16 | oTest.fnWaitTest(
17 | "Four default options",
18 | null,
19 | function () { return $("select[name=example_length] option").length == 4; }
20 | );
21 |
22 | oTest.fnWaitTest(
23 | "Default options",
24 | null,
25 | function () {
26 | var opts = $("select[name='example_length'] option");
27 | return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
28 | opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
29 | }
30 | );
31 |
32 | oTest.fnWaitTest(
33 | "Info takes length into account",
34 | null,
35 | function () { return document.getElementById('example_info').innerHTML ==
36 | "Showing 1 to 10 of 57 entries"; }
37 | );
38 |
39 | /* Check can disable */
40 | oTest.fnWaitTest(
41 | "Change length can be disabled",
42 | function () {
43 | oSession.fnRestore();
44 | $('#example').dataTable( {
45 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
46 | "bLengthChange": false
47 | } );
48 | },
49 | function () { return document.getElementById('example_length') == null; }
50 | );
51 |
52 | oTest.fnWaitTest(
53 | "Information takes length disabled into account",
54 | null,
55 | function () { return document.getElementById('example_info').innerHTML ==
56 | "Showing 1 to 10 of 57 entries"; }
57 | );
58 |
59 | /* Enable makes no difference */
60 | oTest.fnWaitTest(
61 | "Length change enabled override",
62 | function () {
63 | oSession.fnRestore();
64 | $('#example').dataTable( {
65 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
66 | "bLengthChange": true
67 | } );
68 | },
69 | function () { return document.getElementById('example_length') != null; }
70 | );
71 |
72 |
73 |
74 | oTest.fnComplete();
75 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/bPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bPaginate" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 |
10 | oTest.fnWaitTest(
11 | "Pagiantion div exists by default",
12 | null,
13 | function () { return document.getElementById('example_paginate') != null; }
14 | );
15 |
16 | oTest.fnWaitTest(
17 | "Information div takes paging into account",
18 | null,
19 | function () { return document.getElementById('example_info').innerHTML ==
20 | "Showing 1 to 10 of 57 entries"; }
21 | );
22 |
23 | /* Check can disable */
24 | oTest.fnWaitTest(
25 | "Pagiantion can be disabled",
26 | function () {
27 | oSession.fnRestore();
28 | $('#example').dataTable( {
29 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
30 | "bPaginate": false
31 | } );
32 | },
33 | function () { return document.getElementById('example_paginate') == null; }
34 | );
35 |
36 | oTest.fnWaitTest(
37 | "Information div takes paging disabled into account",
38 | null,
39 | function () { return document.getElementById('example_info').innerHTML ==
40 | "Showing 1 to 57 of 57 entries"; }
41 | );
42 |
43 | /* Enable makes no difference */
44 | oTest.fnWaitTest(
45 | "Pagiantion enabled override",
46 | function () {
47 | oSession.fnRestore();
48 | $('#example').dataTable( {
49 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
50 | "bPaginate": true
51 | } );
52 | },
53 | function () { return document.getElementById('example_paginate') != null; }
54 | );
55 |
56 |
57 |
58 | oTest.fnComplete();
59 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/bServerSide.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bServerSide" );
3 |
4 | /* Not interested in server-side processing here other than to check that it is off */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
10 | } );
11 | var oSettings = oTable.fnSettings();
12 |
13 | oTest.fnWaitTest(
14 | "Server side is off by default",
15 | null,
16 | function () { return oSettings.oFeatures.bServerSide == false; }
17 | );
18 |
19 | oTest.fnComplete();
20 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/fnDrawCallback.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "fnDrawCallback" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
10 | } );
11 | var oSettings = oTable.fnSettings();
12 | var mPass, bInit;
13 |
14 | oTest.fnWaitTest(
15 | "Default should be null",
16 | null,
17 | function () { return oSettings.fnDrawCallback == null; }
18 | );
19 |
20 |
21 | oTest.fnWaitTest(
22 | "One argument passed",
23 | function () {
24 | oSession.fnRestore();
25 |
26 | mPass = -1;
27 | bInit = false;
28 | $('#example').dataTable( {
29 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
30 | "fnDrawCallback": function ( ) {
31 | mPass = arguments.length;
32 | },
33 | "fnInitComplete": function () {
34 | bInit = true;
35 | }
36 | } );
37 | },
38 | function () { return mPass == 1 && bInit; }
39 | );
40 |
41 |
42 | oTest.fnWaitTest(
43 | "That one argument is the settings object",
44 | function () {
45 | oSession.fnRestore();
46 |
47 | bInit = false;
48 | oTable = $('#example').dataTable( {
49 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
50 | "fnDrawCallback": function ( oSettings ) {
51 | mPass = oSettings;
52 | },
53 | "fnInitComplete": function () {
54 | bInit = true;
55 | }
56 | } );
57 | },
58 | function () { return oTable.fnSettings() == mPass && bInit; }
59 | );
60 |
61 |
62 | /* The draw callback is called once for the init and then when the data is added */
63 | oTest.fnWaitTest(
64 | "fnRowCallback called once on first draw",
65 | function () {
66 | oSession.fnRestore();
67 |
68 | mPass = 0;
69 | bInit = false;
70 | $('#example').dataTable( {
71 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
72 | "fnDrawCallback": function ( ) {
73 | mPass++;
74 | },
75 | "fnInitComplete": function () {
76 | bInit = true;
77 | }
78 | } );
79 | },
80 | function () { return mPass == 2 && bInit; }
81 | );
82 |
83 | oTest.fnWaitTest(
84 | "fnRowCallback called once on each draw there after as well",
85 | function () {
86 | $('#example_next').click();
87 | $('#example_next').click();
88 | $('#example_next').click();
89 | },
90 | function () { return mPass == 5; }
91 | );
92 |
93 |
94 |
95 |
96 |
97 | oTest.fnComplete();
98 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/fnInitComplete.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "fnInitComplete" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
10 | } );
11 | var oSettings = oTable.fnSettings();
12 | var mPass;
13 |
14 | oTest.fnWaitTest(
15 | "Default should be null",
16 | null,
17 | function () { return oSettings.fnInitComplete == null; }
18 | );
19 |
20 |
21 | oTest.fnWaitTest(
22 | "Two arguments passed (for Ajax!)",
23 | function () {
24 | oSession.fnRestore();
25 |
26 | mPass = -1;
27 | $('#example').dataTable( {
28 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
29 | "fnInitComplete": function ( ) {
30 | mPass = arguments.length;
31 | }
32 | } );
33 | },
34 | function () { return mPass == 2; }
35 | );
36 |
37 |
38 | oTest.fnWaitTest(
39 | "That one argument is the settings object",
40 | function () {
41 | oSession.fnRestore();
42 |
43 | oTable = $('#example').dataTable( {
44 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
45 | "fnInitComplete": function ( oSettings ) {
46 | mPass = oSettings;
47 | }
48 | } );
49 | },
50 | function () { return oTable.fnSettings() == mPass; }
51 | );
52 |
53 |
54 | oTest.fnWaitTest(
55 | "fnInitComplete called once on first draw",
56 | function () {
57 | oSession.fnRestore();
58 |
59 | mPass = 0;
60 | $('#example').dataTable( {
61 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
62 | "fnInitComplete": function ( ) {
63 | mPass++;
64 | }
65 | } );
66 | },
67 | function () { return mPass == 1; }
68 | );
69 |
70 | oTest.fnWaitTest(
71 | "fnInitComplete never called there after",
72 | function () {
73 | $('#example_next').click();
74 | $('#example_next').click();
75 | $('#example_next').click();
76 | },
77 | function () { return mPass == 1; }
78 | );
79 |
80 |
81 | oTest.fnWaitTest(
82 | "10 rows in the table on complete",
83 | function () {
84 | oSession.fnRestore();
85 |
86 | mPass = 0;
87 | $('#example').dataTable( {
88 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
89 | "fnInitComplete": function ( ) {
90 | mPass = $('#example tbody tr').length;
91 | }
92 | } );
93 | },
94 | function () { return mPass == 10; }
95 | );
96 |
97 |
98 |
99 | oTest.fnComplete();
100 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/fnServerData.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "fnServerData for Ajax sourced data" );
3 |
4 | $(document).ready( function () {
5 | var mPass;
6 |
7 | oTest.fnTest(
8 | "Argument length",
9 | function () {
10 | $('#example').dataTable( {
11 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
12 | "fnServerData": function () {
13 | mPass = arguments.length;
14 | }
15 | } );
16 | },
17 | function () { return mPass == 3; }
18 | );
19 |
20 | oTest.fnTest(
21 | "Url",
22 | function () {
23 | $('#example').dataTable( {
24 | "bDestroy": true,
25 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
26 | "fnServerData": function (sUrl, aoData, fnCallback) {
27 | mPass = sUrl == "../../../examples/examples_support/json_source.txt";
28 | }
29 | } );
30 | },
31 | function () { return mPass; }
32 | );
33 |
34 | oTest.fnTest(
35 | "Data array",
36 | function () {
37 | $('#example').dataTable( {
38 | "bDestroy": true,
39 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
40 | "fnServerData": function (sUrl, aoData, fnCallback) {
41 | mPass = aoData.length==0;
42 | }
43 | } );
44 | },
45 | function () { return mPass; }
46 | );
47 |
48 | oTest.fnTest(
49 | "Callback function",
50 | function () {
51 | $('#example').dataTable( {
52 | "bDestroy": true,
53 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
54 | "fnServerData": function (sUrl, aoData, fnCallback) {
55 | mPass = typeof fnCallback == 'function';
56 | }
57 | } );
58 | },
59 | function () { return mPass; }
60 | );
61 |
62 |
63 | oTest.fnComplete();
64 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/iDisplayLength.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "iDisplayLength" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 |
10 | oTest.fnWaitTest(
11 | "Default length is ten",
12 | null,
13 | function () { return $('#example tbody tr').length == 10; }
14 | );
15 |
16 | oTest.fnWaitTest(
17 | "Select menu shows 10",
18 | null,
19 | function () { return $('#example_length select').val() == 10; }
20 | );
21 |
22 |
23 | oTest.fnWaitTest(
24 | "Set initial length to 25",
25 | function () {
26 | oSession.fnRestore();
27 | $('#example').dataTable( {
28 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
29 | "iDisplayLength": 25
30 | } );
31 | },
32 | function () { return $('#example tbody tr').length == 25; }
33 | );
34 |
35 | oTest.fnWaitTest(
36 | "Select menu shows 25",
37 | null,
38 | function () { return $('#example_length select').val() == 25; }
39 | );
40 |
41 |
42 | oTest.fnWaitTest(
43 | "Set initial length to 100",
44 | function () {
45 | oSession.fnRestore();
46 | $('#example').dataTable( {
47 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
48 | "iDisplayLength": 100
49 | } );
50 | },
51 | function () { return $('#example tbody tr').length == 57; }
52 | );
53 |
54 | oTest.fnWaitTest(
55 | "Select menu shows 25",
56 | null,
57 | function () { return $('#example_length select').val() == 100; }
58 | );
59 |
60 |
61 | oTest.fnWaitTest(
62 | "Set initial length to 23 (unknown select menu length)",
63 | function () {
64 | oSession.fnRestore();
65 | $('#example').dataTable( {
66 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
67 | "iDisplayLength": 23
68 | } );
69 | },
70 | function () { return $('#example tbody tr').length == 23; }
71 | );
72 |
73 | oTest.fnWaitTest(
74 | "Select menu shows 10 (since 23 is unknow)",
75 | null,
76 | function () { return $('#example_length select').val() == 10; }
77 | );
78 |
79 |
80 | oTest.fnComplete();
81 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.oPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.oPaginate" );
3 |
4 | /* Note that the paging language information only has relevence in full numbers */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
10 | "sPaginationType": "full_numbers"
11 | } );
12 | var oSettings = oTable.fnSettings();
13 |
14 | oTest.fnWaitTest(
15 | "oLanguage.oPaginate defaults",
16 | null,
17 | function () {
18 | var bReturn =
19 | oSettings.oLanguage.oPaginate.sFirst == "First" &&
20 | oSettings.oLanguage.oPaginate.sPrevious == "Previous" &&
21 | oSettings.oLanguage.oPaginate.sNext == "Next" &&
22 | oSettings.oLanguage.oPaginate.sLast == "Last";
23 | return bReturn;
24 | }
25 | );
26 |
27 | oTest.fnTest(
28 | "oLanguage.oPaginate defaults are in the DOM",
29 | null,
30 | function () {
31 | var bReturn =
32 | $('#example_paginate .first').html() == "First" &&
33 | $('#example_paginate .previous').html() == "Previous" &&
34 | $('#example_paginate .next').html() == "Next" &&
35 | $('#example_paginate .last').html() == "Last";
36 | return bReturn;
37 | }
38 | );
39 |
40 |
41 | oTest.fnWaitTest(
42 | "oLanguage.oPaginate can be defined",
43 | function () {
44 | oSession.fnRestore();
45 | oTable = $('#example').dataTable( {
46 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
47 | "sPaginationType": "full_numbers",
48 | "oLanguage": {
49 | "oPaginate": {
50 | "sFirst": "unit1",
51 | "sPrevious": "test2",
52 | "sNext": "unit3",
53 | "sLast": "test4"
54 | }
55 | }
56 | } );
57 | oSettings = oTable.fnSettings();
58 | },
59 | function () {
60 | var bReturn =
61 | oSettings.oLanguage.oPaginate.sFirst == "unit1" &&
62 | oSettings.oLanguage.oPaginate.sPrevious == "test2" &&
63 | oSettings.oLanguage.oPaginate.sNext == "unit3" &&
64 | oSettings.oLanguage.oPaginate.sLast == "test4";
65 | return bReturn;
66 | }
67 | );
68 |
69 | oTest.fnTest(
70 | "oLanguage.oPaginate definitions are in the DOM",
71 | null,
72 | function () {
73 | var bReturn =
74 | $('#example_paginate .first').html() == "unit1" &&
75 | $('#example_paginate .previous').html() == "test2" &&
76 | $('#example_paginate .next').html() == "unit3" &&
77 | $('#example_paginate .last').html() == "test4";
78 | return bReturn;
79 | }
80 | );
81 |
82 |
83 | oTest.fnComplete();
84 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.sInfoEmpty.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sInfoEmpty" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "Info empty language is 'Showing 0 to 0 of 0 entries' by default",
13 | function () { oTable.fnFilter("nothinghere"); },
14 | function () { return oSettings.oLanguage.sInfoEmpty == "Showing 0 to 0 of 0 entries"; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Info empty language default is in the DOM",
19 | null,
20 | function () {
21 | var bReturn = document.getElementById('example_info').innerHTML.replace(
22 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
23 | "Showing 0 to 0 of 0 entries";
24 | return bReturn;
25 | }
26 | );
27 |
28 |
29 | oTest.fnWaitTest(
30 | "Info empty language can be defined",
31 | function () {
32 | oSession.fnRestore();
33 | oTable = $('#example').dataTable( {
34 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
35 | "oLanguage": {
36 | "sInfoEmpty": "unit test"
37 | }
38 | } );
39 | oSettings = oTable.fnSettings();
40 | oTable.fnFilter("nothinghere");
41 | },
42 | function () { return oSettings.oLanguage.sInfoEmpty == "unit test"; }
43 | );
44 |
45 | oTest.fnTest(
46 | "Info empty language default is in the DOM",
47 | null,
48 | function () {
49 | var bReturn = document.getElementById('example_info').innerHTML.replace(
50 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
51 | "unit test";
52 | return bReturn;
53 | }
54 | );
55 |
56 |
57 | oTest.fnWaitTest(
58 | "Macro's not replaced",
59 | function () {
60 | oSession.fnRestore();
61 | oTable = $('#example').dataTable( {
62 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
63 | "oLanguage": {
64 | "sInfoEmpty": "unit _START_ _END_ _TOTAL_ test"
65 | }
66 | } );
67 | oTable.fnFilter("nothinghere");
68 | },
69 | function () {
70 | var bReturn = document.getElementById('example_info').innerHTML.replace(
71 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
72 | "unit _START_ _END_ _TOTAL_ test";
73 | return bReturn;
74 | }
75 | );
76 |
77 |
78 | oTest.fnComplete();
79 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.sInfoPostFix.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sInfoPostFix" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "Info post fix language is '' (blank) by default",
13 | null,
14 | function () { return oSettings.oLanguage.sInfoPostFix == ""; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Width no post fix, the basic info shows",
19 | null,
20 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; }
21 | );
22 |
23 |
24 | oTest.fnWaitTest(
25 | "Info post fix language can be defined",
26 | function () {
27 | oSession.fnRestore();
28 | oTable = $('#example').dataTable( {
29 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
30 | "oLanguage": {
31 | "sInfoPostFix": "unit test"
32 | }
33 | } );
34 | oSettings = oTable.fnSettings();
35 | },
36 | function () { return oSettings.oLanguage.sInfoPostFix == "unit test"; }
37 | );
38 |
39 | oTest.fnTest(
40 | "Info empty language default is in the DOM",
41 | null,
42 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit test"; }
43 | );
44 |
45 |
46 | oTest.fnWaitTest(
47 | "Macros have no effect in the post fix",
48 | function () {
49 | oSession.fnRestore();
50 | oTable = $('#example').dataTable( {
51 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
52 | "oLanguage": {
53 | "sInfoPostFix": "unit _START_ _END_ _TOTAL_ test"
54 | }
55 | } );
56 | },
57 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit _START_ _END_ _TOTAL_ test"; }
58 | );
59 |
60 |
61 | oTest.fnWaitTest(
62 | "Post fix is applied after fintering info",
63 | function () {
64 | oSession.fnRestore();
65 | oTable = $('#example').dataTable( {
66 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
67 | "oLanguage": {
68 | "sInfoPostFix": "unit test"
69 | }
70 | } );
71 | oTable.fnFilter("nothinghere");
72 | },
73 | function () { return document.getElementById('example_info').innerHTML = "Showing 0 to 0 of 0 entries unit (filtered from 57 total entries) test"; }
74 | );
75 |
76 |
77 | oTest.fnComplete();
78 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.sProcessing.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sProcessing" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
8 | "bProcessing": true
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "Processing language is 'Processing...' by default",
14 | null,
15 | function () { return oSettings.oLanguage.sProcessing == "Processing..."; }
16 | );
17 |
18 | oTest.fnTest(
19 | "Processing language default is in the DOM",
20 | null,
21 | function () { return document.getElementById('example_processing').innerHTML = "Processing..."; }
22 | );
23 |
24 |
25 | oTest.fnWaitTest(
26 | "Processing language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
31 | "bProcessing": true,
32 | "oLanguage": {
33 | "sProcessing": "unit test"
34 | }
35 | } );
36 | oSettings = oTable.fnSettings();
37 | },
38 | function () { return oSettings.oLanguage.sProcessing == "unit test"; }
39 | );
40 |
41 | oTest.fnTest(
42 | "Processing language definition is in the DOM",
43 | null,
44 | function () { return document.getElementById('example_processing').innerHTML = "unit test"; }
45 | );
46 |
47 |
48 | oTest.fnComplete();
49 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.sSearch.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sSearch" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "Search language is 'Search:' by default",
13 | null,
14 | function () { return oSettings.oLanguage.sSearch == "Search:"; }
15 | );
16 |
17 | oTest.fnTest(
18 | "Search language default is in the DOM",
19 | null,
20 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
21 | == "Search: "; }
22 | );
23 |
24 |
25 | oTest.fnWaitTest(
26 | "Search language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
31 | "oLanguage": {
32 | "sSearch": "unit test"
33 | }
34 | } );
35 | oSettings = oTable.fnSettings();
36 | },
37 | function () { return oSettings.oLanguage.sSearch == "unit test"; }
38 | );
39 |
40 | oTest.fnTest(
41 | "Info language definition is in the DOM",
42 | null,
43 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
44 | == "unit test "; }
45 | );
46 |
47 |
48 | oTest.fnWaitTest(
49 | "Blank search has a no space (separator) inserted",
50 | function () {
51 | oSession.fnRestore();
52 | oTable = $('#example').dataTable( {
53 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
54 | "oLanguage": {
55 | "sSearch": ""
56 | }
57 | } );
58 | oSettings = oTable.fnSettings();
59 | },
60 | function () { return document.getElementById('example_filter').childNodes.length == 1; }
61 | );
62 |
63 |
64 | oTest.fnComplete();
65 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.sUrl.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sUrl" );
3 |
4 | /* Note that we only test the internal storage of language information pulled form a file here
5 | * as the other language tests will check it goes into the DOM correctly
6 | */
7 |
8 | $(document).ready( function () {
9 | /* Check the default */
10 | var oTable = $('#example').dataTable( {
11 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
12 | } );
13 | var oSettings = oTable.fnSettings();
14 |
15 | oTest.fnTest(
16 | "sUrl is blank by default",
17 | null,
18 | function () { return oSettings.oLanguage.sUrl == ""; }
19 | );
20 |
21 |
22 | oTest.fnWaitTest(
23 | "Loading of German file loads language information",
24 | function () {
25 | oSession.fnRestore();
26 | oTable = $('#example').dataTable( {
27 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
28 | "oLanguage": {
29 | "sUrl": "../../../examples/examples_support/de_DE.txt"
30 | }
31 | } );
32 | oSettings = oTable.fnSettings();
33 | },
34 | function () {
35 | var bReturn =
36 | oSettings.oLanguage.sProcessing == "Bitte warten..." &&
37 | oSettings.oLanguage.sLengthMenu == "_MENU_ Einträge anzeigen" &&
38 | oSettings.oLanguage.sZeroRecords == "Keine Einträge vorhanden." &&
39 | oSettings.oLanguage.sInfo == "_START_ bis _END_ von _TOTAL_ Einträgen" &&
40 | oSettings.oLanguage.sInfoEmpty == "0 bis 0 von 0 Einträgen" &&
41 | oSettings.oLanguage.sInfoFiltered == "(gefiltert von _MAX_ Einträgen)" &&
42 | oSettings.oLanguage.sInfoPostFix == "" &&
43 | oSettings.oLanguage.sSearch == "Suchen" &&
44 | oSettings.oLanguage.oPaginate.sFirst == "Erster" &&
45 | oSettings.oLanguage.oPaginate.sPrevious == "Zurück" &&
46 | oSettings.oLanguage.oPaginate.sNext == "Nächster" &&
47 | oSettings.oLanguage.oPaginate.sLast == "Letzter";
48 |
49 | return bReturn;
50 | }
51 | );
52 |
53 | /* One DOM check just to ensure that they go into the DOM */
54 | oTest.fnTest(
55 | "Loaded language goes into the DOM",
56 | null,
57 | function () { return document.getElementById('example_info').innerHTML = "1 bis 10 von 57 Einträgen"; }
58 | );
59 |
60 |
61 | oTest.fnComplete();
62 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/oLanguage.sZeroRecords.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sZeroRecords" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
8 | } );
9 | var oSettings = oTable.fnSettings();
10 |
11 | oTest.fnWaitTest(
12 | "Zero records language is 'No matching records found' by default",
13 | null,
14 | function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; }
15 | );
16 |
17 | oTest.fnWaitTest(
18 | "Text is shown when empty table (after filtering)",
19 | function () { oTable.fnFilter('nothinghere'); },
20 | function () { return $('#example tbody tr td')[0].innerHTML == "No matching records found" }
21 | );
22 |
23 |
24 |
25 | oTest.fnWaitTest(
26 | "Zero records language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "sAjaxSource": "../../../examples/examples_support/json_source.txt",
31 | "oLanguage": {
32 | "sZeroRecords": "unit test"
33 | }
34 | } );
35 | oSettings = oTable.fnSettings();
36 | },
37 | function () { return oSettings.oLanguage.sZeroRecords == "unit test"; }
38 | );
39 |
40 | oTest.fnWaitTest(
41 | "Text is shown when empty table (after filtering)",
42 | function () { oTable.fnFilter('nothinghere2'); },
43 | function () { return $('#example tbody tr td')[0].innerHTML == "unit test" }
44 | );
45 |
46 |
47 | oTest.fnComplete();
48 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/3_ajax/sAjaxSource.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "sAjaxSource" );
3 |
4 | /* Sanitfy check really - all the other tests blast this */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "sAjaxSource": "../../../examples/examples_support/json_source.txt"
10 | } );
11 | var oSettings = oTable.fnSettings();
12 |
13 | oTest.fnWaitTest(
14 | "Server side is off by default",
15 | null,
16 | function () {
17 | return oSettings.sAjaxSource == "../../../examples/examples_support/json_source.txt";
18 | }
19 | );
20 |
21 | oTest.fnComplete();
22 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/-iDraw.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "iDraw - check that iDraw increments for each draw" );
3 |
4 |
5 | $(document).ready( function () {
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "After first draw, iDraw is 1",
14 | null,
15 | function () { return oSettings.iDraw == 1; }
16 | );
17 |
18 | oTest.fnWaitTest(
19 | "After second draw, iDraw is 2",
20 | function () { oTable.fnDraw() },
21 | function () { return oSettings.iDraw == 2; }
22 | );
23 |
24 | oTest.fnWaitTest(
25 | "After sort",
26 | function () { oTable.fnSort([[1,'asc']]) },
27 | function () { return oSettings.iDraw == 3; }
28 | );
29 |
30 | oTest.fnWaitTest(
31 | "After filter",
32 | function () { oTable.fnFilter('gecko') },
33 | function () { return oSettings.iDraw == 4; }
34 | );
35 |
36 | oTest.fnWaitTest(
37 | "After another filter",
38 | function () { oTable.fnFilter('gec') },
39 | function () { return oSettings.iDraw == 5; }
40 | );
41 |
42 |
43 | oTest.fnComplete();
44 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/2440.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | /*
3 | * NOTE: There are some differences in this zero config script for server-side
4 | * processing compared to the other data sources. The main reason for this is the
5 | * difference in how the server-side processing does it's filtering. Also the
6 | * sorting state is always reset on each draw.
7 | */
8 | oTest.fnStart( "Info element with display all" );
9 |
10 | $(document).ready( function () {
11 | var oTable = $('#example').dataTable( {
12 | "bServerSide": true,
13 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
14 | } );
15 |
16 | oTable.fnSettings()._iDisplayLength = -1;
17 | oTable.oApi._fnCalculateEnd( oTable.fnSettings() );
18 | oTable.fnDraw();
19 |
20 |
21 | /* Basic checks */
22 | oTest.fnWaitTest(
23 | "Check length is correct when -1 length given",
24 | null,
25 | function () {
26 | return document.getElementById('example_info').innerHTML ==
27 | "Showing 1 to 57 of 57 entries";
28 | }
29 | );
30 |
31 | oTest.fnComplete();
32 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/2569.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "Destroy with hidden columns" );
3 |
4 | $(document).ready( function () {
5 | var mTest;
6 |
7 |
8 | $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
11 | "aoColumnDefs": [
12 | { "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },
13 | { "bVisible": false, "aTargets": [ 3 ] }
14 | ],
15 | "fnInitComplete": function () {
16 | this.fnDestroy();
17 | }
18 | } );
19 |
20 | oTest.fnWaitTest(
21 | "Check that the number of columns in table is correct",
22 | null,
23 | function () { return $('#example tbody tr:eq(0) td').length == 5; }
24 | );
25 |
26 |
27 | oTest.fnTest(
28 | "And with scrolling",
29 | function () {
30 | $('#example').dataTable( {
31 | "bServerSide": true,
32 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
33 | "sScrollY": 200,
34 | "aoColumnDefs": [
35 | { "bSearchable": false, "bVisible": false, "aTargets": [ 2 ] },
36 | { "bVisible": false, "aTargets": [ 3 ] }
37 | ],
38 | "fnInitComplete": function () {
39 | this.fnDestroy();
40 | }
41 | } );
42 | },
43 | function () { return $('#example tbody tr:eq(0) td').length == 5; }
44 | );
45 |
46 | oTest.fnComplete();
47 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/2600.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "2600 - Display rewind when changing length" );
3 |
4 | $(document).ready( function () {
5 | $('#example').dataTable( {
6 | "bServerSide": true,
7 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
8 | } );
9 |
10 | oTest.fnWaitTest(
11 | "Info correct on init",
12 | null,
13 | function () { return $('#example_info').html() == "Showing 1 to 10 of 57 entries"; }
14 | );
15 |
16 | oTest.fnWaitTest(
17 | "Page 2",
18 | function () { $('#example_next').click(); },
19 | function () { return $('#example_info').html() == "Showing 11 to 20 of 57 entries"; }
20 | );
21 |
22 | oTest.fnWaitTest(
23 | "Page 3",
24 | function () { $('#example_next').click(); },
25 | function () { return $('#example_info').html() == "Showing 21 to 30 of 57 entries"; }
26 | );
27 |
28 | oTest.fnWaitTest(
29 | "Page 4",
30 | function () { $('#example_next').click(); },
31 | function () { return $('#example_info').html() == "Showing 31 to 40 of 57 entries"; }
32 | );
33 |
34 | oTest.fnWaitTest(
35 | "Page 5",
36 | function () { $('#example_next').click(); },
37 | function () { return $('#example_info').html() == "Showing 41 to 50 of 57 entries"; }
38 | );
39 |
40 | oTest.fnWaitTest(
41 | "Rewind",
42 | function () { $('#example_length select').val('100'); $('#example_length select').change(); },
43 | function () { return $('#example_info').html() == "Showing 1 to 57 of 57 entries"; }
44 | );
45 |
46 | oTest.fnComplete();
47 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aaSortingFixed.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aaSortingFixed" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "No fixed sorting by default",
14 | null,
15 | function () {
16 | return oSettings.aaSortingFixed == null;
17 | }
18 | );
19 |
20 |
21 | oTest.fnWaitTest(
22 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)",
23 | function () {
24 | oSession.fnRestore();
25 | $('#example').dataTable( {
26 | "bServerSide": true,
27 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
28 | "aaSortingFixed": [['0','asc']]
29 | } );
30 | $('#example thead th:eq(1)').click();
31 | },
32 | function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
33 | );
34 |
35 | oTest.fnWaitTest(
36 | "Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)",
37 | function () {
38 | $('#example thead th:eq(1)').click();
39 | },
40 | function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
41 | );
42 |
43 | oTest.fnWaitTest(
44 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)",
45 | function () {
46 | oSession.fnRestore();
47 | $('#example').dataTable( {
48 | "bServerSide": true,
49 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
50 | "aaSortingFixed": [['3','asc']]
51 | } );
52 | $('#example thead th:eq(1)').click();
53 | },
54 | function () { return $('#example tbody td:eq(1)').html() == "All others"; }
55 | );
56 |
57 | oTest.fnWaitTest(
58 | "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)",
59 | function () {
60 | $('#example thead th:eq(1)').click();
61 | },
62 | function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; }
63 | );
64 |
65 |
66 | oTest.fnComplete();
67 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aoColumns.bSearchable.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.bSeachable" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "Columns are searchable by default",
14 | function () { oTable.fnFilter("Camino"); },
15 | function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Camino 1.0"; }
16 | );
17 |
18 | /* NOT ACTUALLY GOING TO TEST BSEARCHABLE HERE. Reason being is that it requires the server
19 | * side to alter it's processing, and this information about columns is not actually sent to
20 | * the server
21 | */
22 |
23 |
24 | oTest.fnComplete();
25 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aoColumns.bUseRendered.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.bUseRendered" );
3 |
4 | /* bUseRendered is used to alter sorting data, if false then the original data is used for
5 | * sorting rather than the rendered data
6 | */
7 |
8 | $(document).ready( function () {
9 | /* Check the default */
10 | var mTmp = 0;
11 |
12 | var oTable = $('#example').dataTable( {
13 | "bServerSide": true,
14 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
15 | "aoColumns": [
16 | null,
17 | { "fnRender": function (a) {
18 | if ( mTmp == 0 ) {
19 | mTmp++;
20 | return "aaa";
21 | } else
22 | return a.aData[a.iDataColumn];
23 | } },
24 | null,
25 | null,
26 | null
27 | ]
28 | } );
29 | var oSettings = oTable.fnSettings();
30 |
31 | oTest.fnWaitTest(
32 | "Default for bUseRendered is true - rendered data is used for sorting",
33 | function () { $('#example thead th:eq(1)').click(); },
34 | function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'aaa'; }
35 | );
36 |
37 | /* Limited to what we can do here as the sorting is done on the server side. So stop here. */
38 |
39 |
40 |
41 |
42 | oTest.fnComplete();
43 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aoColumns.sName.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.sName" );
3 |
4 | /* This has no effect at all in DOM methods - so we just check that it has applied the name */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
11 | "aoColumns": [
12 | null,
13 | null,
14 | null,
15 | { "sName": 'unit test' },
16 | null
17 | ]
18 | } );
19 | var oSettings = oTable.fnSettings();
20 |
21 | oTest.fnWaitTest(
22 | "Names are stored in the columns object",
23 | null,
24 | function () { return oSettings.aoColumns[3].sName =="unit test"; }
25 | );
26 |
27 |
28 | oTest.fnComplete();
29 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aoColumns.sTitle.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.sTitle" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "If not given, then the columns titles are empty",
14 | null,
15 | function () {
16 | var jqNodes = $('#example thead tr:eq(0) th');
17 | var bReturn =
18 | jqNodes[0].innerHTML == "Rendering engine" &&
19 | jqNodes[1].innerHTML == "Browser" &&
20 | jqNodes[2].innerHTML == "Platform(s)" &&
21 | jqNodes[3].innerHTML == "Engine version" &&
22 | jqNodes[4].innerHTML == "CSS grade";
23 | return bReturn;
24 | }
25 | );
26 |
27 | oTest.fnWaitTest(
28 | "Can set a single column title - and others are read from DOM",
29 | function () {
30 | oSession.fnRestore();
31 | $('#example').dataTable( {
32 | "bServerSide": true,
33 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
34 | "aoColumns": [
35 | null,
36 | { "sTitle": 'unit test' },
37 | null,
38 | null,
39 | null
40 | ]
41 | } );
42 | },
43 | function () {
44 | var jqNodes = $('#example thead tr:eq(0) th');
45 | var bReturn =
46 | jqNodes[0].innerHTML == "Rendering engine" &&
47 | jqNodes[1].innerHTML == "unit test" &&
48 | jqNodes[2].innerHTML == "Platform(s)" &&
49 | jqNodes[3].innerHTML == "Engine version" &&
50 | jqNodes[4].innerHTML == "CSS grade";
51 | return bReturn;
52 | }
53 | );
54 |
55 | oTest.fnWaitTest(
56 | "Can set multiple column titles",
57 | function () {
58 | oSession.fnRestore();
59 | $('#example').dataTable( {
60 | "bServerSide": true,
61 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
62 | "aoColumns": [
63 | null,
64 | { "sTitle": 'unit test 1' },
65 | null,
66 | null,
67 | { "sTitle": 'unit test 2' }
68 | ]
69 | } );
70 | },
71 | function () {
72 | var jqNodes = $('#example thead tr:eq(0) th');
73 | var bReturn =
74 | jqNodes[0].innerHTML == "Rendering engine" &&
75 | jqNodes[1].innerHTML == "unit test 1" &&
76 | jqNodes[2].innerHTML == "Platform(s)" &&
77 | jqNodes[3].innerHTML == "Engine version" &&
78 | jqNodes[4].innerHTML == "unit test 2";
79 | return bReturn;
80 | }
81 | );
82 |
83 |
84 | oTest.fnComplete();
85 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aoColumns.sWidth.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoColumns.sWidth" );
3 |
4 | /* NOTE - we need to disable the auto width for the majority of these test in order to preform
5 | * these tests as the auto width will convert the width to a px value. We can do 'non-exact' tests
6 | * with auto width enabled however to ensure it scales columns as required
7 | */
8 |
9 | $(document).ready( function () {
10 | /* Check the default */
11 | var oTable = $('#example').dataTable( {
12 | "bServerSide": true,
13 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
14 | "bAutoWidth": false,
15 | "aoColumns": [
16 | null,
17 | { "sWidth": '40%' },
18 | null,
19 | null,
20 | null
21 | ]
22 | } );
23 | var oSettings = oTable.fnSettings();
24 |
25 | oTest.fnWaitTest(
26 | "With auto width disabled the width for one column is appled",
27 | null,
28 | function () { return $('#example thead th:eq(1)')[0].style.width == "40%"; }
29 | );
30 |
31 | oTest.fnWaitTest(
32 | "With auto width disabled the width for one column is appled",
33 | function () {
34 | oSession.fnRestore();
35 | oTable = $('#example').dataTable( {
36 | "bServerSide": true,
37 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
38 | "bAutoWidth": false,
39 | "aoColumns": [
40 | null,
41 | null,
42 | { "sWidth": '20%' },
43 | { "sWidth": '30%' },
44 | null
45 | ]
46 | } );
47 | },
48 | function () {
49 | var bReturn =
50 | $('#example thead th:eq(2)')[0].style.width == "20%" &&
51 | $('#example thead th:eq(3)')[0].style.width == "30%";
52 | return bReturn;
53 | }
54 | );
55 |
56 |
57 | oTest.fnWaitTest(
58 | "With auto width, it will make the smallest column the largest with percentage width given",
59 | function () {
60 | oSession.fnRestore();
61 | oTable = $('#example').dataTable( {
62 | "bServerSide": true,
63 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
64 | "aoColumns": [
65 | null,
66 | null,
67 | null,
68 | { "sWidth": '40%' },
69 | null
70 | ]
71 | } );
72 | },
73 | function () {
74 | var anThs = $('#example thead th');
75 | var a0 = anThs[0].offsetWidth;
76 | var a1 = anThs[1].offsetWidth;
77 | var a2 = anThs[2].offsetWidth;
78 | var a3 = anThs[3].offsetWidth;
79 | var a4 = anThs[4].offsetWidth;
80 |
81 | if ( a3>a0 && a3>a1 && a3>a2 && a3>a4 )
82 | return true;
83 | else
84 | return false;
85 | }
86 | );
87 |
88 |
89 | oTest.fnComplete();
90 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/aoSearchCols.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "aoSearchCols" );
3 |
4 | /* We could be here forever testing this one, so we test a limited subset on a couple of colums */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing_filter_col.php"
11 | } );
12 | var oSettings = oTable.fnSettings();
13 |
14 | oTest.fnWaitTest(
15 | "Default should be to have a empty colums array",
16 | null,
17 | function () {
18 | var bReturn =
19 | oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex &&
20 | oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex &&
21 | oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex &&
22 | oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex &&
23 | oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex;
24 | return bReturn;
25 | }
26 | );
27 |
28 |
29 | oTest.fnWaitTest(
30 | "Search on a single column - no regex statement given",
31 | function () {
32 | oSession.fnRestore();
33 | oTable = $('#example').dataTable( {
34 | "bServerSide": true,
35 | "sAjaxSource": "../../../examples/examples_support/server_processing_filter_col.php",
36 | "aoSearchCols": [
37 | null,
38 | { "sSearch": "Mozilla" },
39 | null,
40 | { "sSearch": "1" },
41 | null
42 | ]
43 | } );
44 | },
45 | function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1"; }
46 | );
47 |
48 | oTest.fnWaitTest(
49 | "Search on two columns - no regex statement given",
50 | function () {
51 | oSession.fnRestore();
52 | oTable = $('#example').dataTable( {
53 | "bServerSide": true,
54 | "sAjaxSource": "../../../examples/examples_support/server_processing_filter_col.php",
55 | "aoSearchCols": [
56 | null,
57 | { "sSearch": "Mozilla" },
58 | null,
59 | { "sSearch": "1.5" },
60 | null
61 | ]
62 | } );
63 | },
64 | function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; }
65 | );
66 |
67 | /* No regex escape searches here - would need to be implemented on the server-side */
68 |
69 | oTest.fnComplete();
70 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/bFilter.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bFilter" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 |
11 | oTest.fnWaitTest(
12 | "Filtering div exists by default",
13 | null,
14 | function () { return document.getElementById('example_filter') != null; }
15 | );
16 |
17 | /* Check can disable */
18 | oTest.fnWaitTest(
19 | "Fltering can be disabled",
20 | function () {
21 | oSession.fnRestore();
22 | $('#example').dataTable( {
23 | "bServerSide": true,
24 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
25 | "bFilter": false
26 | } );
27 | },
28 | function () { return document.getElementById('example_filter') == null; }
29 | );
30 |
31 | /* Enable makes no difference */
32 | oTest.fnWaitTest(
33 | "Filtering enabled override",
34 | function () {
35 | oSession.fnRestore();
36 | $('#example').dataTable( {
37 | "bServerSide": true,
38 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
39 | "bFilter": true
40 | } );
41 | },
42 | function () { return document.getElementById('example_filter') != null; }
43 | );
44 |
45 |
46 | oTest.fnComplete();
47 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/bInfo.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bInfo" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 |
11 | oTest.fnWaitTest(
12 | "Info div exists by default",
13 | null,
14 | function () { return document.getElementById('example_info') != null; }
15 | );
16 |
17 | /* Check can disable */
18 | oTest.fnWaitTest(
19 | "Info can be disabled",
20 | function () {
21 | oSession.fnRestore();
22 | $('#example').dataTable( {
23 | "bServerSide": true,
24 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
25 | "bInfo": false
26 | } );
27 | },
28 | function () { return document.getElementById('example_info') == null; }
29 | );
30 |
31 | /* Enable makes no difference */
32 | oTest.fnWaitTest(
33 | "Info enabled override",
34 | function () {
35 | oSession.fnRestore();
36 | $('#example').dataTable( {
37 | "bServerSide": true,
38 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
39 | "bInfo": true
40 | } );
41 | },
42 | function () { return document.getElementById('example_info') != null; }
43 | );
44 |
45 |
46 | oTest.fnComplete();
47 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/bLengthChange.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bLengthChange" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 |
11 | oTest.fnWaitTest(
12 | "Length div exists by default",
13 | null,
14 | function () { return document.getElementById('example_length') != null; }
15 | );
16 |
17 | oTest.fnWaitTest(
18 | "Four default options",
19 | null,
20 | function () { return $("select[name=example_length] option").length == 4; }
21 | );
22 |
23 | oTest.fnWaitTest(
24 | "Default options",
25 | null,
26 | function () {
27 | var opts = $("select[name='example_length'] option");
28 | return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
29 | opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
30 | }
31 | );
32 |
33 | oTest.fnWaitTest(
34 | "Info takes length into account",
35 | null,
36 | function () { return document.getElementById('example_info').innerHTML ==
37 | "Showing 1 to 10 of 57 entries"; }
38 | );
39 |
40 | /* Check can disable */
41 | oTest.fnWaitTest(
42 | "Change length can be disabled",
43 | function () {
44 | oSession.fnRestore();
45 | $('#example').dataTable( {
46 | "bServerSide": true,
47 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
48 | "bLengthChange": false
49 | } );
50 | },
51 | function () { return document.getElementById('example_length') == null; }
52 | );
53 |
54 | oTest.fnWaitTest(
55 | "Information takes length disabled into account",
56 | null,
57 | function () { return document.getElementById('example_info').innerHTML ==
58 | "Showing 1 to 10 of 57 entries"; }
59 | );
60 |
61 | /* Enable makes no difference */
62 | oTest.fnWaitTest(
63 | "Length change enabled override",
64 | function () {
65 | oSession.fnRestore();
66 | $('#example').dataTable( {
67 | "bServerSide": true,
68 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
69 | "bLengthChange": true
70 | } );
71 | },
72 | function () { return document.getElementById('example_length') != null; }
73 | );
74 |
75 |
76 |
77 | oTest.fnComplete();
78 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/bPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bPaginate" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 |
11 | oTest.fnWaitTest(
12 | "Pagiantion div exists by default",
13 | null,
14 | function () { return document.getElementById('example_paginate') != null; }
15 | );
16 |
17 | oTest.fnWaitTest(
18 | "Information div takes paging into account",
19 | null,
20 | function () { return document.getElementById('example_info').innerHTML ==
21 | "Showing 1 to 10 of 57 entries"; }
22 | );
23 |
24 | /* Check can disable */
25 | oTest.fnWaitTest(
26 | "Pagiantion can be disabled",
27 | function () {
28 | oSession.fnRestore();
29 | $('#example').dataTable( {
30 | "bServerSide": true,
31 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
32 | "bPaginate": false
33 | } );
34 | },
35 | function () { return document.getElementById('example_paginate') == null; }
36 | );
37 |
38 | oTest.fnWaitTest(
39 | "Information div takes paging disabled into account",
40 | null,
41 | function () { return document.getElementById('example_info').innerHTML ==
42 | "Showing 1 to 57 of 57 entries"; }
43 | );
44 |
45 | /* Enable makes no difference */
46 | oTest.fnWaitTest(
47 | "Pagiantion enabled override",
48 | function () {
49 | oSession.fnRestore();
50 | $('#example').dataTable( {
51 | "bServerSide": true,
52 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
53 | "bPaginate": true
54 | } );
55 | },
56 | function () { return document.getElementById('example_paginate') != null; }
57 | );
58 |
59 |
60 |
61 | oTest.fnComplete();
62 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/bServerSide.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "bServerSide" );
3 |
4 | /* All the other scripts blast the ssp processing */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
11 | } );
12 | var oSettings = oTable.fnSettings();
13 |
14 | oTest.fnWaitTest(
15 | "Server side can be set to on",
16 | null,
17 | function () { return oSettings.oFeatures.bServerSide == true; }
18 | );
19 |
20 | oTest.fnComplete();
21 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/fnDrawCallback.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "fnDrawCallback" );
3 |
4 | /* Fairly boring function compared to the others! */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
11 | } );
12 | var oSettings = oTable.fnSettings();
13 | var mPass;
14 |
15 | oTest.fnWaitTest(
16 | "Default should be null",
17 | null,
18 | function () { return oSettings.fnDrawCallback == null; }
19 | );
20 |
21 |
22 | oTest.fnWaitTest(
23 | "One argument passed",
24 | function () {
25 | oSession.fnRestore();
26 |
27 | mPass = -1;
28 | $('#example').dataTable( {
29 | "bServerSide": true,
30 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
31 | "fnDrawCallback": function ( ) {
32 | mPass = arguments.length;
33 | }
34 | } );
35 | },
36 | function () { return mPass == 1; }
37 | );
38 |
39 |
40 | oTest.fnWaitTest(
41 | "That one argument is the settings object",
42 | function () {
43 | oSession.fnRestore();
44 |
45 | oTable = $('#example').dataTable( {
46 | "bServerSide": true,
47 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
48 | "fnDrawCallback": function ( oSettings ) {
49 | mPass = oSettings;
50 | }
51 | } );
52 | },
53 | function () { return oTable.fnSettings() == mPass; }
54 | );
55 |
56 |
57 | oTest.fnWaitTest(
58 | "fnRowCallback called once on first draw",
59 | function () {
60 | oSession.fnRestore();
61 |
62 | mPass = 0;
63 | $('#example').dataTable( {
64 | "bServerSide": true,
65 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
66 | "fnDrawCallback": function ( ) {
67 | mPass++;
68 | }
69 | } );
70 | },
71 | function () { return mPass == 1; }
72 | );
73 |
74 | oTest.fnWaitTest(
75 | "fnRowCallback called once on each draw there after as well",
76 | function () {
77 | $('#example_next').click();
78 | $('#example_next').click();
79 | $('#example_next').click();
80 | },
81 | function () { return mPass > 1; }
82 | );
83 |
84 |
85 |
86 |
87 |
88 | oTest.fnComplete();
89 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/iDisplayLength.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "iDisplayLength" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 |
11 | oTest.fnWaitTest(
12 | "Default length is ten",
13 | null,
14 | function () { return $('#example tbody tr').length == 10; }
15 | );
16 |
17 | oTest.fnWaitTest(
18 | "Select menu shows 10",
19 | null,
20 | function () { return $('#example_length select').val() == 10; }
21 | );
22 |
23 |
24 | oTest.fnWaitTest(
25 | "Set initial length to 25",
26 | function () {
27 | oSession.fnRestore();
28 | $('#example').dataTable( {
29 | "bServerSide": true,
30 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
31 | "iDisplayLength": 25
32 | } );
33 | },
34 | function () { return $('#example tbody tr').length == 25; }
35 | );
36 |
37 | oTest.fnWaitTest(
38 | "Select menu shows 25",
39 | null,
40 | function () { return $('#example_length select').val() == 25; }
41 | );
42 |
43 |
44 | oTest.fnWaitTest(
45 | "Set initial length to 100",
46 | function () {
47 | oSession.fnRestore();
48 | $('#example').dataTable( {
49 | "bServerSide": true,
50 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
51 | "iDisplayLength": 100
52 | } );
53 | },
54 | function () { return $('#example tbody tr').length == 57; }
55 | );
56 |
57 | oTest.fnWaitTest(
58 | "Select menu shows 25",
59 | null,
60 | function () { return $('#example_length select').val() == 100; }
61 | );
62 |
63 |
64 | oTest.fnWaitTest(
65 | "Set initial length to 23 (unknown select menu length)",
66 | function () {
67 | oSession.fnRestore();
68 | $('#example').dataTable( {
69 | "bServerSide": true,
70 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
71 | "iDisplayLength": 23
72 | } );
73 | },
74 | function () { return $('#example tbody tr').length == 23; }
75 | );
76 |
77 | oTest.fnWaitTest(
78 | "Select menu shows 10 (since 23 is unknow)",
79 | null,
80 | function () { return $('#example_length select').val() == 10; }
81 | );
82 |
83 |
84 | oTest.fnComplete();
85 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.oPaginate.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.oPaginate" );
3 |
4 | /* Note that the paging language information only has relevence in full numbers */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
11 | "sPaginationType": "full_numbers"
12 | } );
13 | var oSettings = oTable.fnSettings();
14 |
15 | oTest.fnWaitTest(
16 | "oLanguage.oPaginate defaults",
17 | null,
18 | function () {
19 | var bReturn =
20 | oSettings.oLanguage.oPaginate.sFirst == "First" &&
21 | oSettings.oLanguage.oPaginate.sPrevious == "Previous" &&
22 | oSettings.oLanguage.oPaginate.sNext == "Next" &&
23 | oSettings.oLanguage.oPaginate.sLast == "Last";
24 | return bReturn;
25 | }
26 | );
27 |
28 | oTest.fnTest(
29 | "oLanguage.oPaginate defaults are in the DOM",
30 | null,
31 | function () {
32 | var bReturn =
33 | $('#example_paginate .first').html() == "First" &&
34 | $('#example_paginate .previous').html() == "Previous" &&
35 | $('#example_paginate .next').html() == "Next" &&
36 | $('#example_paginate .last').html() == "Last";
37 | return bReturn;
38 | }
39 | );
40 |
41 |
42 | oTest.fnWaitTest(
43 | "oLanguage.oPaginate can be defined",
44 | function () {
45 | oSession.fnRestore();
46 | oTable = $('#example').dataTable( {
47 | "bServerSide": true,
48 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
49 | "sPaginationType": "full_numbers",
50 | "oLanguage": {
51 | "oPaginate": {
52 | "sFirst": "unit1",
53 | "sPrevious": "test2",
54 | "sNext": "unit3",
55 | "sLast": "test4"
56 | }
57 | }
58 | } );
59 | oSettings = oTable.fnSettings();
60 | },
61 | function () {
62 | var bReturn =
63 | oSettings.oLanguage.oPaginate.sFirst == "unit1" &&
64 | oSettings.oLanguage.oPaginate.sPrevious == "test2" &&
65 | oSettings.oLanguage.oPaginate.sNext == "unit3" &&
66 | oSettings.oLanguage.oPaginate.sLast == "test4";
67 | return bReturn;
68 | }
69 | );
70 |
71 | oTest.fnTest(
72 | "oLanguage.oPaginate definitions are in the DOM",
73 | null,
74 | function () {
75 | var bReturn =
76 | $('#example_paginate .first').html() == "unit1" &&
77 | $('#example_paginate .previous').html() == "test2" &&
78 | $('#example_paginate .next').html() == "unit3" &&
79 | $('#example_paginate .last').html() == "test4";
80 | return bReturn;
81 | }
82 | );
83 |
84 |
85 | oTest.fnComplete();
86 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.sInfoEmpty.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sInfoEmpty" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "Info empty language is 'Showing 0 to 0 of 0 entries' by default",
14 | function () { oTable.fnFilter("nothinghere"); },
15 | function () { return oSettings.oLanguage.sInfoEmpty == "Showing 0 to 0 of 0 entries"; }
16 | );
17 |
18 | oTest.fnWaitTest(
19 | "Info empty language default is in the DOM",
20 | null,
21 | function () {
22 | var bReturn = document.getElementById('example_info').innerHTML.replace(
23 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
24 | "Showing 0 to 0 of 0 entries";
25 | return bReturn;
26 | }
27 | );
28 |
29 |
30 | oTest.fnWaitTest(
31 | "Info empty language can be defined",
32 | function () {
33 | oSession.fnRestore();
34 | oTable = $('#example').dataTable( {
35 | "bServerSide": true,
36 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
37 | "oLanguage": {
38 | "sInfoEmpty": "unit test"
39 | }
40 | } );
41 | oSettings = oTable.fnSettings();
42 | oTable.fnFilter("nothinghere");
43 | },
44 | function () { return oSettings.oLanguage.sInfoEmpty == "unit test"; }
45 | );
46 |
47 | oTest.fnWaitTest(
48 | "Info empty language default is in the DOM",
49 | null,
50 | function () {
51 | var bReturn = document.getElementById('example_info').innerHTML.replace(
52 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
53 | "unit test";
54 | return bReturn;
55 | }
56 | );
57 |
58 |
59 | oTest.fnWaitTest(
60 | "Macro's not replaced",
61 | function () {
62 | oSession.fnRestore();
63 | oTable = $('#example').dataTable( {
64 | "bServerSide": true,
65 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
66 | "oLanguage": {
67 | "sInfoEmpty": "unit _START_ _END_ _TOTAL_ test"
68 | }
69 | } );
70 | oTable.fnFilter("nothinghere");
71 | },
72 | function () {
73 | var bReturn = document.getElementById('example_info').innerHTML.replace(
74 | ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) ==
75 | "unit _START_ _END_ _TOTAL_ test";
76 | return bReturn;
77 | }
78 | );
79 |
80 |
81 | oTest.fnComplete();
82 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.sInfoPostFix.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sInfoPostFix" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "Info post fix language is '' (blank) by default",
14 | null,
15 | function () { return oSettings.oLanguage.sInfoPostFix == ""; }
16 | );
17 |
18 | oTest.fnTest(
19 | "Width no post fix, the basic info shows",
20 | null,
21 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; }
22 | );
23 |
24 |
25 | oTest.fnWaitTest(
26 | "Info post fix language can be defined",
27 | function () {
28 | oSession.fnRestore();
29 | oTable = $('#example').dataTable( {
30 | "bServerSide": true,
31 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
32 | "oLanguage": {
33 | "sInfoPostFix": "unit test"
34 | }
35 | } );
36 | oSettings = oTable.fnSettings();
37 | },
38 | function () { return oSettings.oLanguage.sInfoPostFix == "unit test"; }
39 | );
40 |
41 | oTest.fnTest(
42 | "Info empty language default is in the DOM",
43 | null,
44 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit test"; }
45 | );
46 |
47 |
48 | oTest.fnWaitTest(
49 | "Macros have no effect in the post fix",
50 | function () {
51 | oSession.fnRestore();
52 | oTable = $('#example').dataTable( {
53 | "bServerSide": true,
54 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
55 | "oLanguage": {
56 | "sInfoPostFix": "unit _START_ _END_ _TOTAL_ test"
57 | }
58 | } );
59 | },
60 | function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit _START_ _END_ _TOTAL_ test"; }
61 | );
62 |
63 |
64 | oTest.fnWaitTest(
65 | "Post fix is applied after fintering info",
66 | function () {
67 | oSession.fnRestore();
68 | oTable = $('#example').dataTable( {
69 | "bServerSide": true,
70 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
71 | "oLanguage": {
72 | "sInfoPostFix": "unit test"
73 | }
74 | } );
75 | oTable.fnFilter("nothinghere");
76 | },
77 | function () { return document.getElementById('example_info').innerHTML = "Showing 0 to 0 of 0 entries unit (filtered from 57 total entries) test"; }
78 | );
79 |
80 |
81 | oTest.fnComplete();
82 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.sProcessing.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sProcessing" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
9 | "bProcessing": true
10 | } );
11 | var oSettings = oTable.fnSettings();
12 |
13 | oTest.fnWaitTest(
14 | "Processing language is 'Processing...' by default",
15 | null,
16 | function () { return oSettings.oLanguage.sProcessing == "Processing..."; }
17 | );
18 |
19 | oTest.fnTest(
20 | "Processing language default is in the DOM",
21 | null,
22 | function () { return document.getElementById('example_processing').innerHTML = "Processing..."; }
23 | );
24 |
25 |
26 | oTest.fnWaitTest(
27 | "Processing language can be defined",
28 | function () {
29 | oSession.fnRestore();
30 | oTable = $('#example').dataTable( {
31 | "bServerSide": true,
32 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
33 | "bProcessing": true,
34 | "oLanguage": {
35 | "sProcessing": "unit test"
36 | }
37 | } );
38 | oSettings = oTable.fnSettings();
39 | },
40 | function () { return oSettings.oLanguage.sProcessing == "unit test"; }
41 | );
42 |
43 | oTest.fnTest(
44 | "Processing language definition is in the DOM",
45 | null,
46 | function () { return document.getElementById('example_processing').innerHTML = "unit test"; }
47 | );
48 |
49 |
50 | oTest.fnComplete();
51 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.sSearch.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sSearch" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "Search language is 'Search:' by default",
14 | null,
15 | function () { return oSettings.oLanguage.sSearch == "Search:"; }
16 | );
17 |
18 | oTest.fnTest(
19 | "Search language default is in the DOM",
20 | null,
21 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
22 | == "Search: "; }
23 | );
24 |
25 |
26 | oTest.fnWaitTest(
27 | "Search language can be defined",
28 | function () {
29 | oSession.fnRestore();
30 | oTable = $('#example').dataTable( {
31 | "bServerSide": true,
32 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
33 | "oLanguage": {
34 | "sSearch": "unit test"
35 | }
36 | } );
37 | oSettings = oTable.fnSettings();
38 | },
39 | function () { return oSettings.oLanguage.sSearch == "unit test"; }
40 | );
41 |
42 | oTest.fnTest(
43 | "Info language definition is in the DOM",
44 | null,
45 | function () { return document.getElementById('example_filter').childNodes[0].nodeValue
46 | == "unit test "; }
47 | );
48 |
49 |
50 | oTest.fnWaitTest(
51 | "Blank search has no space (separator) inserted",
52 | function () {
53 | oSession.fnRestore();
54 | oTable = $('#example').dataTable( {
55 | "bServerSide": true,
56 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
57 | "oLanguage": {
58 | "sSearch": ""
59 | }
60 | } );
61 | oSettings = oTable.fnSettings();
62 | },
63 | function () { return document.getElementById('example_filter').childNodes.length == 1; }
64 | );
65 |
66 |
67 | oTest.fnComplete();
68 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.sUrl.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sUrl" );
3 |
4 | /* Note that we only test the internal storage of language information pulled form a file here
5 | * as the other language tests will check it goes into the DOM correctly
6 | */
7 |
8 | $(document).ready( function () {
9 | /* Check the default */
10 | var oTable = $('#example').dataTable( {
11 | "bServerSide": true,
12 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
13 | } );
14 | var oSettings = oTable.fnSettings();
15 |
16 | oTest.fnTest(
17 | "sUrl is blank by default",
18 | null,
19 | function () { return oSettings.oLanguage.sUrl == ""; }
20 | );
21 |
22 |
23 | oTest.fnWaitTest(
24 | "Loading of German file loads language information",
25 | function () {
26 | oSession.fnRestore();
27 | oTable = $('#example').dataTable( {
28 | "bServerSide": true,
29 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
30 | "oLanguage": {
31 | "sUrl": "../../../examples/examples_support/de_DE.txt"
32 | }
33 | } );
34 | oSettings = oTable.fnSettings();
35 | },
36 | function () {
37 | var bReturn =
38 | oSettings.oLanguage.sProcessing == "Bitte warten..." &&
39 | oSettings.oLanguage.sLengthMenu == "_MENU_ Einträge anzeigen" &&
40 | oSettings.oLanguage.sZeroRecords == "Keine Einträge vorhanden." &&
41 | oSettings.oLanguage.sInfo == "_START_ bis _END_ von _TOTAL_ Einträgen" &&
42 | oSettings.oLanguage.sInfoEmpty == "0 bis 0 von 0 Einträgen" &&
43 | oSettings.oLanguage.sInfoFiltered == "(gefiltert von _MAX_ Einträgen)" &&
44 | oSettings.oLanguage.sInfoPostFix == "" &&
45 | oSettings.oLanguage.sSearch == "Suchen" &&
46 | oSettings.oLanguage.oPaginate.sFirst == "Erster" &&
47 | oSettings.oLanguage.oPaginate.sPrevious == "Zurück" &&
48 | oSettings.oLanguage.oPaginate.sNext == "Nächster" &&
49 | oSettings.oLanguage.oPaginate.sLast == "Letzter";
50 |
51 | return bReturn;
52 | }
53 | );
54 |
55 | /* One DOM check just to ensure that they go into the DOM */
56 | oTest.fnTest(
57 | "Loaded language goes into the DOM",
58 | null,
59 | function () { return document.getElementById('example_info').innerHTML = "1 bis 10 von 57 Einträgen"; }
60 | );
61 |
62 |
63 | oTest.fnComplete();
64 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/oLanguage.sZeroRecords.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "oLanguage.sZeroRecords" );
3 |
4 | $(document).ready( function () {
5 | /* Check the default */
6 | var oTable = $('#example').dataTable( {
7 | "bServerSide": true,
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
9 | } );
10 | var oSettings = oTable.fnSettings();
11 |
12 | oTest.fnWaitTest(
13 | "Zero records language is 'No matching records found' by default",
14 | null,
15 | function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; }
16 | );
17 |
18 | oTest.fnWaitTest(
19 | "Text is shown when empty table (after filtering)",
20 | function () { oTable.fnFilter('nothinghere'); },
21 | function () {
22 | if ( $('#example tbody tr td').length == 0 )
23 | return false;
24 | return $('#example tbody tr td')[0].innerHTML == "No matching records found";
25 | }
26 | );
27 |
28 |
29 |
30 | oTest.fnWaitTest(
31 | "Zero records language can be defined",
32 | function () {
33 | oSession.fnRestore();
34 | oTable = $('#example').dataTable( {
35 | "bServerSide": true,
36 | "sAjaxSource": "../../../examples/examples_support/server_processing.php",
37 | "oLanguage": {
38 | "sZeroRecords": "unit test"
39 | }
40 | } );
41 | oSettings = oTable.fnSettings();
42 | },
43 | function () { return oSettings.oLanguage.sZeroRecords == "unit test"; }
44 | );
45 |
46 | oTest.fnWaitTest(
47 | "Text is shown when empty table (after filtering)",
48 | function () { oTable.fnFilter('nothinghere2'); },
49 | function () {
50 | if ( $('#example tbody tr td').length == 0 )
51 | return false;
52 | return $('#example tbody tr td')[0].innerHTML == "unit test"
53 | }
54 | );
55 |
56 |
57 | oTest.fnComplete();
58 | } );
--------------------------------------------------------------------------------
/media/unit_testing/tests_onhold/4_server-side/sAjaxSource.js:
--------------------------------------------------------------------------------
1 | // DATA_TEMPLATE: empty_table
2 | oTest.fnStart( "sAjaxSource" );
3 |
4 | /* Sanitfy check really - all the other tests blast this */
5 |
6 | $(document).ready( function () {
7 | /* Check the default */
8 | var oTable = $('#example').dataTable( {
9 | "bServerSide": true,
10 | "sAjaxSource": "../../../examples/examples_support/server_processing.php"
11 | } );
12 | var oSettings = oTable.fnSettings();
13 |
14 | oTest.fnWaitTest(
15 | "Server side is off by default",
16 | null,
17 | function () {
18 | return oSettings.sAjaxSource == "../../../examples/examples_support/server_processing.php";
19 | }
20 | );
21 |
22 | oTest.fnComplete();
23 | } );
--------------------------------------------------------------------------------
/version.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
|