Add editorconfig, resolve differences

This includes newlines, tabs, among other things.
This commit is contained in:
impinball 2016-06-18 02:59:42 -04:00
parent 80d0a69dab
commit b4fb21475c
90 changed files with 1707 additions and 1701 deletions

View file

@ -4,30 +4,30 @@ var o = require("../../ospec/ospec")
var pushStateMock = require("../../test-utils/pushStateMock")
o.spec("pushStateMock", function() {
var $window
o.beforeEach(function() {
$window = pushStateMock()
})
o.spec("initial state", function() {
o("has url on page load", function() {
o($window.location.href).equals("http://localhost/")
})
})
o.spec("set href", function() {
o("changes url on location.href change", function() {
var old = $window.location.href
$window.location.href = "http://localhost/a"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a")
})
o("changes url on relative location.href change", function() {
var old = $window.location.href
$window.location.href = "a"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a")
o($window.location.pathname).equals("/a")
@ -36,7 +36,7 @@ o.spec("pushStateMock", function() {
$window.location.href = "a"
var old = $window.location.href
$window.location.href = ".."
o(old).equals("http://localhost/a")
o($window.location.href).equals("http://localhost/")
o($window.location.pathname).equals("/")
@ -45,7 +45,7 @@ o.spec("pushStateMock", function() {
$window.location.href = "a/b/c"
var old = $window.location.href
$window.location.href = ".."
o(old).equals("http://localhost/a/b/c")
o($window.location.href).equals("http://localhost/a")
o($window.location.pathname).equals("/a")
@ -53,7 +53,7 @@ o.spec("pushStateMock", function() {
o("does not change url on dotdot location.href change from root", function() {
var old = $window.location.href
$window.location.href = ".."
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/")
o($window.location.pathname).equals("/")
@ -62,7 +62,7 @@ o.spec("pushStateMock", function() {
var old = $window.location.href
$window.location.href = "a"
$window.location.href = "./b"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/b")
o($window.location.pathname).equals("/b")
@ -71,7 +71,7 @@ o.spec("pushStateMock", function() {
var old = $window.location.href
$window.location.href = "a"
$window.location.href = "."
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a")
o($window.location.pathname).equals("/a")
@ -79,7 +79,7 @@ o.spec("pushStateMock", function() {
o("changes url on hash-only location.href change", function() {
var old = $window.location.href
$window.location.href = "#a"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/#a")
o($window.location.hash).equals("#a")
@ -87,7 +87,7 @@ o.spec("pushStateMock", function() {
o("changes url on search-only location.href change", function() {
var old = $window.location.href
$window.location.href = "?a"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/?a")
o($window.location.search).equals("?a")
@ -95,7 +95,7 @@ o.spec("pushStateMock", function() {
o("changes hash on location.href change", function() {
var old = $window.location.href
$window.location.href = "http://localhost/a#b"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a#b")
o($window.location.hash).equals("#b")
@ -103,7 +103,7 @@ o.spec("pushStateMock", function() {
o("changes search on location.href change", function() {
var old = $window.location.href
$window.location.href = "http://localhost/a?b"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a?b")
o($window.location.search).equals("?b")
@ -111,7 +111,7 @@ o.spec("pushStateMock", function() {
o("changes search and hash on location.href change", function() {
var old = $window.location.href
$window.location.href = "http://localhost/a?b#c"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a?b#c")
o($window.location.search).equals("?b")
@ -120,7 +120,7 @@ o.spec("pushStateMock", function() {
o("handles search with search and hash", function() {
var old = $window.location.href
$window.location.href = "http://localhost/a?b?c#d"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a?b?c#d")
o($window.location.search).equals("?b?c")
@ -129,7 +129,7 @@ o.spec("pushStateMock", function() {
o("handles hash with search and hash", function() {
var old = $window.location.href
$window.location.href = "http://localhost/a#b?c#d"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a#b?c#d")
o($window.location.search).equals("")
@ -140,7 +140,7 @@ o.spec("pushStateMock", function() {
o("changes url on location.search change", function() {
var old = $window.location.href
$window.location.search = "?b"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/?b")
o($window.location.search).equals("?b")
@ -150,7 +150,7 @@ o.spec("pushStateMock", function() {
o("changes url on location.hash change", function() {
var old = $window.location.href
$window.location.hash = "#b"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/#b")
o($window.location.hash).equals("#b")
@ -160,7 +160,7 @@ o.spec("pushStateMock", function() {
o("changes url on location.pathname change", function() {
var old = $window.location.href
$window.location.pathname = "/a"
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a")
o($window.location.pathname).equals("/a")
@ -181,7 +181,7 @@ o.spec("pushStateMock", function() {
o("setting origin changes href", function() {
var old = $window.location.href
$window.location.port = "81"
o(old).equals("http://localhost/")
o($window.location.port).equals("81")
o($window.location.href).equals("http://localhost:81/")
@ -191,7 +191,7 @@ o.spec("pushStateMock", function() {
o("setting hostname changes href", function() {
var old = $window.location.href
$window.location.hostname = "127.0.0.1"
o(old).equals("http://localhost/")
o($window.location.hostname).equals("127.0.0.1")
o($window.location.href).equals("http://127.0.0.1/")
@ -201,7 +201,7 @@ o.spec("pushStateMock", function() {
o("setting origin is ignored", function() {
var old = $window.location.href
$window.location.origin = "http://127.0.0.1"
o(old).equals("http://localhost/")
o($window.location.origin).equals("http://localhost")
})
@ -210,7 +210,7 @@ o.spec("pushStateMock", function() {
o("setting host is ignored", function() {
var old = $window.location.href
$window.location.host = "http://127.0.0.1"
o(old).equals("http://localhost/")
o($window.location.host).equals("localhost")
})
@ -219,14 +219,14 @@ o.spec("pushStateMock", function() {
o("changes url on pushstate", function() {
var old = $window.location.href
$window.history.pushState(null, null, "http://localhost/a")
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/a")
})
o("changes search on pushstate", function() {
var old = $window.location.href
$window.history.pushState(null, null, "http://localhost/?a")
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/?a")
o($window.location.search).equals("?a")
@ -234,7 +234,7 @@ o.spec("pushStateMock", function() {
o("changes search on relative pushstate", function() {
var old = $window.location.href
$window.history.pushState(null, null, "?a")
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/?a")
o($window.location.search).equals("?a")
@ -242,7 +242,7 @@ o.spec("pushStateMock", function() {
o("changes hash on pushstate", function() {
var old = $window.location.href
$window.history.pushState(null, null, "http://localhost/#a")
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/#a")
o($window.location.hash).equals("#a")
@ -250,7 +250,7 @@ o.spec("pushStateMock", function() {
o("changes hash on relative pushstate", function() {
var old = $window.location.href
$window.history.pushState(null, null, "#a")
o(old).equals("http://localhost/")
o($window.location.href).equals("http://localhost/#a")
o($window.location.hash).equals("#a")
@ -260,14 +260,14 @@ o.spec("pushStateMock", function() {
o("history.back() without history does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("history.back() after pushstate triggers onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.pushState(null, null, "http://localhost/a")
$window.history.back()
o($window.onpopstate.callCount).equals(1)
o($window.onpopstate.args[0].type).equals("popstate")
})
@ -275,63 +275,63 @@ o.spec("pushStateMock", function() {
$window.onpopstate = o.spy()
$window.history.pushState(null, null, "a")
$window.history.back()
o($window.onpopstate.callCount).equals(1)
})
o("history.back() after search pushstate triggers onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.pushState(null, null, "http://localhost/?a")
$window.history.back()
o($window.onpopstate.callCount).equals(1)
})
o("history.back() after relative search pushstate triggers onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.pushState(null, null, "?a")
$window.history.back()
o($window.onpopstate.callCount).equals(1)
})
o("history.back() after hash pushstate triggers onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.pushState(null, null, "http://localhost/#a")
$window.history.back()
o($window.onpopstate.callCount).equals(1)
})
o("history.back() after relative hash pushstate triggers onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.pushState(null, null, "#a")
$window.history.back()
o($window.onpopstate.callCount).equals(1)
})
o("history.back() after replacestate does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.replaceState(null, null, "http://localhost/a")
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("history.back() after relative replacestate does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.replaceState(null, null, "a")
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("history.back() after relative search replacestate does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.replaceState(null, null, "?a")
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("history.back() after relative hash replacestate does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.replaceState(null, null, "#a")
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("history.forward() after pushstate triggers onpopstate", function() {
@ -339,7 +339,7 @@ o.spec("pushStateMock", function() {
$window.history.pushState(null, null, "http://localhost/a")
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(2)
})
o("history.forward() after relative pushstate triggers onpopstate", function() {
@ -347,7 +347,7 @@ o.spec("pushStateMock", function() {
$window.history.pushState(null, null, "a")
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(2)
})
o("history.forward() after search pushstate triggers onpopstate", function() {
@ -355,7 +355,7 @@ o.spec("pushStateMock", function() {
$window.history.pushState(null, null, "http://localhost/?a")
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(2)
})
o("history.forward() after relative search pushstate triggers onpopstate", function() {
@ -363,7 +363,7 @@ o.spec("pushStateMock", function() {
$window.history.pushState(null, null, "?a")
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(2)
})
o("history.forward() after hash pushstate triggers onpopstate", function() {
@ -371,7 +371,7 @@ o.spec("pushStateMock", function() {
$window.history.pushState(null, null, "http://localhost/#a")
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(2)
})
o("history.forward() after relative hash pushstate triggers onpopstate", function() {
@ -379,33 +379,33 @@ o.spec("pushStateMock", function() {
$window.history.pushState(null, null, "#a")
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(2)
})
o("history.back() without history does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("history.forward() without history does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.forward()
o($window.onpopstate.callCount).equals(0)
})
o("history navigation without history does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.back()
$window.history.forward()
o($window.onpopstate.callCount).equals(0)
})
o("reverse history navigation without history does not trigger onpopstate", function() {
$window.onpopstate = o.spy()
$window.history.forward()
$window.history.back()
o($window.onpopstate.callCount).equals(0)
})
o("onpopstate has correct url during call", function(done) {
@ -422,47 +422,47 @@ o.spec("pushStateMock", function() {
o("onhashchange triggers on location.href change", function() {
$window.onhashchange = o.spy()
$window.location.href = "http://localhost/#a"
o($window.onhashchange.callCount).equals(1)
o($window.onhashchange.args[0].type).equals("hashchange")
})
o("onhashchange triggers on relative location.href change", function() {
$window.onhashchange = o.spy()
$window.location.href = "#a"
o($window.onhashchange.callCount).equals(1)
})
o("onhashchange triggers on location.hash change", function() {
$window.onhashchange = o.spy()
$window.location.hash = "#a"
o($window.onhashchange.callCount).equals(1)
})
o("onhashchange does not trigger on page change", function() {
$window.onhashchange = o.spy()
$window.location.href = "http://localhost/a"
o($window.onhashchange.callCount).equals(0)
})
o("onhashchange does not trigger on page change with different hash", function() {
$window.location.href = "http://localhost/#a"
$window.onhashchange = o.spy()
$window.location.href = "http://localhost/a#b"
o($window.onhashchange.callCount).equals(0)
})
o("onhashchange does not trigger on page change with same hash", function() {
$window.location.href = "http://localhost/#b"
$window.onhashchange = o.spy()
$window.location.href = "http://localhost/a#b"
o($window.onhashchange.callCount).equals(0)
})
o("onhashchange triggers on history.back()", function() {
$window.location.href = "#a"
$window.onhashchange = o.spy()
$window.history.back()
o($window.onhashchange.callCount).equals(1)
})
o("onhashchange triggers on history.forward()", function() {
@ -470,7 +470,7 @@ o.spec("pushStateMock", function() {
$window.onhashchange = o.spy()
$window.history.back()
$window.history.forward()
o($window.onhashchange.callCount).equals(2)
})
o("onhashchange does not trigger on history.back() that causes page change with different hash", function() {
@ -478,7 +478,7 @@ o.spec("pushStateMock", function() {
$window.location.href = "a#b"
$window.onhashchange = o.spy()
$window.history.back()
o($window.onhashchange.callCount).equals(0)
})
o("onhashchange does not trigger on history.back() that causes page change with same hash", function() {
@ -486,7 +486,7 @@ o.spec("pushStateMock", function() {
$window.location.href = "a#a"
$window.onhashchange = o.spy()
$window.history.back()
o($window.onhashchange.callCount).equals(0)
})
o("onhashchange does not trigger on history.forward() that causes page change with different hash", function() {
@ -495,7 +495,7 @@ o.spec("pushStateMock", function() {
$window.onhashchange = o.spy()
$window.history.back()
$window.history.forward()
o($window.onhashchange.callCount).equals(0)
})
o("onhashchange does not trigger on history.forward() that causes page change with same hash", function() {
@ -504,7 +504,7 @@ o.spec("pushStateMock", function() {
$window.onhashchange = o.spy()
$window.history.back()
$window.history.forward()
o($window.onhashchange.callCount).equals(0)
})
})
@ -512,45 +512,45 @@ o.spec("pushStateMock", function() {
o("onunload triggers on location.href change", function() {
$window.onunload = o.spy()
$window.location.href = "http://localhost/a"
o($window.onunload.callCount).equals(1)
o($window.onunload.args[0].type).equals("unload")
})
o("onunload triggers on relative location.href change", function() {
$window.onunload = o.spy()
$window.location.href = "a"
o($window.onunload.callCount).equals(1)
})
o("onunload triggers on search change via location.href", function() {
$window.onunload = o.spy()
$window.location.href = "http://localhost/?a"
o($window.onunload.callCount).equals(1)
})
o("onunload triggers on relative search change via location.href", function() {
$window.onunload = o.spy()
$window.location.href = "?a"
o($window.onunload.callCount).equals(1)
})
o("onunload does not trigger on hash change via location.href", function() {
$window.onunload = o.spy()
$window.location.href = "http://localhost/#a"
o($window.onunload.callCount).equals(0)
})
o("onunload does not trigger on relative hash change via location.href", function() {
$window.onunload = o.spy()
$window.location.href = "#a"
o($window.onunload.callCount).equals(0)
})
o("onunload does not trigger on hash-only history.back()", function() {
$window.location.href = "#a"
$window.onunload = o.spy()
$window.history.back()
o($window.onunload.callCount).equals(0)
})
o("onunload does not trigger on hash-only history.forward()", function() {
@ -558,7 +558,7 @@ o.spec("pushStateMock", function() {
$window.history.back()
$window.onunload = o.spy()
$window.history.forward()
o($window.onunload.callCount).equals(0)
})
o("onunload has correct url during call via location.href change", function(done) {
@ -576,4 +576,4 @@ o.spec("pushStateMock", function() {
$window.location.search = "?a"
})
})
})
})