This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Selecting): Added selecting tests and logic for dropdown
- Loading branch information
Showing
10 changed files
with
20,261 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"presets": ["es2015", "react"] | ||
} | ||
"presets": ["es2015", "react"], | ||
"plugins": ["transform-class-properties"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "react"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.