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/CONTRIBUTING.md b/CONTRIBUTING.md index 3acb80b0..3b6d0c15 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ We love contributions from our community of users! This document explains our gu #### Environment setup -0. Install Node.js (4 or newer) and npm (3 or newer). +0. Install Node.js (6 or newer) and npm (3 or newer). 1. Make a fork of Swagger-UI on GitHub, then clone your fork to your machine. 2. Run `npm install` in your Swagger-UI directory. 3. Run `npm run dev`. `localhost:3200` should open automatically. diff --git a/package.json b/package.json index b406256c..3987317b 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", @@ -60,13 +61,13 @@ "react-addons-perf": "^15.4.0", "react-addons-shallow-compare": "0.14.8", "react-addons-test-utils": "^15.6.2", - "react-collapse": "2.3.1", + "react-collapse": "^4.0.3", "react-dom": "^15.6.2", "react-height": "^2.0.0", "react-hot-loader": "1.3.1", "react-immutable-proptypes": "2.1.0", "react-markdown": "^2.5.0", - "react-motion": "0.4.4", + "react-motion": "^0.5.2", "react-object-inspector": "0.2.1", "react-redux": "^4.x.x", "react-split-pane": "0.1.57", @@ -127,6 +128,7 @@ "node-sass": "^4.5.0", "npm-run-all": "4.0.2", "null-loader": "0.1.1", + "nyc": "^11.3.0", "open": "0.0.5", "postcss-loader": "2.0.6", "raw-loader": "0.5.1", @@ -152,5 +154,11 @@ ], "optionalDependencies": { "webpack-dev-server": "2.5.0" + }, + "nyc": { + "all": true, + "include": [ + "**/src/core/plugins/**.js" + ] } } 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 (