Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix theming, index and tests #1

Merged
merged 2 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"name": "adminit",
"main": "./dist/index.js",
"version": "0.2.0",
"version": "0.2.1",
"description": "Create Administration Interfaces from Swagger (OpenAPI) Specifications using React Material-UI.",
"author": "Diogo Dutra <dutradda@gmail.com>",
"license": "MIT",
"scripts": {
"build": "babel src --out-dir dist --ignore test.jsx,test.js",
"build:watch": "babel src --watch --out-dir dist --ignore test.jsx,test.js",
"test": "jest",
"test:ci": "jest --ci --coverage --collectCoverageFrom='src/**{js,jsx}' && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"test:cov": "jest --coverage --collectCoverageFrom='src/**{js,jsx}'"
"test:ci": "jest --ci && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"directories": [
"./dist"
Expand Down Expand Up @@ -39,6 +38,9 @@
"react-test-renderer": "^16.2.0"
},
"jest": {
"setupTestFrameworkScriptFile": "./node_modules/raf/polyfill"
"setupTestFrameworkScriptFile": "./node_modules/raf/polyfill",
"testURL": "http://localhost",
"collectCoverage": true,
"collectCoverageFrom": ["src/**{js,jsx}"]
}
}
3 changes: 2 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import createBrowserHistory from 'history/createBrowserHistory'
import PropTypes from 'prop-types'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import muiThemeable from 'material-ui/styles/muiThemeable'

export default class App extends React.Component {
static propTypes = {
Expand Down Expand Up @@ -78,7 +79,7 @@ export default class App extends React.Component {
<Route
exact={route.exact}
path={route.path}
component={route.component}
component={muiThemeable()(route.component)}
key={keyCounter}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion src/BaseHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class BaseHeader extends MuiComponent {
let alt = this.props.logoAlt ? this.props.logoAlt : this.props.title

return (
<Toolbar style={this.context.muiTheme.swaggeritHeader}>
<Toolbar style={this.props.muiTheme.palette.adminitHeader}>
<ToolbarGroup firstChild={true}>
<Link to="/" style={{paddingRight: '1em'}}>
<img src={this.props.logo} alt={alt} style={{marginLeft: '1em'}}/>
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/BaseHeader.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ function createValidComponent() {

test("renders default theme", () => {
let component = createValidComponent()
console.log(component.props())
// expect(component.find(<Toolbar/>)).toEqual({})
})
4 changes: 2 additions & 2 deletions src/__tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */

import {utils} from '..'
import { raiseNotImplementedError } from '../utils'

test("utils.raiseNotImplementedError throws error", () => {
function raiseError() {
class Test {
test() {}
}
let test = new Test()
utils.raiseNotImplementedError(test, test.test)
raiseNotImplementedError(test, test.test)
}

expect(raiseError).toThrowError('Test.test must be implemented!')
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

import App from './App'
import BaseHeader from './BaseHeader'
// import InputsContainer from './containers/InputsContainer'
// import HttpClient from './httpClient'
import InputsContainer from './containers/InputsContainer'
import HttpClient from './httpClient'
import utils from './utils'

export {
App,
BaseHeader,
// InputsContainer,
// HttpClient,
InputsContainer,
HttpClient,
utils
}
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ function raiseNotImplementedError(object, method) {
throw new Error(`${object.constructor.name}.${method.name} must be implemented!`)
}

export default {
export {
raiseNotImplementedError
}