You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2014/03/18 16:10:06 UTC

[11/12] couchdb commit: updated refs/heads/2129-config-edit-name to 673100c

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/2129-config-edit-name
Commit: 6f23ad403d8669abedc5f090284450793b2a77e5
Parents: 304c144
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Mon Mar 17 18:20:44 2014 +0100
Committer: Robert Kowalski <ro...@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);
+      });
+    });
+  });
+});