unit test init

This commit is contained in:
pangxie1991
2017-03-02 17:30:55 +08:00
parent bd24b22203
commit c1b215cb94
112 changed files with 18189 additions and 1 deletions
@@ -0,0 +1,97 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for packages/waterfall/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> packages/waterfall/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y'>
<span class="strong">1 branch</span>
<span class="quiet">Ignored</span> &nbsp;&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 02 2017 17:21:26 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
@@ -0,0 +1,81 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for packages/waterfall/index.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">all files</a> / <a href="index.html">packages/waterfall/</a> index.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y'>
<span class="strong">1 branch</span>
<span class="quiet">Ignored</span> &nbsp;&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Waterfall from './src/main.js';
&nbsp;
export default Waterfall;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 02 2017 17:21:26 GMT+0800 (CST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
@@ -0,0 +1,354 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for packages/waterfall/src/directive.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">all files</a> / <a href="index.html">packages/waterfall/src/</a> directive.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">20.37% </span>
<span class="quiet">Statements</span>
<span class='fraction'>11/54</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">15.38% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/26</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">22.22% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">14.58% </span>
<span class="quiet">Lines</span>
<span class='fraction'>7/48</span>
</div>
<div class='fl pad1y'>
<span class="strong">1 branch</span>
<span class="quiet">Ignored</span> &nbsp;&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Utils from './utils.js';
&nbsp;
const CONTEXT = '@@Waterfall';
const OFFSET = 300;
&nbsp;
// 绑定事件到元素上
// 读取基本的控制变量
<span class="fstat-no" title="function not covered" >function doBindEvent() <span class="cstat-no" title="statement not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > t</span>his.scrollEventListener = Utils.debounce(handleScrollEvent.bind(this), 200);
<span class="cstat-no" title="statement not covered" > t</span>his.scrollEventTarget = Utils.getScrollEventTarget(this.el);
&nbsp;
<span class="cstat-no" title="statement not covered" > v</span>ar disabledExpr = this.el.getAttribute('waterfall-disabled');
<span class="cstat-no" title="statement not covered" > v</span>ar disabled = false;
<span class="cstat-no" title="statement not covered" > if (disabledExpr) {</span>
<span class="cstat-no" title="statement not covered" > t</span>his.vm.$watch(disabledExpr, <span class="fstat-no" title="function not covered" >(value) =&gt; {</span>
<span class="cstat-no" title="statement not covered" > t</span>his.disabled = value;
});
<span class="cstat-no" title="statement not covered" > d</span>isabled = Boolean(this.vm[disabledExpr]);
}
<span class="cstat-no" title="statement not covered" > t</span>his.disabled = disabled;
&nbsp;
<span class="cstat-no" title="statement not covered" > v</span>ar offset = this.el.getAttribute('waterfall-offset');
<span class="cstat-no" title="statement not covered" > t</span>his.offset = Number(offset) || OFFSET;
&nbsp;
<span class="cstat-no" title="statement not covered" > t</span>his.scrollEventTarget.addEventListener('scroll', this.scrollEventListener);
&nbsp;
<span class="cstat-no" title="statement not covered" > t</span>his.scrollEventListener();
}
&nbsp;
// 处理滚动函数
<span class="fstat-no" title="function not covered" >function handleScrollEvent() {</span>
<span class="cstat-no" title="statement not covered" > l</span>et element = this.el;
<span class="cstat-no" title="statement not covered" > l</span>et scrollEventTarget = this.scrollEventTarget;
&nbsp;
// 已被禁止的滚动处理
<span class="cstat-no" title="statement not covered" > if (this.disabled) <span class="cstat-no" title="statement not covered" >r</span></span>eturn;
&nbsp;
<span class="cstat-no" title="statement not covered" > l</span>et targetScrollTop = Utils.getScrollTop(scrollEventTarget);
<span class="cstat-no" title="statement not covered" > l</span>et targetBottom = targetScrollTop + Utils.getVisibleHeight(scrollEventTarget);
&nbsp;
// 判断是否到了底
<span class="cstat-no" title="statement not covered" > l</span>et needLoadMoreToLower = false;
<span class="cstat-no" title="statement not covered" > if (element === scrollEventTarget) {</span>
<span class="cstat-no" title="statement not covered" > n</span>eedLoadMoreToLower = scrollEventTarget.scollHeight - targetBottom &lt; this.offset;
} else {
<span class="cstat-no" title="statement not covered" > l</span>et elementBottom = Utils.getElementTop(element) - Utils.getElementTop(scrollEventTarget) + Utils.getVisibleHeight(element);
<span class="cstat-no" title="statement not covered" > n</span>eedLoadMoreToLower = elementBottom - Utils.getVisibleHeight(scrollEventTarget) &lt; this.offset;
}
<span class="cstat-no" title="statement not covered" > if (needLoadMoreToLower) {</span>
<span class="cstat-no" title="statement not covered" > t</span>his.cb['lower'] &amp;&amp; this.cb['lower']({ target: scrollEventTarget, top: targetScrollTop });
}
&nbsp;
// 判断是否到了顶
<span class="cstat-no" title="statement not covered" > l</span>et needLoadMoreToUpper = false;
<span class="cstat-no" title="statement not covered" > if (element === scrollEventTarget) {</span>
<span class="cstat-no" title="statement not covered" > n</span>eedLoadMoreToUpper = targetScrollTop &lt; this.offset;
} else {
<span class="cstat-no" title="statement not covered" > l</span>et elementTop = Utils.getElementTop(element) - Utils.getElementTop(scrollEventTarget);
<span class="cstat-no" title="statement not covered" > n</span>eedLoadMoreToUpper = elementTop + this.offset &gt; 0;
}
<span class="cstat-no" title="statement not covered" > if (needLoadMoreToUpper) {</span>
<span class="cstat-no" title="statement not covered" > t</span>his.cb['upper'] &amp;&amp; this.cb['upper']({ target: scrollEventTarget, top: targetScrollTop });
}
}
&nbsp;
export default function(type) {
return <span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" >{</span></span></span>
bind(el, binding, vnode) {
<span class="cstat-no" title="statement not covered" > if (!el[CONTEXT]) {</span>
<span class="cstat-no" title="statement not covered" > e</span>l[CONTEXT] = {
el,
vm: vnode.context,
cb: {}
};
}
<span class="cstat-no" title="statement not covered" > e</span>l[CONTEXT].cb[type] = binding.value;
&nbsp;
<span class="cstat-no" title="statement not covered" > v</span>node.context.$on('hook:mounted', <span class="fstat-no" title="function not covered" >function() {</span>
<span class="cstat-no" title="statement not covered" > if (Utils.isAttached(el)) {</span>
<span class="cstat-no" title="statement not covered" > d</span>oBindEvent.call(el[CONTEXT]);
}
});
},
&nbsp;
update(el) {
<span class="cstat-no" title="statement not covered" > e</span>l[CONTEXT].scrollEventListener();
},
&nbsp;
unbind(el) {
<span class="cstat-no" title="statement not covered" > c</span>onst context = el[CONTEXT];
<span class="cstat-no" title="statement not covered" > c</span>ontext.scrollEventTarget.removeEventListener('scroll', context.scrollEventListener);
}
};
};
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 02 2017 17:21:26 GMT+0800 (CST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>
@@ -0,0 +1,123 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for packages/waterfall/src/</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">all files</a> packages/waterfall/src/
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">25.47% </span>
<span class="quiet">Statements</span>
<span class='fraction'>27/106</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">16.67% </span>
<span class="quiet">Branches</span>
<span class='fraction'>9/54</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">21.05% </span>
<span class="quiet">Functions</span>
<span class='fraction'>4/19</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">18.09% </span>
<span class="quiet">Lines</span>
<span class='fraction'>17/94</span>
</div>
<div class='fl pad1y'>
<span class="strong">1 branch</span>
<span class="quiet">Ignored</span> &nbsp;&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
<div class='status-line low'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file low" data-value="directive.js"><a href="directive.js.html">directive.js</a></td>
<td data-value="20.37" class="pic low"><div class="chart"><div class="cover-fill" style="width: 20%;"></div><div class="cover-empty" style="width:80%;"></div></div></td>
<td data-value="20.37" class="pct low">20.37%</td>
<td data-value="54" class="abs low">11/54</td>
<td data-value="15.38" class="pct low">15.38%</td>
<td data-value="26" class="abs low">4/26</td>
<td data-value="22.22" class="pct low">22.22%</td>
<td data-value="9" class="abs low">2/9</td>
<td data-value="14.58" class="pct low">14.58%</td>
<td data-value="48" class="abs low">7/48</td>
</tr>
<tr>
<td class="file high" data-value="main.js"><a href="main.js.html">main.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">14/14</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="6" class="abs high">5/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="9" class="abs high">9/9</td>
</tr>
<tr>
<td class="file low" data-value="utils.js"><a href="utils.js.html">utils.js</a></td>
<td data-value="5.26" class="pic low"><div class="chart"><div class="cover-fill" style="width: 5%;"></div><div class="cover-empty" style="width:95%;"></div></div></td>
<td data-value="5.26" class="pct low">5.26%</td>
<td data-value="38" class="abs low">2/38</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="22" class="abs low">0/22</td>
<td data-value="0" class="pct low">0%</td>
<td data-value="8" class="abs low">0/8</td>
<td data-value="2.7" class="pct low">2.7%</td>
<td data-value="37" class="abs low">1/37</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 02 2017 17:21:26 GMT+0800 (CST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>
@@ -0,0 +1,110 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for packages/waterfall/src/main.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">all files</a> / <a href="index.html">packages/waterfall/src/</a> main.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>14/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">83.33% </span>
<span class="quiet">Branches</span>
<span class='fraction'>5/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>9/9</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import Waterfall from './directive.js';
import Vue from 'vue';
&nbsp;
const install = function(Vue) {
Vue.directive('WaterfallLower', Waterfall('lower'));
Vue.directive('WaterfallUpper', Waterfall('upper'));
};
&nbsp;
<span class="missing-if-branch" title="else path not taken" >E</span>if (!Vue.prototype.$isServer) {
Vue.use(install);
}
&nbsp;
Waterfall.install = install;
export default Waterfall;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 02 2017 17:21:26 GMT+0800 (CST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>
@@ -0,0 +1,293 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for packages/waterfall/src/utils.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">all files</a> / <a href="index.html">packages/waterfall/src/</a> utils.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">5.26% </span>
<span class="quiet">Statements</span>
<span class='fraction'>2/38</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">2.7% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1/37</span>
</div>
</div>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">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
74
75
76
77</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">export default <span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" >{</span></span></span></span></span></span>
debounce(func, wait, immediate) {
<span class="cstat-no" title="statement not covered" > v</span>ar timeout, args, context, timestamp, result;
<span class="cstat-no" title="statement not covered" > r</span>eturn <span class="fstat-no" title="function not covered" >function() {</span>
<span class="cstat-no" title="statement not covered" > c</span>ontext = this;
<span class="cstat-no" title="statement not covered" > a</span>rgs = arguments;
<span class="cstat-no" title="statement not covered" > t</span>imestamp = new Date();
<span class="cstat-no" title="statement not covered" > v</span>ar later = <span class="fstat-no" title="function not covered" >function() {</span>
<span class="cstat-no" title="statement not covered" > v</span>ar last = (new Date()) - timestamp;
<span class="cstat-no" title="statement not covered" > if (last &lt; wait) {</span>
<span class="cstat-no" title="statement not covered" > t</span>imeout = setTimeout(later, wait - last);
} else {
<span class="cstat-no" title="statement not covered" > t</span>imeout = null;
<span class="cstat-no" title="statement not covered" > r</span>esult = func.apply(context, args);
}
};
<span class="cstat-no" title="statement not covered" > if (!timeout) {</span>
<span class="cstat-no" title="statement not covered" > t</span>imeout = setTimeout(later, wait);
}
<span class="cstat-no" title="statement not covered" > r</span>eturn result;
};
},
&nbsp;
// 找到最近的触发滚动事件的元素
getScrollEventTarget(element) {
<span class="cstat-no" title="statement not covered" > v</span>ar currentNode = element;
// bugfix, see http://w3help.org/zh-cn/causes/SD9013 and http://stackoverflow.com/questions/17016740/onscroll-function-is-not-working-for-chrome
<span class="cstat-no" title="statement not covered" > while (currentNode &amp;&amp; currentNode.tagName !== 'HTML' &amp;&amp; currentNode.tagName !== 'BODY' &amp;&amp; currentNode.nodeType === 1) {</span>
<span class="cstat-no" title="statement not covered" > v</span>ar overflowY = this.getComputedStyle(currentNode).overflowY;
<span class="cstat-no" title="statement not covered" > if (overflowY === 'scroll' || overflowY === 'auto') {</span>
<span class="cstat-no" title="statement not covered" > r</span>eturn currentNode;
}
<span class="cstat-no" title="statement not covered" > c</span>urrentNode = currentNode.parentNode;
}
<span class="cstat-no" title="statement not covered" > r</span>eturn window;
},
&nbsp;
// 判断元素是否被加入到页面节点内
isAttached(element) {
<span class="cstat-no" title="statement not covered" > v</span>ar currentNode = element.parentNode;
<span class="cstat-no" title="statement not covered" > while (currentNode) {</span>
<span class="cstat-no" title="statement not covered" > if (currentNode.tagName === 'HTML') {</span>
<span class="cstat-no" title="statement not covered" > r</span>eturn true;
}
<span class="cstat-no" title="statement not covered" > if (currentNode.nodeType === 11) {</span>
<span class="cstat-no" title="statement not covered" > r</span>eturn false;
}
<span class="cstat-no" title="statement not covered" > c</span>urrentNode = currentNode.parentNode;
}
<span class="cstat-no" title="statement not covered" > r</span>eturn false;
},
&nbsp;
// 获取滚动高度
getScrollTop(element) {
<span class="cstat-no" title="statement not covered" > r</span>eturn 'scrollTop' in element ? element.scrollTop : element.pageYOffset;
},
&nbsp;
// 获取元素距离顶部高度
getElementTop(element) {
<span class="cstat-no" title="statement not covered" > if (element === window) {</span>
<span class="cstat-no" title="statement not covered" > r</span>eturn this.getScrollTop(window);
}
<span class="cstat-no" title="statement not covered" > r</span>eturn element.getBoundingClientRect().top + this.getScrollTop(window);
},
&nbsp;
getVisibleHeight(element) {
<span class="cstat-no" title="statement not covered" > if (element === window) {</span>
<span class="cstat-no" title="statement not covered" > r</span>eturn element.innerHeight;
}
&nbsp;
<span class="cstat-no" title="statement not covered" > r</span>eturn element.getBoundingClientRect().height;
},
&nbsp;
getComputedStyle: document.defaultView.getComputedStyle.bind(document.defaultView)
};
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Mar 02 2017 17:21:26 GMT+0800 (CST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
</body>
</html>