Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F86A106FF for ; Tue, 1 Apr 2014 09:16:03 +0000 (UTC) Received: (qmail 72814 invoked by uid 500); 1 Apr 2014 09:14:51 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 72369 invoked by uid 500); 1 Apr 2014 09:14:36 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 71756 invoked by uid 99); 1 Apr 2014 09:14:20 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 09:14:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D631591B382; Tue, 1 Apr 2014 09:14:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Date: Tue, 01 Apr 2014 09:14:35 -0000 Message-Id: <1eea81ba10fd40629bf643d08cf82ae5@git.apache.org> In-Reply-To: <9743a3d508544bf2a0aaca36a1819b74@git.apache.org> References: <9743a3d508544bf2a0aaca36a1819b74@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/50] [abbrv] fauxton commit: updated refs/heads/import-master to b32c617 Fauxton: add tests for config Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/4266f84f Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/4266f84f Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/4266f84f Branch: refs/heads/import-master Commit: 4266f84f9e2d321c7f4c9153ada0268fec642d8f Parents: d7062db Author: Robert Kowalski Authored: Tue Mar 11 19:48:57 2014 +0100 Committer: suelockwood Committed: Thu Mar 13 10:43:23 2014 -0400 ---------------------------------------------------------------------- app/addons/config/tests/resourcesSpec.js | 57 +++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/4266f84f/app/addons/config/tests/resourcesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/config/tests/resourcesSpec.js b/app/addons/config/tests/resourcesSpec.js new file mode 100644 index 0000000..98f6569 --- /dev/null +++ b/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); + }); + }); + }); +});