mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixes #511 - [v4] Bug related to textarea
This commit is contained in:
parent
d6832a5ec0
commit
9a29abefa6
@ -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;
|
||||||
|
|||||||
18
test/autotests/widgets-browser/textarea/index.marko
Normal file
18
test/autotests/widgets-browser/textarea/index.marko
Normal 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>
|
||||||
12
test/autotests/widgets-browser/textarea/test.js
Normal file
12
test/autotests/widgets-browser/textarea/test.js
Normal 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');
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user