forked from madrobby/zepto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.html
More file actions
73 lines (61 loc) · 1.79 KB
/
Copy pathstack.html
File metadata and controls
73 lines (61 loc) · 1.79 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
63
64
65
66
67
68
69
70
71
72
73
<!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 Stack 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('zepto stack ie')
})()
</script>
</head>
<body>
<h1>Zepto Stack unit tests</h1>
<p id="results">
Running… see browser console for results
</p>
<div id="fixtures">
<div id="end_test">
<div class="end_one"><b><span></span></b></div>
<div class="end_two"><b><span>1</span><span>2</span></b></div>
</div>
<div id="andself_test">
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
<div class="four"></div>
</div>
</div><!-- fixtures -->
<script>
(function(){
Evidence('ZeptoTest', {
testEnd: function (t) {
t.assert($().end().length == 0)
var $endTest = $('#end_test')
var $endTest2 = $('#end_test').find('div').find('span').end().end()
t.assertEqual($endTest.length, $endTest2.length)
t.assertEqual($endTest.get(0), $endTest2.get(0))
},
testAndSelf: function (t) {
var testDiv = $('#andself_test'),
secondEl = $('.two', testDiv),
thirdEl = $('.three', testDiv),
nextAndSelf = secondEl.next().andSelf()
t.assert(secondEl.get(0), nextAndSelf.get(0))
t.assert(thirdEl.get(0), nextAndSelf.get(1))
}
})
})()
</script>
</body>
</html>