Repository: couchdb-fauxton Updated Branches: refs/heads/master 1c6ffe915 -> 5149d5279
Small fix for Permissions page and tests The mocha tests were failing (correctly!) due to extra check to prevent adding blank entries. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/5149d527 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/5149d527 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/5149d527 Branch: refs/heads/master Commit: 5149d52794ac1a3df0263374f789cc39dc1580d2 Parents: 1c6ffe9 Author: Ben Keen <[email protected]> Authored: Wed May 20 09:23:11 2015 -0700 Committer: Ben Keen <[email protected]> Committed: Wed May 20 09:23:11 2015 -0700 ---------------------------------------------------------------------- app/addons/permissions/components.react.jsx | 3 +-- .../permissions/tests/componentsSpec.react.jsx | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5149d527/app/addons/permissions/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/permissions/components.react.jsx b/app/addons/permissions/components.react.jsx index 7b07a0f..97d704a 100644 --- a/app/addons/permissions/components.react.jsx +++ b/app/addons/permissions/components.react.jsx @@ -65,7 +65,6 @@ function (app, FauxtonAPI, React, Components, Stores, Actions) { if (!_.isEmpty(value)) { return false; } - FauxtonAPI.addNotification({ msg: 'Cannot add an empty value for ' + type + '.', type: 'warning' @@ -76,7 +75,7 @@ function (app, FauxtonAPI, React, Components, Stores, Actions) { addNames: function (e) { e.preventDefault(); - if (this.isEmptyValue(this.state.newRole, 'names')) { + if (this.isEmptyValue(this.state.newName, 'names')) { return; } this.props.addItem({ http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5149d527/app/addons/permissions/tests/componentsSpec.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/permissions/tests/componentsSpec.react.jsx b/app/addons/permissions/tests/componentsSpec.react.jsx index acbb668..795f4cb 100644 --- a/app/addons/permissions/tests/componentsSpec.react.jsx +++ b/app/addons/permissions/tests/componentsSpec.react.jsx @@ -85,8 +85,14 @@ define([ }); it('adds user on submit', function () { - var dom = $(el.getDOMNode()).find('.permission-item-form')[0]; - TestUtils.Simulate.submit(dom); + var input = $(el.getDOMNode()).find('input')[0]; + TestUtils.Simulate.change(input, { + target: { + value: 'newusername' + } + }); + var form = $(el.getDOMNode()).find('.permission-item-form')[0]; + TestUtils.Simulate.submit(form); var options = addSpy.args[0][0]; assert.ok(addSpy.calledOnce); @@ -95,8 +101,14 @@ define([ }); it('adds role on submit', function () { - var dom = $(el.getDOMNode()).find('.permission-item-form')[1]; - TestUtils.Simulate.submit(dom); + var input = $(el.getDOMNode()).find('input')[1]; + TestUtils.Simulate.change(input, { + target: { + value: 'newrole' + } + }); + var form = $(el.getDOMNode()).find('.permission-item-form')[1]; + TestUtils.Simulate.submit(form); var options = addSpy.args[0][0]; assert.ok(addSpy.calledOnce);
