couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject [03/50] [abbrv] couchdb commit: updated refs/heads/1.6.x to d2ac597
Date Tue, 01 Apr 2014 17:41:45 GMT
Fauxton: fix navigating back to previous page

Fixes #COUCHDB-2169


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6f23ad40
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6f23ad40
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6f23ad40

Branch: refs/heads/1.6.x
Commit: 6f23ad403d8669abedc5f090284450793b2a77e5
Parents: 304c144
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Mon Mar 17 18:20:44 2014 +0100
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Mon Mar 17 18:20:44 2014 +0100

----------------------------------------------------------------------
 src/Makefile.am                              |  1 +
 src/fauxton/app/addons/auth/base.js          |  2 +-
 src/fauxton/app/addons/auth/test/baseSpec.js | 34 +++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/6f23ad40/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index f610a31..e1007f9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,6 +59,7 @@ FAUXTON_FILES = \
     fauxton/app/addons/auth/templates/nav_dropdown.html \
     fauxton/app/addons/auth/templates/nav_link_title.html \
     fauxton/app/addons/auth/templates/noAccess.html \
+    fauxton/app/addons/auth/test/baseSpec.js \
     fauxton/app/addons/compaction/assets/less/compaction.less \
     fauxton/app/addons/compaction/templates/compact_view.html \
     fauxton/app/addons/compaction/templates/layout.html \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/6f23ad40/src/fauxton/app/addons/auth/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/base.js b/src/fauxton/app/addons/auth/base.js
index 7f69a7f..3354f53 100644
--- a/src/fauxton/app/addons/auth/base.js
+++ b/src/fauxton/app/addons/auth/base.js
@@ -50,7 +50,7 @@ function(app, FauxtonAPI, Auth) {
     };
 
     var authDenied = function () {
-      FauxtonAPI.navigate('/noAccess');
+      FauxtonAPI.navigate('/noAccess', {replace: true});
     };
 
     FauxtonAPI.auth.registerAuth(auth);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/6f23ad40/src/fauxton/app/addons/auth/test/baseSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/auth/test/baseSpec.js b/src/fauxton/app/addons/auth/test/baseSpec.js
new file mode 100644
index 0000000..1525306
--- /dev/null
+++ b/src/fauxton/app/addons/auth/test/baseSpec.js
@@ -0,0 +1,34 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+define([
+      'api',
+      'addons/auth/base',
+      'core/auth',
+      'testUtils'
+], function (FauxtonAPI, Base, Auth, testUtils) {
+  var assert = testUtils.assert,
+      ViewSandbox = testUtils.ViewSandbox;
+
+  describe("Auth: Login", function () {
+
+    describe("failed login", function () {
+
+      it("redirects with replace: true set", function () {
+        var navigateSpy = sinon.spy(FauxtonAPI, 'navigate');
+        FauxtonAPI.auth = new Auth();
+        Base.initialize();
+        FauxtonAPI.auth.authDeniedCb();
+        assert.ok(navigateSpy.withArgs('/noAccess', {replace: true}).calledOnce);
+      });
+    });
+  });
+});


Mime
View raw message