Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (45 sloc) 1.354 kB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="test.css">
<title>Zepto compatibility unit tests</title>
<script src="../vendor/evidence.js"></script>
<script src="evidence_runner.js"></script>
<script src="../src/polyfill.js"></script>
<script src="../src/zepto.js"></script>
</head>
<body>
<h1>Compatibility tests</h1>
<p id="results">
Running… see browser console for results
</p>
<script>
(function(){
Evidence('PolyfillTest', {
// test to see if we augment String.prototype.trim if not supported natively
testTrim: function(t){
t.assertEqual("blah", " blah ".trim())
},
// test to see if we augment Array.prototype.reduceif not supported natively
testReduce: function(t){
t.assertEqual(
10,
[0,1,2,3,4].reduce(function(p,c){ return p+c })
)
t.assertEqual(
20,
[0,1,2,3,4].reduce(function(p,c){ return p+c }, 10)
)
var flattened = [[0,1], [2,3], [4,5]].reduce(function(a,b){
return a.concat(b)
})
t.assertEqual(6, flattened.length)
for(var i=0;i<6;i++) t.assertEqual(i, flattened[i])
}
})
})()
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.