diff options
author | Robert Kowalski <rok@kowalski.gd> | 2014-03-11 19:48:57 +0100 |
---|---|---|
committer | suelockwood <deathbear@apache.org> | 2014-03-13 10:43:23 -0400 |
commit | f3ca96026a8da409756e30c8cf8efd05968feeab (patch) | |
tree | 97aa4258b9822dbf8309a488fb24d525ce0fd6c2 | |
parent | a07924df35f9bc9c555f2a49b1b84d174896e5b1 (diff) | |
download | couchdb-f3ca96026a8da409756e30c8cf8efd05968feeab.tar.gz |
Fauxton: add tests for config
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/fauxton/app/addons/config/tests/resourcesSpec.js | 57 |
2 files changed, 58 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 59aa6bfb9..a213baa75 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 \ 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 000000000..98f65691a --- /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); + }); + }); + }); +}); |