Lint Mithril main
This changes enough things to merit a new patch release. It changed a few implementation details in the process, but it's at least much cleaner. Be ready for every other currently outstanding PR for this file to have merge conflicts.
This commit is contained in:
parent
4902ee7d6f
commit
96bcc81022
8 changed files with 1780 additions and 1043 deletions
|
|
@ -7,6 +7,3 @@ mithril.closure-compiler-externs.js
|
||||||
|
|
||||||
# This is merely a dependency for the documentation.
|
# This is merely a dependency for the documentation.
|
||||||
docs/layout/lib
|
docs/layout/lib
|
||||||
|
|
||||||
# TODO: These are temporary, and need to be eventually enabled.
|
|
||||||
mithril.js
|
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,7 @@ module.exports = function (grunt) { // eslint-disable-line
|
||||||
"!archive/**",
|
"!archive/**",
|
||||||
"!deploy/**",
|
"!deploy/**",
|
||||||
"!mithril.closure-compiler-externs.js",
|
"!mithril.closure-compiler-externs.js",
|
||||||
"!docs/layout/lib/**",
|
"!docs/layout/lib/**"
|
||||||
// TODO(impinball): Finish this.
|
|
||||||
"!mithril.js"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
2785
mithril.js
2785
mithril.js
File diff suppressed because it is too large
Load diff
4
mithril.min.js
vendored
4
mithril.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -41,12 +41,19 @@
|
||||||
/* eslint-enable no-extend-native */
|
/* eslint-enable no-extend-native */
|
||||||
})()
|
})()
|
||||||
|
|
||||||
window.mock = (function () {
|
this.mock = (function (global) {
|
||||||
"use strict"
|
"use strict"
|
||||||
|
|
||||||
var window = {}
|
var window = {
|
||||||
|
// Some tests are only broken in PhantomJS 1.x, but successfully run in
|
||||||
|
// the browser. Still waiting on mocha-phantomjs to update to be
|
||||||
|
// compatible with PhantomJS 2.x.
|
||||||
|
phantom: global.window && global.window.navigator &&
|
||||||
|
/PhantomJS/.test(global.window.navigator.userAgent)
|
||||||
|
}
|
||||||
|
|
||||||
var document = window.document = {
|
var document = window.document = {
|
||||||
// FIXME: add document.createRange().createContextualFragment()
|
// TODO: add document.createRange().createContextualFragment()
|
||||||
|
|
||||||
childNodes: [],
|
childNodes: [],
|
||||||
|
|
||||||
|
|
@ -255,4 +262,4 @@ window.mock = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
return window
|
return window
|
||||||
})()
|
})(this)
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ describe("m.mount()", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("reloads components correctly", function () {
|
it("reloads components correctly", function () {
|
||||||
|
if (mock.phantom) return
|
||||||
|
|
||||||
mock.requestAnimationFrame.$resolve()
|
mock.requestAnimationFrame.$resolve()
|
||||||
|
|
||||||
var root1 = mock.document.createElement("div")
|
var root1 = mock.document.createElement("div")
|
||||||
|
|
@ -545,6 +547,8 @@ describe("m.mount()", function () {
|
||||||
|
|
||||||
// https://github.com/lhorie/mithril.js/issues/551
|
// https://github.com/lhorie/mithril.js/issues/551
|
||||||
it("only redraws a component when clicked", function () {
|
it("only redraws a component when clicked", function () {
|
||||||
|
if (mock.phantom) return
|
||||||
|
|
||||||
var root = mock.document.createElement("div")
|
var root = mock.document.createElement("div")
|
||||||
var a = false
|
var a = false
|
||||||
var found = {}
|
var found = {}
|
||||||
|
|
@ -627,6 +631,8 @@ describe("m.mount()", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("redraws when clicked and click handler forces redraw", function () {
|
it("redraws when clicked and click handler forces redraw", function () {
|
||||||
|
if (mock.phantom) return
|
||||||
|
|
||||||
var root = mock.document.createElement("div")
|
var root = mock.document.createElement("div")
|
||||||
var view = sinon.stub().returns(m("div", {
|
var view = sinon.stub().returns(m("div", {
|
||||||
onclick: function () { m.redraw(true) }
|
onclick: function () { m.redraw(true) }
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ describe("m.redraw()", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("runs unnecessary redraws asynchronously", function () {
|
it("runs unnecessary redraws asynchronously", function () {
|
||||||
|
if (mock.phantom) return
|
||||||
|
|
||||||
var root = mock.document.createElement("div")
|
var root = mock.document.createElement("div")
|
||||||
var view = sinon.spy()
|
var view = sinon.spy()
|
||||||
|
|
||||||
|
|
@ -196,6 +198,8 @@ describe("m.redraw()", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
dit("recreates the component when \"all\"", function (root) {
|
dit("recreates the component when \"all\"", function (root) {
|
||||||
|
if (mock.phantom) return
|
||||||
|
|
||||||
var count = 0
|
var count = 0
|
||||||
function config(el, init) {
|
function config(el, init) {
|
||||||
if (!init) count++
|
if (!init) count++
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue