forked from w3c/IntersectionObserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
intersection-observer-test.html
66 lines (55 loc) · 1.77 KB
/
intersection-observer-test.html
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
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>IntersectionObserver Tests</title>
<!-- Dependencies -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.5.3/mocha.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/2.5.3/mocha.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/expect.js/0.2.0/expect.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sinon.js/3.2.1/sinon.min.js"></script>
<!-- Polyfills for IE7-8 -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es5,getComputedStyle"></script>
</head>
<body>
<div id="mocha"></div>
<!-- Setup -->
<script>mocha.setup({ui:'bdd'});</script>
<!-- Script under test -->
<script src="intersection-observer.js"></script>
<!-- Tests -->
<script src="intersection-observer-test.js"></script>
<!-- Reporting -->
<script>
var runner = mocha.run();
var failedTests = [];
runner.on('end', function(){
window.mochaResults = runner.stats;
window.mochaResults.reports = failedTests;
});
runner.on('fail', function(test, err){
var flattenTitles = function(test){
var titles = [];
while (test.parent.title){
titles.push(test.parent.title);
test = test.parent;
}
return titles.reverse();
};
failedTests.push({
name: test.title,
result: false,
message: err.message,
stack: err.stack,
titles: flattenTitles(test)
});
});
</script>
</body>
</html>