Commit 224134ae authored by Sam Saccone's avatar Sam Saccone

Merge pull request #1448 from nordfjord/master

fix checkbox bug in the mithril TodoMVC example
parents aa29541c 4464e459
...@@ -2,9 +2,17 @@ ...@@ -2,9 +2,17 @@
/*global m */ /*global m */
var app = app || {}; var app = app || {};
var uniqueId = (function () {
var count = 0;
return function () {
return ++count;
};
}());
// Todo Model // Todo Model
app.Todo = function (data) { app.Todo = function (data) {
this.title = m.prop(data.title); this.title = m.prop(data.title);
this.completed = m.prop(data.completed || false); this.completed = m.prop(data.completed || false);
this.editing = m.prop(data.editing || false); this.editing = m.prop(data.editing || false);
this.key = uniqueId();
}; };
...@@ -51,7 +51,8 @@ app.view = (function () { ...@@ -51,7 +51,8 @@ app.view = (function () {
classes += task.completed() ? 'completed' : ''; classes += task.completed() ? 'completed' : '';
classes += task.editing() ? ' editing' : ''; classes += task.editing() ? ' editing' : '';
return classes; return classes;
})() })(),
key: task.key
}, [ }, [
m('.view', [ m('.view', [
m('input.toggle[type=checkbox]', { m('input.toggle[type=checkbox]', {
......
...@@ -114,7 +114,12 @@ ...@@ -114,7 +114,12 @@
})({}); })({});
if (location.hostname === 'todomvc.com') { if (location.hostname === 'todomvc.com') {
window._gaq = [['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script')); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-31081062-1', 'auto');
ga('send', 'pageview');
} }
/* jshint ignore:end */ /* jshint ignore:end */
...@@ -228,7 +233,7 @@ ...@@ -228,7 +233,7 @@
xhr.onload = function (e) { xhr.onload = function (e) {
var parsedResponse = JSON.parse(e.target.responseText); var parsedResponse = JSON.parse(e.target.responseText);
if (parsedResponse instanceof Array) { if (parsedResponse instanceof Array) {
var count = parsedResponse.length var count = parsedResponse.length;
if (count !== 0) { if (count !== 0) {
issueLink.innerHTML = 'This app has ' + count + ' open issues'; issueLink.innerHTML = 'This app has ' + count + ' open issues';
document.getElementById('issue-count').style.display = 'inline'; document.getElementById('issue-count').style.display = 'inline';
......
{ {
"private": true, "private": true,
"dependencies": { "dependencies": {
"mithril": "^0.1.20",
"todomvc-common": "^1.0.1", "todomvc-common": "^1.0.1",
"todomvc-app-css": "^1.0.1" "todomvc-app-css": "^1.0.1",
"mithril": "~0.2.0"
} }
} }
...@@ -30,6 +30,8 @@ function TestOperations(page) { ...@@ -30,6 +30,8 @@ function TestOperations(page) {
this.assertClearCompleteButtonIsHidden = function () { this.assertClearCompleteButtonIsHidden = function () {
page.tryGetClearCompleteButton().then(function (element) { page.tryGetClearCompleteButton().then(function (element) {
testIsHidden(element, 'clear completed items button'); testIsHidden(element, 'clear completed items button');
}, function (_error) {
assert(_error.code === 7, 'error accessing clear completed items button, error: ' + _error.message);
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment