-
Notifications
You must be signed in to change notification settings - Fork 19
Update Tagging #41
Update Tagging #41
Conversation
TagSelector.propTypes = { | ||
tagCategories: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
id: PropTypes.number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isRequired
}).isRequired | ||
).isRequired, | ||
selectedOption: PropTypes.shape({ | ||
id: PropTypes.number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^
}; | ||
|
||
TagSelector.defaultProps = { | ||
infoText: 'Only a single value can be assigned from these categories', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings can be __('....')
import { __ } from '../../globalFunctions'
tagCategory: this.props.selectedTagCategory, | ||
tagValue: selectedTagValue | ||
}; | ||
if (this.findSelectedCat(this.props.selectedTagCategory).singleValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo? maybe findSelectedTag
? instead of cat
this.findSelectedCat(this.props.selectedTagCategory).values) || | ||
[]; | ||
|
||
findSelectedCat = (selectedTagCategory = { id: undefined }) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag
not cat
onTagCategoryChange={onTagCategoryChange} | ||
tagCategories={tagCategories} | ||
/>); | ||
const component = renderer.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to enyzme, reactRenderer will be removed in future. Examples in #39
src/tagging/tests/tagging.test.js
Outdated
} | ||
]; | ||
|
||
function onChange(x) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use jest.fn()
for mock functions
|
||
TagView.defaultProps = { | ||
header: 'Assigned tags' | ||
header: 'Assigned tags', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n
This pull request is not mergeable. Please rebase and repush. |
da62e8d
to
100b648
Compare
7af0aea
to
8f8e58f
Compare
Seems OK |
e27a107
to
4762d1a
Compare
Checked commits PanSpagetka/react-ui-components@888c3c7~...4762d1a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
expect(onTagCategoryChange.mock.calls).toHaveLength(1); | ||
wrapper.instance().onTagValueChange('wawa'); | ||
expect(onTagCategoryChange.mock.calls.length).toEqual(1); | ||
expect(onTagCategoryChange.mock.calls).toHaveLength(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PanSpagetka Are you testing that onTagCategoryChange
does not get called when you call onTagValueChange
?
Or is this a copypaste bug and the other 2 functions should also have 1 call?
(3 expects testing the same method vs 3 different method calls)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such PR necromancy :D I don't really remember, but I think that it is testing that each function was called once. I am sorry, but I don't understand where is the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're calling each of the 3 functions...
and then testing the first one was called only once, and testing it 3 times ;)
Update Tagging according to patternfly/patternfly-react#351
Update reducers, tests, stories to be consistent with these changes.
Because it looks PF PR may not be merged soon, introduce back css files.