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 639CC10442 for ; Wed, 17 Jul 2013 16:12:35 +0000 (UTC) Received: (qmail 8527 invoked by uid 500); 17 Jul 2013 16:12:33 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 8453 invoked by uid 500); 17 Jul 2013 16:12:33 -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 8256 invoked by uid 99); 17 Jul 2013 16:12:28 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 16:12:28 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F36378AC1A0; Wed, 17 Jul 2013 16:12:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: garren@apache.org To: commits@couchdb.apache.org Date: Wed, 17 Jul 2013 16:12:33 -0000 Message-Id: In-Reply-To: <689ce410a8d544d58c8fddbe65c8ffa3@git.apache.org> References: <689ce410a8d544d58c8fddbe65c8ffa3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [7/7] git commit: updated refs/heads/fauxton-test-framework to 251a7ef add some tests for Routeobject Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/251a7eff Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/251a7eff Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/251a7eff Branch: refs/heads/fauxton-test-framework Commit: 251a7eff7fa61a1181fc5d7139922822ff19c95a Parents: 3021090 Author: Garren Smith Authored: Wed Jul 17 18:11:43 2013 +0200 Committer: Garren Smith Committed: Wed Jul 17 18:11:43 2013 +0200 ---------------------------------------------------------------------- src/fauxton/Gruntfile.js | 6 +-- src/fauxton/test/core/routeObjectSpec.js | 68 +++++++++++++++++++++++++++ src/fauxton/test/test.config.js | 2 + 3 files changed, 73 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/251a7eff/src/fauxton/Gruntfile.js ---------------------------------------------------------------------- diff --git a/src/fauxton/Gruntfile.js b/src/fauxton/Gruntfile.js index 474030f..3992d91 100644 --- a/src/fauxton/Gruntfile.js +++ b/src/fauxton/Gruntfile.js @@ -119,7 +119,7 @@ module.exports = function(grunt) { // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md lint: { files: [ - "build/config.js", "app/**/*.js" + "build/config.js", "app/**/*.js" ] }, @@ -136,7 +136,7 @@ module.exports = function(grunt) { // override inside main.js needs to test for them so as to not accidentally // route. jshint: { - all: ['app/**/*.js', 'Gruntfile.js'], + all: ['app/**/*.js', 'Gruntfile.js', "test/core/*.js"], options: { scripturl: true, evil: true @@ -302,7 +302,7 @@ module.exports = function(grunt) { mochaSetup: { default: { - files: { src: helper.watchFiles(['[Ss]pec.js'], ['./app/**/*[Ss]pec.js'])}, + files: { src: helper.watchFiles(['[Ss]pec.js'], ['./test/core/**/*[Ss]pec.js', './app/**/*[Ss]pec.js'])}, template: 'test/test.config.underscore', config: './app/config.js' } http://git-wip-us.apache.org/repos/asf/couchdb/blob/251a7eff/src/fauxton/test/core/routeObjectSpec.js ---------------------------------------------------------------------- diff --git a/src/fauxton/test/core/routeObjectSpec.js b/src/fauxton/test/core/routeObjectSpec.js new file mode 100644 index 0000000..7fdb719 --- /dev/null +++ b/src/fauxton/test/core/routeObjectSpec.js @@ -0,0 +1,68 @@ +define([ + 'api', + 'chai' +], function (FauxtonAPI, chai) { + var assert = chai.assert, + RouteObject = FauxtonAPI.RouteObject; + + describe('RouteObjects', function () { + + describe('renderWith', function () { + var TestRouteObject, testRouteObject, mockLayout; + + beforeEach(function () { + TestRouteObject = RouteObject.extend({ + crumbs: ['mycrumbs'] + }); + + testRouteObject = new TestRouteObject(); + + mockLayout = { + called: false, + clearBreadcumbsCalled: false, + setBreadcumbsCalled: false, + setTemplate: function (layout) { + this.called = true; + }, + + clearBreadcrumbs: function () { + this.clearBreadcumbsCalled = true; + + }, + + setBreadcrumbs: function () { + this.setBreadcumbsCalled = true; + } + }; + }); + + it('Should set template for first render ', function () { + testRouteObject.renderWith('the-route', mockLayout, 'args'); + + assert.ok(mockLayout.called, 'setTempalte was called'); + }); + + it('Should not set template after first render', function () { + testRouteObject.renderWith('the-route', mockLayout, 'args'); + + mockLayout.called = false; + testRouteObject.renderWith('the-route', mockLayout, 'args'); + + assert.notOk(mockLayout.called, 'SetTemplate not meant to be called'); + }); + + it('Should clear breadcrumbs', function () { + testRouteObject.renderWith('the-route', mockLayout, 'args'); + assert.ok(mockLayout.clearBreadcumbsCalled, 'Clear Breadcrumbs called'); + }); + + it('Should set breadcrumbs', function () { + testRouteObject.renderWith('the-route', mockLayout, 'args'); + assert.ok(mockLayout.setBreadcumbsCalled, 'Set Breadcrumbs was called'); + }); + }); + + }); + + +}); http://git-wip-us.apache.org/repos/asf/couchdb/blob/251a7eff/src/fauxton/test/test.config.js ---------------------------------------------------------------------- diff --git a/src/fauxton/test/test.config.js b/src/fauxton/test/test.config.js index 7e6e487..54f976e 100644 --- a/src/fauxton/test/test.config.js +++ b/src/fauxton/test/test.config.js @@ -58,6 +58,8 @@ require.config( require([ + '.././test/core/routeObjectSpec.js', + '.././app/addons/logs/tests/logSpec.js', ], function() {