Skip to content

Commit

Permalink
Update doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcarbs committed Dec 5, 2016
1 parent 2c620c4 commit 9f50d8e
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/collections/Breadcrumb/BreadcrumbSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class BreadcrumbSection extends Component {
]),

/**
* Called on click. When passed, the component render as an `a`
* Called on click. When passed, the component will render as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default class Form extends Component {
loading: PropTypes.bool,

/**
* Called with (event, jsonSerializedForm) on submit
* Called on submit
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and the form's serialized values.
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Menu/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class MenuItem extends Component {
name: PropTypes.string,

/**
* Called on click. When passed, the component render as an `a`
* Called on click. When passed, the component will render as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Label/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ export default class Label extends Component {
]),

/**
* Adds the link style when present, called with (event, props).
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: PropTypes.func,

/**
* Adds an "x" icon, called with (event, props) when "x" is clicked.
* Adds an "x" icon, called when "x" is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Step/Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Step extends Component {
href: PropTypes.string,

/**
* Called on click. When passed, the component render as an `a`
* Called on click. When passed, the component will render as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Dimmer/Dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class Dimmer extends Component {
disabled: PropTypes.bool,

/**
* Called with (event, props) after user's click.
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
Expand Down
22 changes: 11 additions & 11 deletions src/modules/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ export default class Dropdown extends Component {
noResultsMessage: PropTypes.string,

/**
* Called with the name and new value added by the user. Use this to update the options list.
* Called when a user adds a new item. Use this to update the options list.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All item props.
* @param {object} data - All props and the new item's value.
*/
onAddItem: PropTypes.func,

Expand Down Expand Up @@ -196,10 +196,10 @@ export default class Dropdown extends Component {
onOpen: PropTypes.func,

/**
* Called with the React Synthetic Event and current value on search input change.
* Called on search input change.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
* @param {string} value - Current value of search input.
*/
onSearchChange: PropTypes.func,

Expand Down Expand Up @@ -514,7 +514,7 @@ export default class Dropdown extends Component {

selectHighlightedItem = (e) => {
const { open } = this.state
const { multiple, name, onAddItem, options } = this.props
const { multiple, onAddItem, options } = this.props
const value = _.get(this.getSelectedItem(), 'value')

// prevent selecting null if there was no selected item value
Expand All @@ -523,7 +523,7 @@ export default class Dropdown extends Component {

// notify the onAddItem prop if this is a new value
if (onAddItem && !_.some(options, { text: value })) {
onAddItem(e, { name, value })
onAddItem(e, { ...this.props, value })
}

// notify the onChange prop that the user is trying to change value
Expand Down Expand Up @@ -608,11 +608,11 @@ export default class Dropdown extends Component {
this.toggle(e)
}

handleItemClick = (e, { value }) => {
handleItemClick = (e, item) => {
debug('handleItemClick()')
debug(value)
const { multiple, name, onAddItem, options } = this.props
const item = this.getItemByValue(value) || {}
debug(item)
const { multiple, onAddItem, options } = this.props
const { value } = item

// prevent toggle() in handleClick()
e.stopPropagation()
Expand All @@ -625,7 +625,7 @@ export default class Dropdown extends Component {

// notify the onAddItem prop if this is a new value
if (onAddItem && !_.some(options, { text: value })) {
onAddItem(e, { name, value })
onAddItem(e, { ...this.props, value })
}

// notify the onChange prop that the user is trying to change value
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Embed/Embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class Embed extends Component {
icon: customPropTypes.itemShorthand,

/**
* Сalled with event on Embed click with (event, props).
* Сalled on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed value.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Rating extends Component {
]),

/**
* Called with (event, { rating, maxRating }) after user selects a new rating.
* Called after user selects a new rating.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed rating.
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ export default class Search extends Component {
onResultSelect: PropTypes.func,

/**
* Called with the React Synthetic Event and current value on search input change.
* Called on search input change.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
* @param {string} value - Current value of search input.
*/
onSearchChange: PropTypes.func,

Expand Down
10 changes: 8 additions & 2 deletions test/specs/modules/Checkbox/Checkbox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ describe('Checkbox', () => {
.simulate('click')

spy.should.have.been.calledOnce()
spy.should.have.been.calledWithMatch({}, expectProps)
spy.should.have.been.calledWithMatch({}, {
...expectProps,
checked: !expectProps.checked,
})
})
it('is not called when the checkbox has the disabled prop set', () => {
const spy = sandbox.spy()
Expand All @@ -92,7 +95,10 @@ describe('Checkbox', () => {
.simulate('click')

spy.should.have.been.calledOnce()
spy.should.have.been.calledWithMatch({}, { ...expectProps, checked: true })
spy.should.have.been.calledWithMatch({}, {
...expectProps,
checked: expectProps.checked,
})
})
it('is not called when the checkbox has the disabled prop set', () => {
const spy = sandbox.spy()
Expand Down

0 comments on commit 9f50d8e

Please sign in to comment.