From 9b3e6463034e5eeaac4da4ba171f1ffaa586444b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sat, 11 Feb 2017 22:25:10 +0100 Subject: [PATCH 1/4] [ospec] make o.only noisier --- ospec/ospec.js | 5 ++++- ospec/tests/test-ospec.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ospec/ospec.js b/ospec/ospec.js index f153e841..00d1246e 100644 --- a/ospec/ospec.js +++ b/ospec/ospec.js @@ -18,7 +18,10 @@ module.exports = new function init() { predicate() ctx = parent } - o.only = function(subject, predicate) {o(subject, only = predicate)} + o.only = function(subject, predicate, silent) { + if (!silent) console.log(highlight("/!\\ WARNING /!\\ o.only() mode")) + o(subject, only = predicate) + } o.spy = function(fn) { var spy = function() { spy.this = this diff --git a/ospec/tests/test-ospec.js b/ospec/tests/test-ospec.js index 2bdd5556..70301e91 100644 --- a/ospec/tests/test-ospec.js +++ b/ospec/tests/test-ospec.js @@ -12,7 +12,7 @@ new function(o) { }) o.only(".only()", function() { o(2).equals(2) - }) + }, true) }) o.run() From 75b20e86e87d4a00d1c55989c2fc3b2f477f9810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Yves=20G=C3=A9rardy?= Date: Sat, 11 Feb 2017 23:04:27 +0100 Subject: [PATCH 2/4] test: Re-enable the test suite (#1616) --- render/tests/test-render.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render/tests/test-render.js b/render/tests/test-render.js index 337a9d64..515fe885 100644 --- a/render/tests/test-render.js +++ b/render/tests/test-render.js @@ -113,7 +113,7 @@ o.spec("render", function() { o(updateB.callCount).equals(0) o(removeB.callCount).equals(1) }) - o.only("update lifecycle methods work on children of recycled keyed", function() { + o("update lifecycle methods work on children of recycled keyed", function() { var createA = o.spy() var updateA = o.spy() var removeA = o.spy() From 837edd3b53e63d42de0b80245257d0bf0d72916a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=80=D0=B0=D1=81=D0=B8=D0=BC=D0=B8=D1=80=20=D0=91?= =?UTF-8?q?=D0=B5=D1=80=D0=BE=D0=B2?= Date: Sun, 12 Feb 2017 21:28:09 +0100 Subject: [PATCH 3/4] fixed a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9efe8bef..3334a236 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Let's create an HTML file to follow along: ### Hello world -Let's start as small as well can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) +Let's start as small as we can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) ```javascript var root = document.body From 19f1ac8908096d7d815bc5c0cfee19b34fe0eebf Mon Sep 17 00:00:00 2001 From: spacejack Date: Sun, 12 Feb 2017 19:41:47 -0500 Subject: [PATCH 4/4] Minor fixes to get the tutorial working --- docs/simple-application.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/simple-application.md b/docs/simple-application.md index 134e11c6..1e7a57da 100644 --- a/docs/simple-application.md +++ b/docs/simple-application.md @@ -74,7 +74,7 @@ var User = { module.exports = User ``` -Then we can add an `m.request` call to make an XHR request. For this tutorial, we'll make XHR calls to the [REM](http://rem-rest-api.herokuapp.com/) API, a mock REST API designed for rapid prototyping. This API returns a list of users from the `GET http://rem-rest-api.herokuapp.com/api/users` endpoint. Let's use `m.request` to make an XHR request and populate our data with the response of that endpoint. +Then we can add an `m.request` call to make an XHR request. For this tutorial, we'll make XHR calls to the [REM](http://rem-rest-api.herokuapp.com/) API, a mock REST API designed for rapid prototyping. This API returns a list of users from the `GET https://rem-rest-api.herokuapp.com/api/users` endpoint. Let's use `m.request` to make an XHR request and populate our data with the response of that endpoint. ```javascript // src/models/User.js @@ -85,7 +85,7 @@ var User = { loadList: function() { return m.request({ method: "GET", - url: "http://rem-rest-api.herokuapp.com/api/users", + url: "https://rem-rest-api.herokuapp.com/api/users", withCredentials: true, }) .then(function(result) { @@ -357,7 +357,7 @@ var User = { loadList: function() { return m.request({ method: "GET", - url: "http://rem-rest-api.herokuapp.com/api/users", + url: "https://rem-rest-api.herokuapp.com/api/users", withCredentials: true, }) .then(function(result) { @@ -380,7 +380,7 @@ var User = { loadList: function() { return m.request({ method: "GET", - url: "http://rem-rest-api.herokuapp.com/api/users", + url: "https://rem-rest-api.herokuapp.com/api/users", withCredentials: true, }) .then(function(result) { @@ -392,7 +392,7 @@ var User = { load: function(id) { return m.request({ method: "GET", - url: "http://rem-rest-api.herokuapp.com/api/users/:id", + url: "https://rem-rest-api.herokuapp.com/api/users/:id", data: {id: id}, withCredentials: true, }) @@ -461,7 +461,12 @@ var User = require("../models/User") module.exports = { oninit: function(vnode) {User.load(vnode.attrs.id)}, view: function() { - return m("form", [ + return m("form", { + onsubmit: function(e) { + e.preventDefault() + User.save() + } + }, [ m("label.label", "First name"), m("input.input[type=text][placeholder=First name]", { oninput: m.withAttr("value", function(value) {User.current.firstName = value}), @@ -472,7 +477,7 @@ module.exports = { oninput: m.withAttr("value", function(value) {User.current.lastName = value}), value: User.current.lastName }), - m("button.button[type=submit]", {onclick: User.save}, "Save"), + m("button.button[type=submit]", "Save"), ]) } } @@ -491,7 +496,7 @@ var User = { loadList: function() { return m.request({ method: "GET", - url: "http://rem-rest-api.herokuapp.com/api/users", + url: "https://rem-rest-api.herokuapp.com/api/users", withCredentials: true, }) .then(function(result) { @@ -503,7 +508,7 @@ var User = { load: function(id) { return m.request({ method: "GET", - url: "http://rem-rest-api.herokuapp.com/api/users/:id", + url: "https://rem-rest-api.herokuapp.com/api/users/:id", data: {id: id}, withCredentials: true, }) @@ -515,7 +520,7 @@ var User = { save: function() { return m.request({ method: "PUT", - url: "http://rem-rest-api.herokuapp.com/api/users/:id", + url: "https://rem-rest-api.herokuapp.com/api/users/:id", data: User.current, withCredentials: true, })