Test isSupported
kind of stupid, but I don't want to maintain a list of browser UA or whatever.
This commit is contained in:
8
src/scripts/lib/is-supported.js
Normal file
8
src/scripts/lib/is-supported.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = function() {
|
||||||
|
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||||||
|
return window.history &&
|
||||||
|
window.history.pushState &&
|
||||||
|
window.history.replaceState &&
|
||||||
|
// pushState isn’t reliable on iOS until 5.
|
||||||
|
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/)
|
||||||
|
}
|
||||||
8
tests/scripts/lib/is-supported.js
Normal file
8
tests/scripts/lib/is-supported.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
var tape = require("tape")
|
||||||
|
|
||||||
|
var isSupported = require("../../../src/scripts/lib/is-supported.js")
|
||||||
|
|
||||||
|
tape("test isSupported method", function(t) {
|
||||||
|
t.true(isSupported(), "well, we run test on supported browser, so it should be ok here")
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user