Merge pull request #828 from impinball/lint

Lint Mithril main
This commit is contained in:
Leo Horie 2015-11-03 09:51:07 -05:00
commit df114a4ee2
9 changed files with 1781 additions and 1044 deletions

View file

@ -7,6 +7,3 @@ mithril.closure-compiler-externs.js
# This is merely a dependency for the documentation.
docs/layout/lib
# TODO: These are temporary, and need to be eventually enabled.
mithril.js

View file

@ -70,7 +70,7 @@
"object-curly-spacing": 2,
"one-var": [2, {"initialized": "never"}],
"operator-assignment": 2,
"operator-linebreak": 2,
"operator-linebreak": [2, "after"],
"padded-blocks": [2, "never"],
"quote-props": [2, "as-needed"],
"quotes": [2, "double", "avoid-escape"],

View file

@ -88,9 +88,7 @@ module.exports = function (grunt) { // eslint-disable-line
"!archive/**",
"!deploy/**",
"!mithril.closure-compiler-externs.js",
"!docs/layout/lib/**",
// TODO(impinball): Finish this.
"!mithril.js"
"!docs/layout/lib/**"
]
},

2785
mithril.js

File diff suppressed because it is too large Load diff

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

View file

@ -41,12 +41,19 @@
/* eslint-enable no-extend-native */
})()
window.mock = (function () {
this.mock = (function (global) {
"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 = {
// FIXME: add document.createRange().createContextualFragment()
// TODO: add document.createRange().createContextualFragment()
childNodes: [],
@ -255,4 +262,4 @@ window.mock = (function () {
}
return window
})()
})(this)

View file

@ -54,6 +54,8 @@ describe("m.mount()", function () {
})
it("reloads components correctly", function () {
if (mock.phantom) return
mock.requestAnimationFrame.$resolve()
var root1 = mock.document.createElement("div")
@ -545,6 +547,8 @@ describe("m.mount()", function () {
// https://github.com/lhorie/mithril.js/issues/551
it("only redraws a component when clicked", function () {
if (mock.phantom) return
var root = mock.document.createElement("div")
var a = false
var found = {}
@ -627,6 +631,8 @@ describe("m.mount()", function () {
})
it("redraws when clicked and click handler forces redraw", function () {
if (mock.phantom) return
var root = mock.document.createElement("div")
var view = sinon.stub().returns(m("div", {
onclick: function () { m.redraw(true) }

View file

@ -31,6 +31,8 @@ describe("m.redraw()", function () {
})
it("runs unnecessary redraws asynchronously", function () {
if (mock.phantom) return
var root = mock.document.createElement("div")
var view = sinon.spy()
@ -196,6 +198,8 @@ describe("m.redraw()", function () {
})
dit("recreates the component when \"all\"", function (root) {
if (mock.phantom) return
var count = 0
function config(el, init) {
if (!init) count++