Skip to content

Commit

Permalink
fix #428
Browse files Browse the repository at this point in the history
  • Loading branch information
basvasilich committed Sep 29, 2014
1 parent 7349037 commit f92711a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
18 changes: 18 additions & 0 deletions blocks/select/select.example.yate
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
func selects() {

selects-theme = (
nb-select({
'id': 'select-texttext'
'items': [
{
'value': ''
'text': 'Text'
'selected': false()
}
{
'value': 'whatever'
'text': 'Text'
'selected': false()
}
]
})

nb-select({
'size': 'm'
'id': 'select1'
Expand Down Expand Up @@ -311,4 +327,6 @@ func selects() {
}
]
}))


}
4 changes: 2 additions & 2 deletions blocks/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ nb.define('select', {
var selected;

if (params.value) {
selected = this.$control.find('option[value="' + params.value + '"]');
selected = this.$control.find('option[value="' + params.value + '"]').first();
} else {
selected = this.$control.find('option:contains(' + params.text + ')');
selected = this.$control.find('option:contains(' + params.text + ')').first();
}

if (selected.length !== 0) {
Expand Down
6 changes: 6 additions & 0 deletions unittests/spec/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ describe("Select Tests", function() {
expect(flag).to.equal(1);
});


it("#422", function() {
nb.find('select-texttext').setState({'text': 'Text'});
expect(nb.find('select-texttext').$node.find('._nb-button-content').html()).to.equal('Text');
});

it("XSS in _setText", function() {
this.select.addToSource({
'selected': true,
Expand Down
17 changes: 17 additions & 0 deletions unittests/spec/select/select.yate
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,22 @@ nb-select({
})


nb-select({
'id': 'select-texttext'
'items': [
{
'value': ''
'text': 'Text'
'selected': false()
}
{
'value': 'whatever'
'text': 'Text'
'selected': false()
}
]
})



}

0 comments on commit f92711a

Please sign in to comment.