Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
feat(Selecting): Added selecting tests and logic for dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidurber committed Dec 24, 2017
1 parent a0e738d commit 1639249
Show file tree
Hide file tree
Showing 10 changed files with 20,261 additions and 37 deletions.
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["es2015", "react"]
}
"presets": ["es2015", "react"],
"plugins": ["transform-class-properties"]
}
11 changes: 9 additions & 2 deletions __fixtures__/Picky.fixture.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import Picky from '../src/Picky';

export default {
const PickyFixture = {
component: Picky,
props: {
value: [1, 2, 3],
disabled: false,
options: [1, 2, 3, 4, 5, 6],
onChange: value => {
console.log(`Select: ${value}`);
PickyFixture.value = value;
}
}
};
};

export default PickyFixture;
2 changes: 1 addition & 1 deletion examples/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015", "react"]
}
}
72 changes: 56 additions & 16 deletions examples/Example.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,63 @@
import React from 'react';

import MyComponent from '../src/index';
import Picky from '../src/index';

class Example extends React.Component {
constructor(props) {
super(props);
}
constructor(props) {
super(props);
this.state = {
value: 1,
arrayValue: [1]
};
this.selectOption = this.selectOption.bind(this);
this.selectMultipleOption = this.selectMultipleOption.bind(this);
}
componentWillMount() {}

componentDidMount() {
console.log('test');
}

render() {
return (
<div>
<MyComponent />
</div>
)
}
selectOption(value) {
console.log('Val', value);
this.setState({ value });
}
selectMultipleOption(value) {
console.log('Val', value);
this.setState({ arrayValue: value });
}
render() {
return (
<div>
<div>
<div style={{ width: '50%', float: 'left' }}>
<Picky
value={this.state.value}
options={[1, 2, 3, 4]}
onChange={this.selectOption}
/>
</div>
<div style={{ width: '50%', float: 'left' }}>
<Picky
value={this.state.arrayValue}
options={[1, 2, 3, 4]}
onChange={this.selectMultipleOption}
multiple
/>
</div>
</div>
<br />
<div>
<div style={{ width: '50%', float: 'left' }}>
<Picky
value={this.state.arrayValue}
options={[1, 2, 3, 4]}
onChange={this.selectMultipleOption}
open={false}
multiple={true}
includeSelectAll={true}
/>
</div>
</div>
</div>
);
}
}

export default Example;
export default Example;
Loading

0 comments on commit 1639249

Please sign in to comment.