Fixes #511 - [v4] Bug related to textarea

This commit is contained in:
Patrick Steele-Idem 2017-01-05 18:56:10 -07:00
parent d6832a5ec0
commit 9a29abefa6
3 changed files with 32 additions and 2 deletions

View File

@ -63,6 +63,8 @@ Node.prototype = {
}, },
$__appendChild: function(child) { $__appendChild: function(child) {
this.$__childCount++;
if (this.$__isTextArea) { if (this.$__isTextArea) {
if (child.$__Text) { if (child.$__Text) {
var childValue = child.nodeValue; var childValue = child.nodeValue;
@ -77,8 +79,6 @@ Node.prototype = {
assignNamespace(child, namespaceURI); assignNamespace(child, namespaceURI);
} }
this.$__childCount++;
var lastChild = this.$__lastChild; var lastChild = this.$__lastChild;
child.$__parentNode = this; child.$__parentNode = this;

View File

@ -0,0 +1,18 @@
<script>
module.exports = {
onInput: function(attrs) {
this.state = { code: '// Your code here', errorText: '' }
},
submit: function() {
this.state.errorText = 'Placeholder error'
}
}
</script>
<div class="code-editor">
<h3>Code Editor</h3>
<div>
<textarea>${state.code}</textarea>
</div>
<button on-click('submit')>Run Code</button>
<pre class="error-message">${state.errorText}</pre>
</div>

View File

@ -0,0 +1,12 @@
var expect = require('chai').expect;
module.exports = function(helpers) {
var widget = helpers.mount(require('./index.marko'));
expect(widget.el.querySelector('pre').innerHTML).to.equal('');
widget.submit();
widget.update();
expect(widget.el.querySelector('pre').innerHTML).to.equal('Placeholder error');
};