Skip to content

Commit

Permalink
Merge pull request #87 from sandersky/master
Browse files Browse the repository at this point in the history
Add support for placeholder on frost-select
  • Loading branch information
sandersky committed Apr 29, 2016
2 parents 0759e9c + 69a2443 commit 4768446
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
9 changes: 5 additions & 4 deletions addon/templates/components/frost-multi-select.hbs
@@ -1,11 +1,12 @@
<input
class="trigger"
type="text"
value={{prompt}}
onFocus={{action 'onFocus'}}
disabled={{disableInput}}
onBlur={{action 'onBlur'}}
onFocus={{action 'onFocus'}}
onInput={{action 'onChange'}}
disabled={{disableInput}}
placeholder={{placeholder}}
type="text"
value={{prompt}}
>

<div class="down-arrow" onClick={{action 'onClickArrow'}}>
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/frost-select.hbs
Expand Up @@ -5,6 +5,7 @@
onFocus={{action 'onFocus'}}
onBlur={{action 'onBlur'}}
onInput={{action 'onChange'}}
placeholder={{placeholder}}
type="text"
value={{prompt}}
>
Expand Down
1 change: 1 addition & 0 deletions frost-select.md
Expand Up @@ -15,6 +15,7 @@
| | | `true` | sets select component to error state |
| `onChange` | `string` | `<action-name>` | The action callback to call when the value of the select component changes |
| `onInput` | `string` | `<action-name>` | The action callback to call when the value of the filter changes as the user types |
| `placeholder` | `string` | | Placeholder text for when nothing is selected. |


## Examples
Expand Down
36 changes: 36 additions & 0 deletions tests/dummy/app/pods/select/template.hbs
Expand Up @@ -27,6 +27,24 @@
<hr>
<div class="section">

<div class="example">
<div class="title">placeholder</div>
<div class="demo">
{{frost-select
data=data
placeholder="Superhero"
}}
</div>
<div class="snippet">
{{format-markdown "```handlebars
{{frost-select
data=data
placeholder='Superhero'
}}
```"}}
</div>
</div>

<div class="example">
<div class="title">selected</div>
<div class="demo">
Expand Down Expand Up @@ -205,6 +223,24 @@
<hr>
<div class="section">

<div class="example">
<div class="title">placeholder</div>
<div class="demo">
{{frost-multi-select
data=data
placeholder="Superheroes"
}}
</div>
<div class="snippet">
{{format-markdown "```handlebars
{{frost-multi-select
data=data
placeholder='Superheroes'
}}
```"}}
</div>
</div>

<div class="example">
<div class="title">selected</div>
<div class="demo">
Expand Down
12 changes: 10 additions & 2 deletions tests/integration/components/frost-select-test.js
Expand Up @@ -8,10 +8,11 @@ import _ from 'lodash'
import Ember from 'ember'

const testTemplate = hbs`{{frost-select
onChange=onChange
data=data
selected=selected
greeting=greeting
onChange=onChange
placeholder=placeholder
selected=selected
selectedValue=selVal
}}`

Expand Down Expand Up @@ -56,6 +57,7 @@ describeComponent(
props = {
selected: 1,
onChange: sinon.spy(),
placeholder: 'Select something already',
data: [
{
value: 'Lex Diamond',
Expand Down Expand Up @@ -94,6 +96,7 @@ describeComponent(
done()
})
})

it('closes when down arrow clicked a second time', (done) => {
this.$('.frost-select .down-arrow').click()
this.$('.frost-select .down-arrow').click()
Expand Down Expand Up @@ -296,5 +299,10 @@ describeComponent(
})
})
})

it('supports placeholder', function () {
const $input = this.$('.frost-select input')
expect($input.attr('placeholder')).to.eql('Select something already')
})
}
)

0 comments on commit 4768446

Please sign in to comment.