Skip to content
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
6 changes: 6 additions & 0 deletions src/enhancers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as outline from './outline'
import * as overflow from './overflow'
import * as position from './position'
import * as resize from './resize'
import * as selectors from './selectors'
import * as spacing from './spacing'
import * as text from './text'
import * as transform from './transform'
Expand All @@ -37,6 +38,7 @@ export {
overflow,
position,
resize,
selectors,
spacing,
text,
transform,
Expand All @@ -60,6 +62,7 @@ export const propTypes: PropTypesMapping = {
...overflow.propTypes,
...position.propTypes,
...resize.propTypes,
...selectors.propTypes,
...spacing.propTypes,
...text.propTypes,
...transform.propTypes,
Expand All @@ -85,6 +88,7 @@ export const propAliases: PropAliases = {
...overflow.propAliases,
...position.propAliases,
...resize.propAliases,
...selectors.propAliases,
...spacing.propAliases,
...text.propAliases,
...transform.propAliases,
Expand All @@ -108,6 +112,7 @@ export const propValidators: PropValidators = {
...overflow.propValidators,
...position.propValidators,
...resize.propValidators,
...selectors.propValidators,
...spacing.propValidators,
...text.propValidators,
...transform.propValidators,
Expand All @@ -131,6 +136,7 @@ export const propEnhancers: PropEnhancers = {
...overflow.propEnhancers,
...position.propEnhancers,
...resize.propEnhancers,
...selectors.propEnhancers,
...spacing.propEnhancers,
...text.propEnhancers,
...transform.propEnhancers,
Expand Down
12 changes: 12 additions & 0 deletions src/enhancers/selectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import PropTypes from 'prop-types'
import { PropValidators, PropEnhancers, PropTypesMapping, PropAliases } from '../types/enhancers'

export const propTypes: PropTypesMapping = {
selectors: PropTypes.object
}

export const propAliases: PropAliases = {}

export const propValidators: PropValidators = {}

export const propEnhancers: PropEnhancers = {}
25 changes: 25 additions & 0 deletions test/utils/split-box-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test('splits box props', t => {
disabled: true
}
t.deepEqual(splitBoxProps(props), {
/* @ts-ignore We are only passing and expecting a partial object back */
matchedProps: {
background: 'red'
},
Expand All @@ -15,3 +16,27 @@ test('splits box props', t => {
}
})
})

test('includes selectors in matchedProps', t => {
const props = {
selectors: {
'&:hover': {
backgroundColor: 'red'
}
}
}

const result = splitBoxProps(props)

t.deepEqual(result, {
/* @ts-ignore We are only passing and expecting a partial object back */
matchedProps: {
selectors: {
'&:hover': {
backgroundColor: 'red'
}
}
},
remainingProps: {}
})
})