Skip to content

Commit

Permalink
Update: treepicker simple pure option to hide the svg icon
Browse files Browse the repository at this point in the history
  • Loading branch information
pphminions committed Dec 7, 2016
1 parent 5d6d7e7 commit 2cee378
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,11 @@ class AppComponent extends React.Component {

<TreePickerSimplePure
itemType={this.state.itemType}
hideIcon
selectedNodes={[]}
subtree={this.state.treePickerPureSubtree}
initialStateNode={<div><h><b>Start by searching for items</b></h></div>}
emptySelectedListText={<div><b>Choose items of interest</b></div>}
initialStateNode={<div><b>Start by searching for items</b></div>}
searchValue={this.state.searchValue}
searchOnChange={this.setSearchValue}
searchOnClear={this.searchOnClear}
Expand Down
4 changes: 4 additions & 0 deletions src/components/adslotUi/TreePickerGridComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const TreePickerGridComponent = ({
disabled,
emptySvgSymbol,
expandNode,
hideIcon,
includeNode,
itemType,
nodes,
Expand Down Expand Up @@ -40,6 +41,7 @@ const TreePickerGridComponent = ({
{nodes ?
<Empty
collection={nodes}
hideIcon={hideIcon}
svgSymbol={emptySvgSymbol}
text={emptyText}
/> :
Expand All @@ -54,6 +56,7 @@ TreePickerGridComponent.propTypes = {
emptySvgSymbol: PropTypes.shape(SvgSymbol.propTypes),
emptyText: PropTypes.any.isRequired,
expandNode: PropTypes.func,
hideIcon: PropTypes.bool,
includeNode: PropTypes.func,
itemType: PropTypes.string.isRequired,
nodes: PropTypes.arrayOf(TreePickerPropTypes.node),
Expand All @@ -65,6 +68,7 @@ TreePickerGridComponent.propTypes = {

TreePickerGridComponent.defaultProps = {
disabled: false,
hideIcon: false,
};

export default TreePickerGridComponent;
3 changes: 3 additions & 0 deletions src/components/adslotUi/TreePickerSimplePureComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const TreePickerSimplePureComponent = ({
emptyText,
emptySelectedListText,
expandNode,
hideIcon,
includeNode,
initialStateNode,
initialStateSymbol,
Expand Down Expand Up @@ -82,6 +83,7 @@ const TreePickerSimplePureComponent = ({
disabled,
emptySvgSymbol: emptySelectedListSvgSymbol || emptySvgSymbol,
emptyText: emptySelectedListText || 'Nothing selected.',
hideIcon,
itemType,
nodes: selectedNodes,
nodeRenderer,
Expand All @@ -108,6 +110,7 @@ TreePickerSimplePureComponent.propTypes = {
emptyText: PropTypes.any,
emptySelectedListText: PropTypes.any,
expandNode: PropTypes.func,
hideIcon: PropTypes.bool,
includeNode: PropTypes.func,
initialStateNode: PropTypes.any,
initialStateSymbol: PropTypes.shape(SvgSymbol.propTypes),
Expand Down
10 changes: 10 additions & 0 deletions test/components/adslotUi/TreePickerSimplePureComponentTest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,14 @@ describe('TreePickerSimplePureComponent', () => {
expect(component.find(TreePickerGrid).first().prop('No items to select.'));
expect(component.find(TreePickerGrid).last().prop('Nothing to show'));
});

it('should render with given empty selected state node', () => {
const loaderStateProps = _.assign({}, props, {
initialSelectedStateNode: 'Select...',
selectedNodes: [],
});

const component = shallow(<TreePickerSimplePure {...loaderStateProps} />);
expect(component.find(TreePickerGrid).last().prop('Select...'));
});
});

0 comments on commit 2cee378

Please sign in to comment.