From cca8ddb5d583825b65841b058155001f372921a0 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 6 Nov 2017 14:39:21 -0800 Subject: [PATCH 1/9] Add nyc coverage reporting --- .gitignore | 1 + package.json | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 8c713860..48fbe5ff 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules .idea .deps_check .DS_Store +.nyc_output npm-debug.log* .eslintcache package-lock.json diff --git a/package.json b/package.json index b406256c..396f219c 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "test-in-node": "npm run lint-errors && npm run just-test-in-node", "just-test": "karma start --config karma.conf.js", "just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package test/xss", + "just-check-coverage": "nyc npm run just-test-in-node", "test-e2e": "sleep 3 && nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch.json", "e2e-initial-render": "nightwatch test/e2e/scenarios/ --config test/e2e/nightwatch.json --group initial-render", "mock-api": "json-server --watch test/e2e/db.json --port 3204", @@ -152,5 +153,9 @@ ], "optionalDependencies": { "webpack-dev-server": "2.5.0" + }, + "nyc": { + "all": true, + "include": ["**/src/core/plugins/**.js"] } } From 21bf5919a91041f48825c309e6a491e18c38b1c7 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 6 Nov 2017 20:42:47 -0800 Subject: [PATCH 2/9] Rewire AuthorizeOperationBtn; create new selector for filtering definitions --- .../auth/authorize-operation-btn.jsx | 28 +++++++------------ src/core/components/operation.jsx | 11 ++++++-- src/core/plugins/auth/selectors.js | 7 +++++ 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/core/components/auth/authorize-operation-btn.jsx b/src/core/components/auth/authorize-operation-btn.jsx index 7c2f2448..760bac2a 100644 --- a/src/core/components/auth/authorize-operation-btn.jsx +++ b/src/core/components/auth/authorize-operation-btn.jsx @@ -1,25 +1,23 @@ import React from "react" import PropTypes from "prop-types" -import ImPropTypes from "react-immutable-proptypes" export default class AuthorizeOperationBtn extends React.Component { + static propTypes = { + isAuthorized: PropTypes.bool.isRequired, + onClick: PropTypes.func + } + onClick =(e) => { e.stopPropagation() + let { onClick } = this.props - let { security, authActions, authSelectors } = this.props - let definitions = authSelectors.getDefinitionsByNames(security) - - authActions.showDefinitions(definitions) + if(onClick) { + onClick() + } } render() { - let { security, authSelectors } = this.props - - let isAuthorized = authSelectors.isAuthorized(security) - - if(isAuthorized === null) { - return null - } + let { isAuthorized } = this.props return (