Skip to content
Open
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
},
"dependencies": {
"babel-polyfill": "^6.1.18",
"classnames": "^2.1.3"
"classnames": "^2.1.3",
"prop-types": "^15.6.0"
},
"devDependencies": {
"babel-cli": "^6.1.18",
Expand Down
11 changes: 6 additions & 5 deletions src/pacomo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import classNames from 'classnames'
import { isValidElement, cloneElement, Children, PropTypes } from 'react'
import PropTypes from 'prop-types'
import { isValidElement, cloneElement, Children } from 'react'


export function prefixedClassNames(prefix, ...args) {
Expand Down Expand Up @@ -46,7 +47,7 @@ function transformElementProps(props, fn, childrenOnly) {
changes.children = transformedChildren
}
}

if (!childrenOnly) {
for (let key of Object.keys(props)) {
if (key == 'children') continue
Expand All @@ -65,7 +66,7 @@ function transformElementProps(props, fn, childrenOnly) {


function cloneElementWithSkip(element) {
return cloneElement(element, {'data-pacomoSkip': true})
return cloneElement(element, {'data-pacomoskip': true})
}


Expand All @@ -83,7 +84,7 @@ export function transformWithPrefix(prefix) {
//
// Optionally prefix with a `rootClass` and postfix with `suffixClass`.
function transform(element, rootClass, suffixClasses='') {
if (typeof element !== 'object' || element.props['data-pacomoSkip']) return element
if (typeof element !== 'object' || element.props['data-pacomoskip']) return element

const changes = transformElementProps(
element.props,
Expand Down Expand Up @@ -150,7 +151,7 @@ export function withPackageName(packageName) {
// Add `className` propType, if none exists
DecoratedComponent.propTypes = { className: PropTypes.string, ...componentClass.propTypes }

return DecoratedComponent
return DecoratedComponent
},
}
}
5 changes: 3 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'babel-polyfill'
import {prefixedClassNames, withPackageName, transformWithPrefix} from './lib/pacomo'
import React, {Component, PropTypes} from 'react'
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import TestUtils from 'react-addons-test-utils'
import assert from 'assert'

Expand All @@ -16,7 +17,7 @@ const { transformer, decorator } = withPackageName('prefix')
function shallowRenderElement(element) {
const shallowRenderer = TestUtils.createRenderer()
shallowRenderer.render(element)
return shallowRenderer.getRenderOutput()
return shallowRenderer.getRenderOutput()
}

function shallowRenderComponent(Component, props) {
Expand Down