[Pkg-javascript-commits] [libjs-jquery-stupidtable] 01/04: New upstream version 1.0.2+dfsg

Sergio Durigan Junior sergiodj-guest at moszumanska.debian.org
Sat Feb 11 00:01:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

sergiodj-guest pushed a commit to branch master
in repository libjs-jquery-stupidtable.

commit e618d1069c9d332d6bb57164ec62dbe33d45c279
Author: Sergio Durigan Junior <sergiodj at sergiodj.net>
Date:   Fri Feb 10 18:54:40 2017 -0500

    New upstream version 1.0.2+dfsg
---
 README.md                 |  7 ++++++-
 bower.json                |  2 +-
 examples/basic.html       |  2 +-
 examples/colspan.html     |  2 +-
 examples/complex.html     |  2 +-
 examples/large-table.html |  2 +-
 stupidtable.js            |  6 ++++++
 tests/tests.js            | 28 ++++++++++++++++++++++++++++
 8 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 40576e8..0785fe6 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,12 @@ impressive. Overall, stupidly simple. Requires jQuery 1.7 or newer.
 
 [View the demo here][0]
 
-See the example.html document to see how to implement it.
+See the examples directory.
+
+Installation via Bower
+----------------------
+
+    $ bower install jquery-stupid-table
 
 
 Example Usage
diff --git a/bower.json b/bower.json
index c2b5161..cd99d03 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "jquery-stupid-table",
-  "version": "1.0.1",
+  "version": "1.0.2",
   "homepage": "https://github.com/joequery/Stupid-Table-Plugin",
   "authors": [
     "Joseph McCullough"
diff --git a/examples/basic.html b/examples/basic.html
index 11e4341..4cf7f97 100644
--- a/examples/basic.html
+++ b/examples/basic.html
@@ -2,7 +2,7 @@
 <html>
 <head>
   <title>Stupid jQuery table sort</title>
-  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
   <script src="../stupidtable.js?dev"></script>
   <script>
     $(function(){
diff --git a/examples/colspan.html b/examples/colspan.html
index 148d9e4..e2cf10d 100644
--- a/examples/colspan.html
+++ b/examples/colspan.html
@@ -2,7 +2,7 @@
 <html>
 <head>
   <title>Stupid jQuery table sort (colspan test)</title>
-  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
   <script src="../stupidtable.js?dev"></script>
   <script>
     $(function(){
diff --git a/examples/complex.html b/examples/complex.html
index 75e4ee3..7496e86 100644
--- a/examples/complex.html
+++ b/examples/complex.html
@@ -2,7 +2,7 @@
 <html>
 <head>
   <title>Stupid jQuery table sort (complex example)</title>
-  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
   <script src="../stupidtable.js?dev"></script>
   <script>
     $(function(){
diff --git a/examples/large-table.html b/examples/large-table.html
index 926100c..798318b 100644
--- a/examples/large-table.html
+++ b/examples/large-table.html
@@ -2,7 +2,7 @@
 <html>
 <head>
   <title>Stupid jQuery table sort (large table example)</title>
-  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
   <script src="../stupidtable.js?dev"></script>
   <script>
     $(function(){
diff --git a/stupidtable.js b/stupidtable.js
index 851ba4c..7821a37 100644
--- a/stupidtable.js
+++ b/stupidtable.js
@@ -45,6 +45,12 @@
            sort_dir = $this_th.data("sort-dir") === dir.ASC ? dir.DESC : dir.ASC;
     }
 
+    // Bail if already sorted in this direction
+    if ($this_th.data("sort-dir") === sort_dir) {
+      return;
+    }
+    // Go ahead and set sort-dir.  If immediately subsequent calls have same sort-dir they will bail
+    $this_th.data("sort-dir", sort_dir);
 
     $table.trigger("beforetablesort", {column: th_index, direction: sort_dir});
 
diff --git a/tests/tests.js b/tests/tests.js
index b1446df..3084e14 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -595,4 +595,32 @@ asyncTest("Basic individual column sort - force direction", function(){
     });
 });
 
+asyncTest("No events fired if column sort - force direction doesn't change", function() {
+        var FLOAT_COLUMN = 1;
+    var $table = $("#complex");
+    var $table_cols = $table.find("th");
+
+    // Specify a sorting direction
+    $table_cols.eq(FLOAT_COLUMN).data('sort-default', 'desc');
+    $table.stupidtable();
+
+    var beforeCalls = 0;
+    $table.bind('beforetablesort', function(){
+        beforeCalls++;
+    });
+    var afterCalls = 0;
+    $table.bind('aftertablesort', function(){
+        afterCalls++;
+    });
+
+    $table_cols.eq(FLOAT_COLUMN).stupidsort('asc');
+    $table_cols.eq(FLOAT_COLUMN).stupidsort('asc');
+    $table_cols.eq(FLOAT_COLUMN).stupidsort('asc');
+
+    test_table_state(function(){
+        ok(_.isEqual(beforeCalls, 1));
+        ok(_.isEqual(afterCalls, 1));
+    });
+});
+
 }); //jQuery

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/libjs-jquery-stupidtable.git



More information about the Pkg-javascript-commits mailing list