Skip to content

Commit

Permalink
Update: Tree picker node component to support child nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
pphminions committed Nov 21, 2016
1 parent 09d9e7e commit 7fa3a61
Show file tree
Hide file tree
Showing 8 changed files with 8,298 additions and 9,165 deletions.
17,400 changes: 8,260 additions & 9,140 deletions dist/adslot-ui-main-ugly.js

Large diffs are not rendered by default.

38 changes: 17 additions & 21 deletions dist/adslot-ui-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/adslot-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class AppComponent extends React.Component {
treePickerPureSubtree: [],
selectedNodes: [
{ id: '2', label: 'Norfolk Island', path: [{ id: '11', label: 'AU' }], type: '', isSelectable: false },
{ id: '3', label: 'Queensland', path: [{ id: '12', label: 'AU' }], type: '' },
{ id: '3', label: 'Queensland', path: [{ id: '12', label: 'AU' }], type: '', isChildNode: true },
],
searchBarString: '',
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/adslotUi/TreePickerNodeComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const TreePickerNodeComponent = ({
const labelCellProps = expanderElement ? { onClick: expandNodeBound } : {};

return (
<div className={`${baseClass}`}>
<GridRow dts={`${_.kebabCase(itemType)}-${node.id}`}>
<div className={node.isChildNode ? `${baseClass} child-node` : `${baseClass}`}>
<GridRow dts={`${_.kebabCase(itemType)}-${node.id}`} >
{selected ?
<GridCell classSuffixes={['button']} dts="button-remove">
<Button
Expand Down
1 change: 1 addition & 0 deletions src/helpers/propTypes/TreePickerPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default {
).isRequired,
type: PropTypes.string.isRequired,
value: PropTypes.number,
isChildNode: PropTypes.bool,
}),
breadCrumbNode: PropTypes.shape({
id: PropTypes.string.isRequired,
Expand Down
7 changes: 7 additions & 0 deletions src/styles/adslotUi/TreePickerNode.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@
width: $button-size;
}
}

}

.child-node {
.grid-component-row {
padding-left: 30px;
}
}
9 changes: 9 additions & 0 deletions test/components/adslotUi/TreePickerNodeComponentTest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ describe('TreePickerNodeComponent', () => {
expect(valueCellElement).to.be.a('null');
});

it('should have the child node class for child nodes', () => {
const node = _.clone(cbrNode);
node.isChildNode = true;
const props = { itemType, node };
const component = shallow(<TreePickerNodeComponent {...props} />);

expect(component.prop('className')).to.equal('treepickernode-component child-node');
});

it('should fire expandNode when clicking on the `expand` cell', () => {
const nodes = [];
const expandNode = (node) => nodes.push(node);
Expand Down

0 comments on commit 7fa3a61

Please sign in to comment.