Skip to content

Instantly share code, notes, and snippets.

@juriansluiman
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juriansluiman/0695b0845df6f668962c to your computer and use it in GitHub Desktop.
Save juriansluiman/0695b0845df6f668962c to your computer and use it in GitHub Desktop.
Test riot-js file for a bug report
<comment-box>
<h1>{ opts.title }</h1>
<comment-list url={ opts.url } comments={ comments } />
<comment-form url={ opts.url } comments={ comments } />
// Start with some in-memory list of comments
this.comments = [{'name': 'Tom', 'message': 'Hi there'}, {'name': 'Paul', 'message': 'Great job'}]
</comment-box>
<comment-list>
<comment each={ opts.comments } name={ this.name } message={ this.message } />
</comment-list>
<comment-form>
<form onsubmit={add}>
<input type="text" placeholder="Your name" name="name">
<textarea cols="40" rows="40" placeholder="Say something..." name="message"></textarea>
<input type="submit" value="Post">
</form>
add(e) {
var data = {
'name': this.name.value,
'message': this.message.value
}
// Add the new comment to the list
// Note: this does **NOT** work; bug in riot?
this.parent.comments.push(data);
}
</comment-form>
<comment>
<div>
<h2>{ opts.name }</h2>
<p>{ opts.message }</p>
</div>
</comment>
@tipiirai
Copy link

Will look into this today.

btw: Did you try parent.update()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment