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/13 15:43:33 UTC
[2/3] couchdb commit: updated refs/heads/master to e671933
Fauxton: add tests for config
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/f3ca9602
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/f3ca9602
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/f3ca9602
Branch: refs/heads/master
Commit: f3ca96026a8da409756e30c8cf8efd05968feeab
Parents: a07924d
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Tue Mar 11 19:48:57 2014 +0100
Committer: suelockwood <de...@apache.org>
Committed: Thu Mar 13 10:43:23 2014 -0400
----------------------------------------------------------------------
src/Makefile.am | 1 +
.../app/addons/config/tests/resourcesSpec.js | 57 ++++++++++++++++++++
2 files changed, 58 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/f3ca9602/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 59aa6bf..a213baa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,6 +71,7 @@ FAUXTON_FILES = \
fauxton/app/addons/config/routes.js \
fauxton/app/addons/config/templates/dashboard.html \
fauxton/app/addons/config/templates/item.html \
+ fauxton/app/addons/config/tests/resourcesSpec.js \
fauxton/app/addons/contribute/base.js \
fauxton/app/addons/exampleAuth/base.js \
fauxton/app/addons/exampleAuth/templates/noAccess.html \
http://git-wip-us.apache.org/repos/asf/couchdb/blob/f3ca9602/src/fauxton/app/addons/config/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/tests/resourcesSpec.js b/src/fauxton/app/addons/config/tests/resourcesSpec.js
new file mode 100644
index 0000000..98f6569
--- /dev/null
+++ b/src/fauxton/app/addons/config/tests/resourcesSpec.js
@@ -0,0 +1,57 @@
+// 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/config/resources',
+ 'testUtils'
+], function (FauxtonAPI, Resources, testUtils) {
+ var assert = testUtils.assert,
+ ViewSandbox = testUtils.ViewSandbox;
+
+ describe("ViewItem", function () {
+ var tabMenu, optionModel;
+
+ beforeEach(function () {
+ optionModel = new Resources.OptionModel({
+ section: "foo",
+ name: "bar"
+ });
+
+ tabMenu = new Resources.ViewItem({
+ model: optionModel
+ });
+ });
+
+ describe("editing Items", function () {
+ var viewSandbox;
+ beforeEach(function () {
+ viewSandbox = new ViewSandbox();
+ viewSandbox.renderView(tabMenu);
+ });
+
+ afterEach(function () {
+ viewSandbox.remove();
+ });
+
+ it("click on save should save the model and render", function () {
+ var renderSpy = sinon.stub(tabMenu, 'render');
+ var saveSpy = sinon.stub(optionModel, 'save');
+
+ tabMenu.$('.js-edit-value').trigger('dblclick');
+ tabMenu.$('.js-save-value').trigger('click');
+
+ assert.ok(renderSpy.calledOnce);
+ assert.ok(saveSpy.calledOnce);
+ });
+ });
+ });
+});