Skip to content

Commit

Permalink
closes #1839
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Jul 12, 2016
1 parent 67e8c5b commit d048b68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/server/sdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ Object.defineProperty(simpleDom.Element.prototype, 'innerHTML', {
// set the value attribute correctly on the input tags
Object.defineProperty(simpleDom.Element.prototype, 'value', {
set: function(val) {
// is an input tag
if (~['input', 'option', 'textarea'].indexOf(this.tagName.toLowerCase()))
if (this.getAttribute('value') != val) {
this.setAttribute('value', val)
else
this.value = val
}
}
})

Expand Down
6 changes: 6 additions & 0 deletions test/specs/server/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ describe('Node/io.js', function() {
expect($('circle').length).to.be(3)
})

it('render tag: loops having conditional directives', function() {
var tag = riot.render('loop-conditional')
var $ = cheerio.load(tag)
expect($('loop-conditional-item').length).to.be.equal(2)
})

it('render tag: input,option,textarea tags having expressions as value', function() {
var frm = riot.render('form-controls', { text: 'my-value' })
var $ = cheerio.load(frm)
Expand Down

0 comments on commit d048b68

Please sign in to comment.