From 2cee37809faab59950300b68f878ba0e8ec42f13 Mon Sep 17 00:00:00 2001 From: Sajini Ariyawansa Date: Thu, 8 Dec 2016 09:17:01 +1100 Subject: [PATCH] Update: treepicker simple pure option to hide the svg icon --- src/components/Main.jsx | 4 +++- src/components/adslotUi/TreePickerGridComponent.jsx | 4 ++++ .../adslotUi/TreePickerSimplePureComponent.jsx | 3 +++ .../adslotUi/TreePickerSimplePureComponentTest.jsx | 10 ++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/Main.jsx b/src/components/Main.jsx index 58c02f45f..a8c948451 100644 --- a/src/components/Main.jsx +++ b/src/components/Main.jsx @@ -455,9 +455,11 @@ class AppComponent extends React.Component { Start by searching for items} + emptySelectedListText={
Choose items of interest
} + initialStateNode={
Start by searching for items
} searchValue={this.state.searchValue} searchOnChange={this.setSearchValue} searchOnClear={this.searchOnClear} diff --git a/src/components/adslotUi/TreePickerGridComponent.jsx b/src/components/adslotUi/TreePickerGridComponent.jsx index 97e2842fb..bb2b9da39 100644 --- a/src/components/adslotUi/TreePickerGridComponent.jsx +++ b/src/components/adslotUi/TreePickerGridComponent.jsx @@ -11,6 +11,7 @@ const TreePickerGridComponent = ({ disabled, emptySvgSymbol, expandNode, + hideIcon, includeNode, itemType, nodes, @@ -40,6 +41,7 @@ const TreePickerGridComponent = ({ {nodes ? : @@ -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), @@ -65,6 +68,7 @@ TreePickerGridComponent.propTypes = { TreePickerGridComponent.defaultProps = { disabled: false, + hideIcon: false, }; export default TreePickerGridComponent; diff --git a/src/components/adslotUi/TreePickerSimplePureComponent.jsx b/src/components/adslotUi/TreePickerSimplePureComponent.jsx index be841bfc6..0a2a05873 100644 --- a/src/components/adslotUi/TreePickerSimplePureComponent.jsx +++ b/src/components/adslotUi/TreePickerSimplePureComponent.jsx @@ -20,6 +20,7 @@ const TreePickerSimplePureComponent = ({ emptyText, emptySelectedListText, expandNode, + hideIcon, includeNode, initialStateNode, initialStateSymbol, @@ -82,6 +83,7 @@ const TreePickerSimplePureComponent = ({ disabled, emptySvgSymbol: emptySelectedListSvgSymbol || emptySvgSymbol, emptyText: emptySelectedListText || 'Nothing selected.', + hideIcon, itemType, nodes: selectedNodes, nodeRenderer, @@ -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), diff --git a/test/components/adslotUi/TreePickerSimplePureComponentTest.jsx b/test/components/adslotUi/TreePickerSimplePureComponentTest.jsx index dc77ad247..ab381375e 100644 --- a/test/components/adslotUi/TreePickerSimplePureComponentTest.jsx +++ b/test/components/adslotUi/TreePickerSimplePureComponentTest.jsx @@ -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(); + expect(component.find(TreePickerGrid).last().prop('Select...')); + }); });