From 5660637e30b5ceb3c5e92676bae693390e18c2aa Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Tue, 2 May 2017 13:12:00 -0700 Subject: [PATCH] docs: new repo refs and build tweaks --- .travis.yml | 16 +- docs/change-log.md | 18 +- docs/contributing.md | 2 +- docs/examples.md | 12 +- docs/favicon.ico | Bin 0 -> 15086 bytes docs/favicon.png | Bin 0 -> 1697 bytes docs/framework-comparison.md | 6 +- docs/generate.js | 5 +- docs/installation.md | 2 +- docs/layout.html | 5 +- docs/nav-guides.md | 2 +- docs/nav-methods.md | 2 +- docs/releasing.md | 26 +-- docs/request.md | 2 +- docs/simple-application.md | 2 +- docs/testing.md | 2 +- ospec/package.json | 2 +- package.json | 14 +- performance/index.html | 23 +++ performance/test-perf.js | 336 +++++++++++++++++++++++++++++++++++ stream/package.json | 2 +- test-utils/pushStateMock.js | 2 +- 22 files changed, 424 insertions(+), 57 deletions(-) create mode 100644 docs/favicon.ico create mode 100644 docs/favicon.png create mode 100644 performance/index.html create mode 100644 performance/test-perf.js diff --git a/.travis.yml b/.travis.yml index 75e9b45c..494a4fef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,10 +16,12 @@ install: - npm install @alrra/travis-scripts@^3.0.1 gh-pages@^0.12.0 # Bundle before running tests so the bundle is always up-to-date -before_script: npm run build +before_script: npm run build --silent -# This is the default, but leaving so it is obvious -# script: npm test +# Run tests, lint, and then check for perf regressions +script: +- npm test --silent +- npm run perf --silent # After a successful build commit changes back to repo after_success: @@ -42,7 +44,7 @@ after_success: # this doesn't have the built-in branch protection like commit-changes if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \ [ "$TRAVIS_BRANCH" == "master" ] && \ - [ "$TRAVIS_REPO_SLUG" == "lhorie/mithril.js" ] + [ "$TRAVIS_REPO_SLUG" == "MithrilJS/mithril.js" ] then # Generate docs npm run gendocs @@ -57,7 +59,7 @@ after_success: $(npm bin)/gh-pages \ --dist ./dist \ --add \ - --repo "git@github.com:lhorie/mithril.js.git" \ + --repo "git@github.com:MithrilJS/mithril.js.git" \ --message "Generated docs for commit $TRAVIS_COMMIT [skip ci]" else echo "Not submitting documentation updates" @@ -81,7 +83,7 @@ deploy: skip_cleanup: true on: tags: true - repo: lhorie/mithril.js + repo: MithrilJS/mithril.js branch: master - provider: npm @@ -91,5 +93,5 @@ deploy: secure: ADElvD1oxn9GfEG7dDOggX96b36A/cGEybovAc0221CCKzv5kWCavMrtxneiJYI6N/n24abSlbM90vMfU84FEzH0Ev28dGVokRP4ad6VRkISszKlYVEP8Lds4QxfKh78jZlUxmxM0B3vmQ1kYJbTBqp3ICtaJ5ptEQHWhrLtxnc= on: tags: true - repo: lhorie/mithril.js + repo: MithrilJS/mithril.js branch: master diff --git a/docs/change-log.md b/docs/change-log.md index 9c493aa4..eedac49b 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -12,8 +12,8 @@ #### Bug fixes -- hyperscript: Allow `0` as the second argument to `m()` - [#1752](https://github.com/lhorie/mithril.js/issues/1752) / [#1753](https://github.com/lhorie/mithril.js/pull/1753) ([@StephanHoyer](https://github.com/StephanHoyer)) -- hyperscript: restore `attrs.class` handling to what it was in v1.0.1 - [#1764](https://github.com/lhorie/mithril.js/issues/1764) / [#1769](https://github.com/lhorie/mithril.js/pull/1769) +- hyperscript: Allow `0` as the second argument to `m()` - [#1752](https://github.com/MithrilJS/mithril.js/issues/1752) / [#1753](https://github.com/MithrilJS/mithril.js/pull/1753) ([@StephanHoyer](https://github.com/StephanHoyer)) +- hyperscript: restore `attrs.class` handling to what it was in v1.0.1 - [#1764](https://github.com/MithrilJS/mithril.js/issues/1764) / [#1769](https://github.com/MithrilJS/mithril.js/pull/1769) - documentation improvements ([@JAForbes](https://github.com/JAForbes), [@smuemd](https://github.com/smuemd), [@hankeypancake](https://github.com/hankeypancake)) ### v1.1.0 @@ -26,10 +26,10 @@ #### Bug fixes -- fix IE11 input[type] error - [#1610](https://github.com/lhorie/mithril.js/issues/1610) -- apply [#1609](https://github.com/lhorie/mithril.js/issues/1609) to unkeyed children case -- fix abort detection [#1612](https://github.com/lhorie/mithril.js/issues/1612) -- fix input value focus issue when value is loosely equal to old value [#1593](https://github.com/lhorie/mithril.js/issues/1593) +- fix IE11 input[type] error - [#1610](https://github.com/MithrilJS/mithril.js/issues/1610) +- apply [#1609](https://github.com/MithrilJS/mithril.js/issues/1609) to unkeyed children case +- fix abort detection [#1612](https://github.com/MithrilJS/mithril.js/issues/1612) +- fix input value focus issue when value is loosely equal to old value [#1593](https://github.com/MithrilJS/mithril.js/issues/1593) --- @@ -37,12 +37,12 @@ #### News -- performance improvements in IE [#1598](https://github.com/lhorie/mithril.js/pull/1598) +- performance improvements in IE [#1598](https://github.com/MithrilJS/mithril.js/pull/1598) #### Bug fixes -- prevent infinite loop in non-existent default route - [#1579](https://github.com/lhorie/mithril.js/issues/1579) -- call correct lifecycle methods on children of recycled keyed vnodes - [#1609](https://github.com/lhorie/mithril.js/issues/1609) +- prevent infinite loop in non-existent default route - [#1579](https://github.com/MithrilJS/mithril.js/issues/1579) +- call correct lifecycle methods on children of recycled keyed vnodes - [#1609](https://github.com/MithrilJS/mithril.js/issues/1609) --- diff --git a/docs/contributing.md b/docs/contributing.md index 5b4770d3..795177af 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -4,7 +4,7 @@ ## How do I go about contributing ideas or new features? -Create an [issue thread on Github](https://github.com/lhorie/mithril.js/issues/new) to suggest your idea so the community can discuss it. +Create an [issue thread on Github](https://github.com/MithrilJS/mithril.js/issues/new) to suggest your idea so the community can discuss it. If the consensus is that it's a good idea, the fastest way to get it into a release is to send a pull request. Without a PR, the time to implement the feature will depend on the bandwidth of the development team and its list of priorities. diff --git a/docs/examples.md b/docs/examples.md index 140ad3f6..749900cc 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -2,10 +2,10 @@ Here are some examples of Mithril in action -- [Animation](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/animation/mosaic.html) -- [DBMonster](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/dbmonster/mithril/index.html) -- [Markdown Editor](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/editor/index.html) -- SVG: [Clock](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/svg/clock.html), [Ring](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/svg/ring.html), [Tiger](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/svg/tiger.html) -- [ThreadItJS](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/threaditjs/index.html) -- [TodoMVC](http://cdn.rawgit.com/lhorie/mithril.js/rewrite/examples/todomvc/index.html) +- [Animation](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/animation/mosaic.html) +- [DBMonster](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/dbmonster/mithril/index.html) +- [Markdown Editor](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/editor/index.html) +- SVG: [Clock](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/svg/clock.html), [Ring](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/svg/ring.html), [Tiger](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/svg/tiger.html) +- [ThreadItJS](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/threaditjs/index.html) +- [TodoMVC](http://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/todomvc/index.html) diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..61807fae19adedb602ddd0dae259131a9ed7e63c GIT binary patch literal 15086 zcmc(l36K@V8OM7DWl^Gwf{GUp1rHSOE1KvcF(wAf7>_b#Jd$|CQY$IXXsH1)vPMa5 zjL}l7WQ{Q?V~nX_ys97~OGKkWycHv|g06_iE+FpWvXkF`rh8t$dGp@B$3msIdb|7k z{@>B}G0&L53^M!gZ%9X*2X-^&P-D#K(Y8Fyn8nbBk&1u8CdNzyuqPNq%nym8$6;)e zY~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(NJVG7c|fPb-rF-_Lgnp;(7&Xw<(gP z4Q3)+buX)+y8-zZrGvIVy#l5hc@rnkc=&lWU>*4SDV+K1L|qNu!R;t7+ZV@LY$ z3C=llnA4YoKNYObP1@gx;f)DRykL&7=x}@1reGE#S9144W;*fDHct0#g1uNW(2zA( zg1Ou0lV^VpUM1BTRqNHuq7l=8%)OG8KM?(MoPmCwc+hd%gygRfjl3W9CQp6iZ$rYl zpx+)n1zlrVd$xXux)|DQ2e7Hu!4>Fumh#vlO>gSDKbWha(cEzzuY$&U72ZbKt=VIc zH0lwoA@9Eb>8|?<@dI#&NzeuC zoDW^=q0So1(KQeMG#0N<^6~m7{%2rMb8=p~54h)SS?!h$n~H$^ntycS-$o zc?k@qM}w*O8+yx^j@?QGlfs_J#%-6wOG(u2B;ly{Z^)lPJe&OO&=!+FE(KQ4i~##1 zE?29CR O@tH9_t;Y0CHs*g3ezns8 literal 0 HcmV?d00001 diff --git a/docs/favicon.png b/docs/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..507126309faa675212895b7f9dc54e215e5f4da8 GIT binary patch literal 1697 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+081LKbXpAgso|NjHkFfahk zWPvak85kKEm>`G=iGj?9sRStl>jeuiFhg`fI6yW~3y=-b2p0qj07bxpj1WPf31}LD z;y`DBw1Q257y?uV*9cY*bSEQF1gse9V7NJ8afpwA@*wl!?gX6WdPz_3`!i)mB92n^V%TEaa?Os+A;Ca8VSdP{zm z5NE&7qE&ld?AzNU{rK;Vch_wvI`FE*e2G=Ic~C#&qNT`_d3rZ<-f9(o{JKQ+kcmRD z#54ZZHo2$5lC|vzHLk4RZg|3AhqFx3u?5VmD=wv-+4k`E$y5*b!*12a*&EmVwkW># zy@=_E=I7I|Kk3Q`xGHH@sci-YVUoAI3quF1tOt<8S>O>_%)r3C1cVvaTx?$j6l5>) z^mS!_$jZcHA<23AgfcK(!aZFaLo80024^}4Ig0FU5nLiBsVN~Q@JwvR%o~p;2`!s8 zwJ~Yhnq^a>XNp`*O5Hs*yQ^#Wy!$uLJl@N)>Zd{Rxt*Kul%KD4(RAMCKhN>M>~B$a z28~emr~i3Qi#Vi(eOq`qOQZkEA6ffV2RGia>D#iaM&|nRRBkpQW~1Og>YrbM4a=;q<_XKIa!2*=mZWc)qb&)sb^mXzez^*aJtG z@J=t-xlC-u+RKtWyR6ziy?$Mos(?pRztwf3>~EsM&^niE$vQ6!B;EA|mgZ#$m$@{~ zntoC~`f`A$+4O`qed8HZbHWp6 zW$>LGblHQ!T6l3SVlD7(S*5zlT#p7I-#8=0~{?ww~`z38>gmc%=E zO!5l0$bFr0`BzPLb$a-PGrO&CN7p~Oucmf*H^<~|P^wccag8WRNi0dVN-jzTQVd20 zhUU5krn&}3A%;d)re;<~rrHKZRt5%hTNc`*Xvob^$xN%nt>Mj0$!4GiNstY}`DrEP ziAAXl<>lpinR(g8$%zH2dih1^v)|cB0TqQ;g+!DDC6+4`6y>L7=AHello world - + diff --git a/docs/layout.html b/docs/layout.html index 02e07a0b..110a890b 100644 --- a/docs/layout.html +++ b/docs/layout.html @@ -4,6 +4,7 @@ Mithril.js + @@ -14,8 +15,8 @@ diff --git a/docs/nav-guides.md b/docs/nav-guides.md index db55712a..872ce86b 100644 --- a/docs/nav-guides.md +++ b/docs/nav-guides.md @@ -16,7 +16,7 @@ - [Keys](keys.md) - [Autoredraw system](autoredraw.md) - Social - - [Mithril Jobs](https://github.com/lhorie/mithril.js/wiki/JOBS) + - [Mithril Jobs](https://github.com/MithrilJS/mithril.js/wiki/JOBS) - [How to contribute](contributing.md) - [Credits](credits.md) - [Code of Conduct](code-of-conduct.md) diff --git a/docs/nav-methods.md b/docs/nav-methods.md index 06809b50..06ae1f42 100644 --- a/docs/nav-methods.md +++ b/docs/nav-methods.md @@ -16,4 +16,4 @@ - Optional - [Stream](stream.md) - Tooling - - [Ospec](https://github.com/lhorie/mithril.js/blob/rewrite/ospec) + - [Ospec](https://github.com/MithrilJS/mithril.js/blob/master/ospec) diff --git a/docs/releasing.md b/docs/releasing.md index df5e3aeb..37bec28d 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,5 +1,7 @@ # Mithril Release Processes +**Note** These steps all assume that `MithrilJS/mithril.js` is a git remote named `mithriljs`, adjust accordingly if that doesn't match your setup. + ## Releasing a new Mithril version ### Prepare the release @@ -8,7 +10,7 @@ ```bash $ git co next -$ git pull --rebase lhorie next +$ git pull --rebase mithriljs next ``` 2. Determine patch level of the change @@ -22,8 +24,8 @@ $ git commit -m "Preparing for release" # Push to your branch $ git push -# Push to lhorie/mithril.js -$ git push lhorie next +# Push to MithrilJS/mithril.js +$ git push mithriljs next ``` ### Merge from `next` to `master` @@ -32,7 +34,7 @@ $ git push lhorie next ```bash $ git co master -$ git pull --rebase lhorie master +$ git pull --rebase mithriljs master ``` 6. merge `next` on top of it @@ -53,10 +55,10 @@ $ npm test 8. `npm run release `, see the docs for [`npm version`](https://docs.npmjs.com/cli/version) 9. The changes will be automatically pushed to your fork -10. Push the changes to `lhorie/mithril.js` +10. Push the changes to `MithrilJS/mithril.js` ```bash -$ git push lhorie master +$ git push mithriljs master ``` 11. Travis will push the new release to npm & create a GitHub release @@ -69,7 +71,7 @@ This helps to ensure that the `version` field of `package.json` doesn't get out ```bash $ git co next -$ git pull --rebase lhorie next +$ git pull --rebase mithriljs next ``` 13. Merge `master` back onto `next` @@ -78,11 +80,11 @@ $ git pull --rebase lhorie next $ git merge master ``` -14. Push the changes to your fork & `lhorie/mithril.js` +14. Push the changes to your fork & `MithrilJS/mithril.js` ```bash $ git push -$ git push lhorie next +$ git push mithriljs next ``` ### Update the GitHub release @@ -94,11 +96,11 @@ $ git push lhorie next Fixes to documentation can land whenever, updates to the site are published via Travis. ```bash -# These steps assume that lhorie/mithril.js is a git remote named "lhorie" +# These steps assume that MithrilJS/mithril.js is a git remote named "mithriljs" # Ensure your next branch is up to date $ git co next -$ git pull lhorie next +$ git pull mithriljs next # Splat the docs folder from next onto master $ git co master @@ -106,7 +108,7 @@ $ git co next -- ./docs # Manually ensure that no new feature docs were added -$ git push lhorie +$ git push mithriljs ``` After the Travis build completes the updated docs should appear on https://mithril.js.org in a few minutes. diff --git a/docs/request.md b/docs/request.md index 0af751af..3ed049a5 100644 --- a/docs/request.md +++ b/docs/request.md @@ -287,7 +287,7 @@ function upload(e) { var data = new FormData() for (var i = 0; i < files.length; i++) { - data.append("file" + i, file) + data.append("file" + i, files[i]) } m.request({ diff --git a/docs/simple-application.md b/docs/simple-application.md index b226aa2c..cd37bbd9 100644 --- a/docs/simple-application.md +++ b/docs/simple-application.md @@ -616,4 +616,4 @@ This concludes the tutorial. In this tutorial, we went through the process of creating a very simple application where we can list users from a server and edit them individually. As an extra exercise, try to implement user creation and deletion on your own. -If you want to see more examples of Mithril code, check the [examples](examples.md) page. If you have questions, feel free to drop by the [Mithril chat room](https://gitter.im/lhorie/mithril.js). +If you want to see more examples of Mithril code, check the [examples](examples.md) page. If you have questions, feel free to drop by the [Mithril chat room](https://gitter.im/MithrilJS/mithril.js). diff --git a/docs/testing.md b/docs/testing.md index 1ac9a7d2..03bce6b0 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -1,6 +1,6 @@ # Testing -Mithril comes with a testing framework called [ospec](https://github.com/lhorie/mithril.js/tree/rewrite/ospec). What makes it different from most test frameworks is that it avoids all configurability for the sake of avoiding [yak shaving](http://catb.org/jargon/html/Y/yak-shaving.html) and [analysis paralysis](https://en.wikipedia.org/wiki/Analysis_paralysis). +Mithril comes with a testing framework called [ospec](https://github.com/MithrilJS/mithril.js/tree/master/ospec). What makes it different from most test frameworks is that it avoids all configurability for the sake of avoiding [yak shaving](http://catb.org/jargon/html/Y/yak-shaving.html) and [analysis paralysis](https://en.wikipedia.org/wiki/Analysis_paralysis). The easist way to setup the test runner is to create an NPM script for it. Open your project's `package.json` file and edit the `test` line under the `scripts` section: diff --git a/ospec/package.json b/ospec/package.json index fdda49db..388720f3 100644 --- a/ospec/package.json +++ b/ospec/package.json @@ -12,5 +12,5 @@ "bin": { "ospec": "./bin/ospec" }, - "repository": "lhorie/mithril.js#rewrite" + "repository": "MithrilJS/mithril.js" } diff --git a/package.json b/package.json index 6263d749..5acc1de5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "Leo Horie", "license": "MIT", "main": "mithril.js", - "repository": "lhorie/mithril.js", + "repository": "MithrilJS/mithril.js", "scripts": { "dev": "node bundler/cli browser.js -o mithril.js -w", "build": "npm run build-browser & npm run build-min", @@ -13,19 +13,21 @@ "build-min": "node bundler/cli browser.js -o mithril.min.js -m", "lintdocs": "node docs/lint", "gendocs": "node docs/generate", - "lint": "eslint .", + "lint": "eslint . || true", "lint:fix": "eslint . --fix", + "perf": "node performance/test-perf.js", "test": "node ospec/bin/ospec", - "posttest": "npm run lint || true", + "posttest": "npm run lint", "cover": "istanbul cover --print both ospec/bin/ospec", - "release": "npm version -m \"v%s\"", + "release": "npm version -m 'v%s'", "preversion": "npm run test", "version": "npm run build && git add mithril.js mithril.min.js", "postversion": "git push --follow-tags" }, "devDependencies": { - "eslint": "^3.16.1", - "istanbul": "^0.4.3", + "benchmark": "^2.1.4", + "eslint": "^3.19.0", + "istanbul": "^0.4.5", "marked": "^0.3.6" }, "bin": { diff --git a/performance/index.html b/performance/index.html new file mode 100644 index 00000000..a0f288c5 --- /dev/null +++ b/performance/index.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/performance/test-perf.js b/performance/test-perf.js new file mode 100644 index 00000000..2ba9b622 --- /dev/null +++ b/performance/test-perf.js @@ -0,0 +1,336 @@ +/* global Benchmark */ +"use strict" + +/* Based off of preact's perf tests, so including their MIT license */ +/* +The MIT License (MIT) + +Copyright (c) 2017 Jason Miller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +var browserMock = require("../test-utils/browserMock") + +// Do this silly dance so browser testing works +var B = typeof Benchmark === "undefined" ? require("benchmark") : Benchmark + +var m, scratch; + +// set up browser env on before running tests +var doc = typeof document !== "undefined" ? document : null + +if(!doc) { + var mock = browserMock() + if (typeof global !== "undefined") { global.window = mock } + + doc = mock.document +} + +// Have to include mithril AFTER browser polyfill is set up +m = require("../mithril") // eslint-disable-line global-require + +scratch = doc.createElement("div"); + +(doc.body || doc.documentElement).appendChild(scratch) + +// Initialize benchmark suite +var suite = new B.Suite("mithril perf") + +suite.on("start", function() { + this.start = Date.now(); +}) + +suite.on("cycle", function(e) { + console.log(e.target.toString()) + + scratch.innerHTML = "" +}) + +suite.on("complete", function() { + console.log("Completed perf tests in " + (Date.now() - this.start) + "ms") +}) + +suite.on("error", console.error.bind(console)) + +suite.add({ + name : "rerender without changes", + onStart : function() { + this.vdom = m("div", {class: "foo bar", "data-foo": "bar", p: 2}, + m("header", + m("h1", {class: "asdf"}, "a ", "b", " c ", 0, " d"), + m("nav", + m("a", {href: "/foo"}, "Foo"), + m("a", {href: "/bar"}, "Bar") + ) + ), + m("main", + m("form", {onSubmit: function onSubmit() {}}, + m("input", {type: "checkbox", checked: true}), + m("input", {type: "checkbox", checked: false}), + m("fieldset", + m("label", + m("input", {type: "radio", checked: true}) + ), + m("label", + m("input", {type: "radio"}) + ) + ), + m("button-bar", + m("button", + {style: "width:10px; height:10px; border:1px solid #FFF;"}, + "Normal CSS" + ), + m("button", + {style: "top:0 ; right: 20"}, + "Poor CSS" + ), + m("button", + {style: "invalid-prop:1;padding:1px;font:12px/1.1 arial,sans-serif;", icon: true}, + "Poorer CSS" + ), + m("button", + {style: {margin: 0, padding: "10px", overflow: "visible"}}, + "Object CSS" + ) + ) + ) + ) + ) + }, + fn : function() { + m.render(scratch, this.vdom) + } +}) + +suite.add({ + name : "construct large VDOM tree", + + onStart : function() { + var fields = [] + + for(var i=100; i--;) { + fields.push((i * 999).toString(36)) + } + + this.fields = fields; + }, + + fn : function () { + m("div", {class: "foo bar", "data-foo": "bar", p: 2}, + m("header", + m("h1", {class: "asdf"}, "a ", "b", " c ", 0, " d"), + m("nav", + m("a", {href: "/foo"}, "Foo"), + m("a", {href: "/bar"}, "Bar") + ) + ), + m("main", + m("form", + {onSubmit: function onSubmit() {}}, + m("input", {type: "checkbox", checked: true}), + m("input", {type: "checkbox"}), + m("fieldset", + this.fields.map(function (field) { + return m("label", + field, + ":", + m("input", {placeholder: field}) + ) + }) + ), + m("button-bar", + m("button", + {style: "width:10px; height:10px; border:1px solid #FFF;"}, + "Normal CSS" + ), + m("button", + {style: "top:0 ; right: 20"}, + "Poor CSS" + ), + m("button", + {style: "invalid-prop:1;padding:1px;font:12px/1.1 arial,sans-serif;", icon: true}, + "Poorer CSS" + ), + m("button", + {style: {margin: 0, padding: "10px", overflow: "visible"}}, + "Object CSS" + ) + ) + ) + ) + ) + } +}) + +suite.add({ + name : "mutate styles/properties", + + onStart : function () { + var counter = 0 + var keyLooper = function (n) { return function (c) { return c % n ? (c + "px") : c } } + var get = function (obj, i) { return obj[i%obj.length] } + var classes = ["foo", "foo bar", "", "baz-bat", null, "fooga"] + var styles = [] + var multivalue = ["0 1px", "0 0 1px 0", "0", "1px", "20px 10px", "7em 5px", "1px 0 5em 2px"] + var stylekeys = [ + ["left", keyLooper(3)], + ["top", keyLooper(2)], + ["margin", function (c) { return get(multivalue, c).replace("1px", c+"px") }], + ["padding", function (c) { return get(multivalue, c) }], + ["position", function (c) { return c%5 ? c%2 ? "absolute" : "relative" : null }], + ["display", function (c) { return c%10 ? c%2 ? "block" : "inline" : "none" }], + ["color", function (c) { return ("rgba(" + (c%255) + ", " + (255 - c%255) + ", " + (50+c%150) + ", " + (c%50/50) + ")") }], + ["border", function (c) { return c%5 ? ((c%10) + "px " + (c%2?"solid":"dotted") + " " + (stylekeys[6][1](c))) : "" }] + ] + var i, j, style, conf + + for (i=0; i<1000; i++) { + style = {} + for (j=0; j", "license": "MIT", - "repository": "lhorie/mithril.js" + "repository": "MithrilJS/mithril.js" } diff --git a/test-utils/pushStateMock.js b/test-utils/pushStateMock.js index c727f393..f2273a2d 100644 --- a/test-utils/pushStateMock.js +++ b/test-utils/pushStateMock.js @@ -1,7 +1,7 @@ "use strict" var parseURL = require("../test-utils/parseURL") -var callAsync = require("../test-utils/callAsync.js") +var callAsync = require("../test-utils/callAsync") function debouncedAsync(f) { var ref