Test isSupported

kind of stupid, but I don't want to maintain a list of browser UA or
whatever.
This commit is contained in:
Maxime Thirouin
2014-05-05 08:36:12 +02:00
parent 8c05692004
commit d5395c3d07
2 changed files with 16 additions and 0 deletions

View 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 isnt reliable on iOS until 5.
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/)
}

View 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()
})