forked from madrobby/zepto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathios3.html
More file actions
62 lines (54 loc) · 1.57 KB
/
Copy pathios3.html
File metadata and controls
62 lines (54 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!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 iOS3 unit tests</title>
<script src="../vendor/evidence.js"></script>
<script src="evidence_runner.js"></script> <script>
// avoid caching
(function(){
function load(scripts){
scripts.split(' ').forEach(function(script){
document.write('<script src="../src/'+script+'.js?'+(+new Date)+'"></scr'+'ipt>')
})
}
load('ios3 zepto ie')
})()
</script>
</head>
<body>
<h1>Zepto iOS3 unit 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())
t.assertEqual("bl \n ah", " bl \n ah ".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>