diff options
author | Robert Kowalski <rok@kowalski.gd> | 2014-03-17 18:20:44 +0100 |
---|---|---|
committer | Robert Kowalski <rok@kowalski.gd> | 2014-03-17 18:20:44 +0100 |
commit | 6f23ad403d8669abedc5f090284450793b2a77e5 (patch) | |
tree | eec77b47f6d1772f25912d920ba22c40761856b0 | |
parent | 304c144606594d16b74bfac9e6d9c61fdfbc4264 (diff) | |
download | couchdb-6f23ad403d8669abedc5f090284450793b2a77e5.tar.gz |
Fauxton: fix navigating back to previous page
Fixes #COUCHDB-2169
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/fauxton/app/addons/auth/base.js | 2 | ||||
-rw-r--r-- | src/fauxton/app/addons/auth/test/baseSpec.js | 34 |
3 files changed, 36 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index f610a3160..e1007f962 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 \ diff --git a/src/fauxton/app/addons/auth/base.js b/src/fauxton/app/addons/auth/base.js index 7f69a7f66..3354f5398 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); 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 000000000..1525306d9 --- /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); + }); + }); + }); +}); |