From aeb5f05706661fdbc7e5ce18a3f3596b5ad11815 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 11 Sep 2016 16:21:45 +0200 Subject: [PATCH 1/5] Add the old test suite to the grunt task for both local tests and CI This relies on a hack to bypass the `mocha` detection by `grunt-mocha-phantomjs`. The tests have to run in less than 10 seconds, which is unlikely to be problematic on current hardware. Alternatively, adding the following to tests/index.html also makes the old test suite compatible with the mocha runner, but it entails loading `mocha`: --- Gruntfile.js | 2 +- tests/index.html | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index d858e4ed..6cb76731 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -95,7 +95,7 @@ module.exports = function (grunt) { // eslint-disable-line mocha_phantomjs: { // eslint-disable-line camelcase test: { - src: ["test/index.html"], + src: ["test/index.html", "tests/index.html"], options: { reporter: "dot" } diff --git a/tests/index.html b/tests/index.html index 9d7f08f4..1478c0f6 100644 --- a/tests/index.html +++ b/tests/index.html @@ -4,5 +4,11 @@ +

Open the console to see the test report

From 863b82b71ad9795b93ca42754f612b32af2e1acb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 11 Sep 2016 16:52:54 +0200 Subject: [PATCH 2/5] Break a test of the old suite --- tests/mithril-tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index dd5a4b98..f68fe0da 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -5,7 +5,7 @@ m.deps(mock.window) // m - test(function () { return typeof m.version() === "string" }) + test(function () { return typeof m.version() === "Ostring" }) test(function () { return m("div").tag === "div" }) test(function () { return m(".foo").tag === "div" }) test(function () { return m(".foo").attrs.className === "foo" }) From ee8ab3561b9722c327bac0b1ea082ab510156977 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 11 Sep 2016 17:00:06 +0200 Subject: [PATCH 3/5] Break a test of the new suite --- test/mithril.withAttr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mithril.withAttr.js b/test/mithril.withAttr.js index aae26656..7314c999 100644 --- a/test/mithril.withAttr.js +++ b/test/mithril.withAttr.js @@ -12,6 +12,6 @@ describe("m.withAttr()", function () { var spy = sinon.spy() var object = {} m.withAttr("test", spy, object)({currentTarget: {test: "foo"}}) - expect(spy).to.be.calledOn(object).and.calledWith("foo") + expect(spy).to.be.calledOn(object).and.calledWith("Ofoo") }) }) From 4aaee178bc264a367ca6963e7a27bc87b0e6f426 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 11 Sep 2016 17:02:08 +0200 Subject: [PATCH 4/5] Fix the test of the old suite leave the new one broken --- test/mithril.withAttr.js | 2 +- tests/mithril-tests.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mithril.withAttr.js b/test/mithril.withAttr.js index 7314c999..28be8efc 100644 --- a/test/mithril.withAttr.js +++ b/test/mithril.withAttr.js @@ -12,6 +12,6 @@ describe("m.withAttr()", function () { var spy = sinon.spy() var object = {} m.withAttr("test", spy, object)({currentTarget: {test: "foo"}}) - expect(spy).to.be.calledOn(object).and.calledWith("Ofoo") + expect(spy).to.be.calledOn(object).and.calledWith("Bfoo") }) }) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index f68fe0da..dd5a4b98 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -5,7 +5,7 @@ m.deps(mock.window) // m - test(function () { return typeof m.version() === "Ostring" }) + test(function () { return typeof m.version() === "string" }) test(function () { return m("div").tag === "div" }) test(function () { return m(".foo").tag === "div" }) test(function () { return m(".foo").attrs.className === "foo" }) From a76bbc0d7afe1136b8768ef0aadc57024fa88d55 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Sun, 11 Sep 2016 17:13:12 +0200 Subject: [PATCH 5/5] Fix the test of the new suite --- test/mithril.withAttr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mithril.withAttr.js b/test/mithril.withAttr.js index 28be8efc..aae26656 100644 --- a/test/mithril.withAttr.js +++ b/test/mithril.withAttr.js @@ -12,6 +12,6 @@ describe("m.withAttr()", function () { var spy = sinon.spy() var object = {} m.withAttr("test", spy, object)({currentTarget: {test: "foo"}}) - expect(spy).to.be.calledOn(object).and.calledWith("Bfoo") + expect(spy).to.be.calledOn(object).and.calledWith("foo") }) })