importHTML helper for jest tests with template import
10 files changed, 165 insertions(+), 157 deletions(-) M ejemplos/mtg-counter/coverage/clover.xml M ejemplos/mtg-counter/coverage/coverage-final.json M ejemplos/mtg-counter/coverage/lcov-report/index.html M ejemplos/mtg-counter/coverage/lcov-report/src/index.html M ejemplos/mtg-counter/coverage/lcov-report/src/mtgPlayer.js.html M ejemplos/mtg-counter/coverage/lcov-report/tests/integration/helpers.js.html M ejemplos/mtg-counter/coverage/lcov-report/tests/integration/index.html M ejemplos/mtg-counter/coverage/lcov.info A ejemplos/mtg-counter/tests/integration/helpers.js M ejemplos/mtg-counter/tests/integration/mtgPlayer.test.js
M ejemplos/mtg-counter/coverage/clover.xml => ejemplos/mtg-counter/coverage/clover.xml +22 -22
@@ 1,35 1,35 @@ <?xml version="1.0" encoding="UTF-8"?> <coverage generated="1630981194100" clover="3.2.0"> <project timestamp="1630981194100" name="All files"> <metrics statements="18" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="6" coveredmethods="1" elements="24" coveredelements="3" complexity="0" loc="18" ncloc="18" packages="2" files="2" classes="2"/> <coverage generated="1630983133300" clover="3.2.0"> <project timestamp="1630983133300" name="All files"> <metrics statements="18" coveredstatements="16" conditionals="0" coveredconditionals="0" methods="5" coveredmethods="3" elements="23" coveredelements="19" complexity="0" loc="18" ncloc="18" packages="2" files="2" classes="2"/> <package name="src"> <metrics statements="17" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="4" coveredmethods="0"/> <metrics statements="17" coveredstatements="15" conditionals="0" coveredconditionals="0" methods="4" coveredmethods="2"/> <file name="mtgPlayer.js" path="/home/me/web/ejemplos/mtg-counter/src/mtgPlayer.js"> <metrics statements="17" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="4" coveredmethods="0"/> <line num="3" count="0" type="stmt"/> <line num="5" count="0" type="stmt"/> <line num="8" count="0" type="stmt"/> <line num="9" count="0" type="stmt"/> <line num="12" count="0" type="stmt"/> <line num="13" count="0" type="stmt"/> <line num="14" count="0" type="stmt"/> <line num="15" count="0" type="stmt"/> <line num="16" count="0" type="stmt"/> <line num="17" count="0" type="stmt"/> <line num="19" count="0" type="stmt"/> <metrics statements="17" coveredstatements="15" conditionals="0" coveredconditionals="0" methods="4" coveredmethods="2"/> <line num="3" count="1" type="stmt"/> <line num="5" count="1" type="stmt"/> <line num="8" count="1" type="stmt"/> <line num="9" count="1" type="stmt"/> <line num="12" count="1" type="stmt"/> <line num="13" count="1" type="stmt"/> <line num="14" count="1" type="stmt"/> <line num="15" count="1" type="stmt"/> <line num="16" count="1" type="stmt"/> <line num="17" count="1" type="stmt"/> <line num="19" count="1" type="stmt"/> <line num="20" count="0" type="stmt"/> <line num="22" count="0" type="stmt"/> <line num="22" count="1" type="stmt"/> <line num="23" count="0" type="stmt"/> <line num="28" count="0" type="stmt"/> <line num="29" count="0" type="stmt"/> <line num="28" count="1" type="stmt"/> <line num="29" count="1" type="stmt"/> <line num="33" count="1" type="stmt"/> </file> </package> <package name="tests.integration"> <metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="2" coveredmethods="1"/> <metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/> <file name="helpers.js" path="/home/me/web/ejemplos/mtg-counter/tests/integration/helpers.js"> <metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="2" coveredmethods="1"/> <line num="2" count="1" type="stmt"/> <metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/> <line num="5" count="1" type="stmt"/> </file> </package> </project>
M ejemplos/mtg-counter/coverage/coverage-final.json => ejemplos/mtg-counter/coverage/coverage-final.json +2 -2
@@ 1,3 1,3 @@ {"/home/me/web/ejemplos/mtg-counter/src/mtgPlayer.js": {"path":"/home/me/web/ejemplos/mtg-counter/src/mtgPlayer.js","statementMap":{"0":{"start":{"line":3,"column":2},"end":{"line":3,"column":36}},"1":{"start":{"line":5,"column":2},"end":{"line":5,"column":16}},"2":{"start":{"line":8,"column":2},"end":{"line":8,"column":47}},"3":{"start":{"line":9,"column":2},"end":{"line":9,"column":56}},"4":{"start":{"line":12,"column":2},"end":{"line":12,"column":55}},"5":{"start":{"line":13,"column":2},"end":{"line":13,"column":38}},"6":{"start":{"line":14,"column":2},"end":{"line":14,"column":55}},"7":{"start":{"line":15,"column":2},"end":{"line":15,"column":38}},"8":{"start":{"line":16,"column":2},"end":{"line":16,"column":60}},"9":{"start":{"line":17,"column":2},"end":{"line":17,"column":64}},"10":{"start":{"line":19,"column":2},"end":{"line":21,"column":5}},"11":{"start":{"line":20,"column":3},"end":{"line":20,"column":41}},"12":{"start":{"line":22,"column":2},"end":{"line":24,"column":5}},"13":{"start":{"line":23,"column":3},"end":{"line":23,"column":41}},"14":{"start":{"line":28,"column":19},"end":{"line":28,"column":83}},"15":{"start":{"line":29,"column":2},"end":{"line":29,"column":40}},"16":{"start":{"line":33,"column":0},"end":{"line":33,"column":47}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}},"loc":{"start":{"line":2,"column":21},"end":{"line":25,"column":2}},"line":2},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":43},"end":{"line":19,"column":44}},"loc":{"start":{"line":19,"column":49},"end":{"line":21,"column":3}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":22,"column":45},"end":{"line":22,"column":46}},"loc":{"start":{"line":22,"column":51},"end":{"line":24,"column":3}},"line":22},"3":{"name":"(anonymous_3)","decl":{"start":{"line":27,"column":1},"end":{"line":27,"column":2}},"loc":{"start":{"line":27,"column":10},"end":{"line":30,"column":2}},"line":27}},"branchMap":{},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":1},"f":{"0":0,"1":0,"2":0,"3":0},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"54b5492a4c64b8a058aff3fa94b1a931d95166b4"} ,"/home/me/web/ejemplos/mtg-counter/tests/integration/helpers.js": {"path":"/home/me/web/ejemplos/mtg-counter/tests/integration/helpers.js","statementMap":{"0":{"start":{"line":2,"column":4},"end":{"line":2,"column":56}},"1":{"start":{"line":2,"column":39},"end":{"line":2,"column":54}}},"fnMap":{"0":{"name":"importHTML","decl":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}},"loc":{"start":{"line":1,"column":31},"end":{"line":3,"column":1}},"line":1},"1":{"name":"(anonymous_1)","decl":{"start":{"line":2,"column":27},"end":{"line":2,"column":28}},"loc":{"start":{"line":2,"column":39},"end":{"line":2,"column":54}},"line":2}},"branchMap":{},"s":{"0":1,"1":0},"f":{"0":1,"1":0},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"1512cc6be5245a9fd4ffb5f76a2a3adbd8fedab9"} {"/home/me/web/ejemplos/mtg-counter/src/mtgPlayer.js": {"path":"/home/me/web/ejemplos/mtg-counter/src/mtgPlayer.js","statementMap":{"0":{"start":{"line":3,"column":2},"end":{"line":3,"column":36}},"1":{"start":{"line":5,"column":2},"end":{"line":5,"column":16}},"2":{"start":{"line":8,"column":2},"end":{"line":8,"column":47}},"3":{"start":{"line":9,"column":2},"end":{"line":9,"column":56}},"4":{"start":{"line":12,"column":2},"end":{"line":12,"column":55}},"5":{"start":{"line":13,"column":2},"end":{"line":13,"column":38}},"6":{"start":{"line":14,"column":2},"end":{"line":14,"column":55}},"7":{"start":{"line":15,"column":2},"end":{"line":15,"column":38}},"8":{"start":{"line":16,"column":2},"end":{"line":16,"column":60}},"9":{"start":{"line":17,"column":2},"end":{"line":17,"column":64}},"10":{"start":{"line":19,"column":2},"end":{"line":21,"column":5}},"11":{"start":{"line":20,"column":3},"end":{"line":20,"column":41}},"12":{"start":{"line":22,"column":2},"end":{"line":24,"column":5}},"13":{"start":{"line":23,"column":3},"end":{"line":23,"column":41}},"14":{"start":{"line":28,"column":19},"end":{"line":28,"column":83}},"15":{"start":{"line":29,"column":2},"end":{"line":29,"column":40}},"16":{"start":{"line":33,"column":0},"end":{"line":33,"column":47}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}},"loc":{"start":{"line":2,"column":21},"end":{"line":25,"column":2}},"line":2},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":43},"end":{"line":19,"column":44}},"loc":{"start":{"line":19,"column":49},"end":{"line":21,"column":3}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":22,"column":45},"end":{"line":22,"column":46}},"loc":{"start":{"line":22,"column":51},"end":{"line":24,"column":3}},"line":22},"3":{"name":"(anonymous_3)","decl":{"start":{"line":27,"column":1},"end":{"line":27,"column":2}},"loc":{"start":{"line":27,"column":10},"end":{"line":30,"column":2}},"line":27}},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":0,"12":1,"13":0,"14":1,"15":1,"16":1},"f":{"0":1,"1":0,"2":0,"3":1},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"54b5492a4c64b8a058aff3fa94b1a931d95166b4"} ,"/home/me/web/ejemplos/mtg-counter/tests/integration/helpers.js": {"path":"/home/me/web/ejemplos/mtg-counter/tests/integration/helpers.js","statementMap":{"0":{"start":{"line":5,"column":4},"end":{"line":5,"column":54}}},"fnMap":{"0":{"name":"importHTML","decl":{"start":{"line":3,"column":9},"end":{"line":3,"column":19}},"loc":{"start":{"line":3,"column":33},"end":{"line":6,"column":1}},"line":3}},"branchMap":{},"s":{"0":1},"f":{"0":1},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"75f2d433019ba727d3ea8bf584ad14cb402c5afb"} }
M ejemplos/mtg-counter/coverage/lcov-report/index.html => ejemplos/mtg-counter/coverage/lcov-report/index.html +24 -24
@@ 23,9 23,9 @@ <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">10.53% </span> <span class="strong">88.89% </span> <span class="quiet">Statements</span> <span class='fraction'>2/19</span> <span class='fraction'>16/18</span> </div> @@ 37,16 37,16 @@ <div class='fl pad1y space-right2'> <span class="strong">16.67% </span> <span class="strong">60% </span> <span class="quiet">Functions</span> <span class='fraction'>1/6</span> <span class='fraction'>3/5</span> </div> <div class='fl pad1y space-right2'> <span class="strong">11.11% </span> <span class="strong">88.89% </span> <span class="quiet">Lines</span> <span class='fraction'>2/18</span> <span class='fraction'>16/18</span> </div> @@ 55,7 55,7 @@ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. </p> </div> <div class='status-line low'></div> <div class='status-line high'></div> <div class="pad1"> <table class="coverage-summary"> @@ <thead> 73,31 73,31 @@ </tr> </thead> <tbody><tr> <td class="file low" data-value="src"><a href="src/index.html">src</a></td> <td data-value="5.88" class="pic low"> <div class="chart"><div class="cover-fill" style="width: 5%"></div><div class="cover-empty" style="width: 95%"></div></div> <td class="file high" data-value="src"><a href="src/index.html">src</a></td> <td data-value="88.24" class="pic high"> <div class="chart"><div class="cover-fill" style="width: 88%"></div><div class="cover-empty" style="width: 12%"></div></div> </td> <td data-value="5.88" class="pct low">5.88%</td> <td data-value="17" class="abs low">1/17</td> <td data-value="88.24" class="pct high">88.24%</td> <td data-value="17" class="abs high">15/17</td> <td data-value="100" class="pct high">100%</td> <td data-value="0" class="abs high">0/0</td> <td data-value="0" class="pct low">0%</td> <td data-value="4" class="abs low">0/4</td> <td data-value="5.88" class="pct low">5.88%</td> <td data-value="17" class="abs low">1/17</td> <td data-value="50" class="pct medium">50%</td> <td data-value="4" class="abs medium">2/4</td> <td data-value="88.24" class="pct high">88.24%</td> <td data-value="17" class="abs high">15/17</td> </tr> <tr> <td class="file medium" data-value="tests/integration"><a href="tests/integration/index.html">tests/integration</a></td> <td data-value="50" class="pic medium"> <div class="chart"><div class="cover-fill" style="width: 50%"></div><div class="cover-empty" style="width: 50%"></div></div> <td class="file high" data-value="tests/integration"><a href="tests/integration/index.html">tests/integration</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="50" class="pct medium">50%</td> <td data-value="2" class="abs medium">1/2</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="0" class="abs high">0/0</td> <td data-value="50" class="pct medium">50%</td> <td data-value="2" class="abs medium">1/2</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="1" class="abs high">1/1</td> @@ </tr> 110,7 110,7 @@ <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Sep 06 2021 23:19:53 GMT-0300 (Chile Summer Time) at Mon Sep 06 2021 23:52:13 GMT-0300 (Chile Summer Time) </div> </div> <script src="prettify.js"></script>
M ejemplos/mtg-counter/coverage/lcov-report/src/index.html => ejemplos/mtg-counter/coverage/lcov-report/src/index.html +17 -17
@@ 23,9 23,9 @@ <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">5.88% </span> <span class="strong">88.24% </span> <span class="quiet">Statements</span> <span class='fraction'>1/17</span> <span class='fraction'>15/17</span> </div> @@ 37,16 37,16 @@ <div class='fl pad1y space-right2'> <span class="strong">0% </span> <span class="strong">50% </span> <span class="quiet">Functions</span> <span class='fraction'>0/4</span> <span class='fraction'>2/4</span> </div> <div class='fl pad1y space-right2'> <span class="strong">5.88% </span> <span class="strong">88.24% </span> <span class="quiet">Lines</span> <span class='fraction'>1/17</span> <span class='fraction'>15/17</span> </div> @@ 55,7 55,7 @@ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. </p> </div> <div class='status-line low'></div> <div class='status-line high'></div> <div class="pad1"> <table class="coverage-summary"> @@ <thead> 73,18 73,18 @@ </tr> </thead> <tbody><tr> <td class="file low" data-value="mtgPlayer.js"><a href="mtgPlayer.js.html">mtgPlayer.js</a></td> <td data-value="5.88" class="pic low"> <div class="chart"><div class="cover-fill" style="width: 5%"></div><div class="cover-empty" style="width: 95%"></div></div> <td class="file high" data-value="mtgPlayer.js"><a href="mtgPlayer.js.html">mtgPlayer.js</a></td> <td data-value="88.24" class="pic high"> <div class="chart"><div class="cover-fill" style="width: 88%"></div><div class="cover-empty" style="width: 12%"></div></div> </td> <td data-value="5.88" class="pct low">5.88%</td> <td data-value="17" class="abs low">1/17</td> <td data-value="88.24" class="pct high">88.24%</td> <td data-value="17" class="abs high">15/17</td> <td data-value="100" class="pct high">100%</td> <td data-value="0" class="abs high">0/0</td> <td data-value="0" class="pct low">0%</td> <td data-value="4" class="abs low">0/4</td> <td data-value="5.88" class="pct low">5.88%</td> <td data-value="17" class="abs low">1/17</td> <td data-value="50" class="pct medium">50%</td> <td data-value="4" class="abs medium">2/4</td> <td data-value="88.24" class="pct high">88.24%</td> <td data-value="17" class="abs high">15/17</td> </tr> @@ </tbody> 95,7 95,7 @@ <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Sep 06 2021 23:19:53 GMT-0300 (Chile Summer Time) at Mon Sep 06 2021 23:52:13 GMT-0300 (Chile Summer Time) </div> </div> <script src="../prettify.js"></script>
M ejemplos/mtg-counter/coverage/lcov-report/src/mtgPlayer.js.html => ejemplos/mtg-counter/coverage/lcov-report/src/mtgPlayer.js.html +38 -38
@@ 23,9 23,9 @@ <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">5.88% </span> <span class="strong">88.24% </span> <span class="quiet">Statements</span> <span class='fraction'>1/17</span> <span class='fraction'>15/17</span> </div> @@ 37,16 37,16 @@ <div class='fl pad1y space-right2'> <span class="strong">0% </span> <span class="strong">50% </span> <span class="quiet">Functions</span> <span class='fraction'>0/4</span> <span class='fraction'>2/4</span> </div> <div class='fl pad1y space-right2'> <span class="strong">5.88% </span> <span class="strong">88.24% </span> <span class="quiet">Lines</span> <span class='fraction'>1/17</span> <span class='fraction'>15/17</span> </div> @@ 55,7 55,7 @@ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. </p> </div> <div class='status-line low'></div> <div class='status-line high'></div> <pre><table class="coverage"> <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a> @@ <a name='L2'></a><a href='#L2'>2</a> 92,66 92,66 @@ <a name='L33'></a><a href='#L33'>33</a> <a name='L34'></a><a href='#L34'>34</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">class MtgPlayer extends HTMLElement { <span class="fstat-no" title="function not covered" > co</span>nnectedCallback() { <span class="cstat-no" title="statement not covered" > this.attachShadow({mode: 'open'});</span> connectedCallback() { this.attachShadow({mode: 'open'}); <span class="cstat-no" title="statement not covered" > this.render();</span> this.render(); // Properties from attributes. <span class="cstat-no" title="statement not covered" > this.name = this.getAttribute('player-name');</span> <span class="cstat-no" title="statement not covered" > this.life = Number(this.getAttribute('initial-life'));</span> this.name = this.getAttribute('player-name'); this.life = Number(this.getAttribute('initial-life')); // Elements from template. <span class="cstat-no" title="statement not covered" > this.nameEl = this.shadowRoot.querySelector('#name');</span> <span class="cstat-no" title="statement not covered" > this.nameEl.textContent = this.name;</span> <span class="cstat-no" title="statement not covered" > this.lifeEl = this.shadowRoot.querySelector('#life');</span> <span class="cstat-no" title="statement not covered" > this.lifeEl.textContent = this.life;</span> <span class="cstat-no" title="statement not covered" > this.lifeUpBtn = this.shadowRoot.querySelector('#lifeUp');</span> <span class="cstat-no" title="statement not covered" > this.lifeDownBtn = this.shadowRoot.querySelector('#lifeDown');</span> this.nameEl = this.shadowRoot.querySelector('#name'); this.nameEl.textContent = this.name; this.lifeEl = this.shadowRoot.querySelector('#life'); this.lifeEl.textContent = this.life; this.lifeUpBtn = this.shadowRoot.querySelector('#lifeUp'); this.lifeDownBtn = this.shadowRoot.querySelector('#lifeDown'); <span class="cstat-no" title="statement not covered" > this.lifeUpBtn.addEventListener('click', <span class="fstat-no" title="function not covered" >()</span> => {</span> this.lifeUpBtn.addEventListener('click', <span class="fstat-no" title="function not covered" >()</span> => { <span class="cstat-no" title="statement not covered" > this.lifeEl.textContent = ++this.life;</span> }); <span class="cstat-no" title="statement not covered" > this.lifeDownBtn.addEventListener('click', <span class="fstat-no" title="function not covered" >()</span> => {</span> this.lifeDownBtn.addEventListener('click', <span class="fstat-no" title="function not covered" >()</span> => { <span class="cstat-no" title="statement not covered" > this.lifeEl.textContent = --this.life;</span> }); } <span class="fstat-no" title="function not covered" > re</span>nder() { const template = <span class="cstat-no" title="statement not covered" >document.querySelector('#mtgPlayer-tpl').content.cloneNode(true);</span> <span class="cstat-no" title="statement not covered" > this.shadowRoot.appendChild(template);</span> render() { const template = document.querySelector('#mtgPlayer-tpl').content.cloneNode(true); this.shadowRoot.appendChild(template); } } @@ 163,7 163,7 @@ customElements.define('mtg-player', MtgPlayer); <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Sep 06 2021 23:19:53 GMT-0300 (Chile Summer Time) at Mon Sep 06 2021 23:52:13 GMT-0300 (Chile Summer Time) </div> </div> <script src="../prettify.js"></script>
M ejemplos/mtg-counter/coverage/lcov-report/tests/integration/helpers.js.html => ejemplos/mtg-counter/coverage/lcov-report/tests/integration/helpers.js.html +18 -9
@@ 23,9 23,9 @@ <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">50% </span> <span class="strong">100% </span> <span class="quiet">Statements</span> <span class='fraction'>1/2</span> <span class='fraction'>1/1</span> </div> @@ 37,9 37,9 @@ <div class='fl pad1y space-right2'> <span class="strong">50% </span> <span class="strong">100% </span> <span class="quiet">Functions</span> <span class='fraction'>1/2</span> <span class='fraction'>1/1</span> </div> @@ 55,20 55,29 @@ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. </p> </div> <div class='status-line medium'></div> <div class='status-line high'></div> <pre><table class="coverage"> <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a> <a name='L2'></a><a href='#L2'>2</a> <a name='L3'></a><a href='#L3'>3</a> <a name='L4'></a><a href='#L4'>4</a> <a name='L5'></a><a href='#L5'>5</a> <a name='L6'></a><a href='#L6'>6</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> <a name='L6'></a><a href='#L6'>6</a> <a name='L7'></a><a href='#L7'>7</a> <a name='L8'></a><a href='#L8'>8</a> <a name='L9'></a><a href='#L9'>9</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">async function importHTML(url) { return fetch(url).then(<span class="fstat-no" title="function not covered" >re</span>sponse => <span class="cstat-no" title="statement not covered" >response.text())</span>; <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { readFileSync } from 'fs'; function importHTML(pathFromSrc) { // solution for node js return readFileSync(`src/${pathFromSrc}`, 'utf8'); } @@ export { importHTML }; 79,7 88,7 @@ export { importHTML }; <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Sep 06 2021 23:19:53 GMT-0300 (Chile Summer Time) at Mon Sep 06 2021 23:52:13 GMT-0300 (Chile Summer Time) </div> </div> <script src="../../prettify.js"></script>
M ejemplos/mtg-counter/coverage/lcov-report/tests/integration/index.html => ejemplos/mtg-counter/coverage/lcov-report/tests/integration/index.html +13 -13
@@ 23,9 23,9 @@ <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">50% </span> <span class="strong">100% </span> <span class="quiet">Statements</span> <span class='fraction'>1/2</span> <span class='fraction'>1/1</span> </div> @@ 37,9 37,9 @@ <div class='fl pad1y space-right2'> <span class="strong">50% </span> <span class="strong">100% </span> <span class="quiet">Functions</span> <span class='fraction'>1/2</span> <span class='fraction'>1/1</span> </div> @@ 55,7 55,7 @@ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. </p> </div> <div class='status-line medium'></div> <div class='status-line high'></div> <div class="pad1"> <table class="coverage-summary"> @@ <thead> 73,16 73,16 @@ </tr> </thead> <tbody><tr> <td class="file medium" data-value="helpers.js"><a href="helpers.js.html">helpers.js</a></td> <td data-value="50" class="pic medium"> <div class="chart"><div class="cover-fill" style="width: 50%"></div><div class="cover-empty" style="width: 50%"></div></div> <td class="file high" data-value="helpers.js"><a href="helpers.js.html">helpers.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="50" class="pct medium">50%</td> <td data-value="2" class="abs medium">1/2</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="0" class="abs high">0/0</td> <td data-value="50" class="pct medium">50%</td> <td data-value="2" class="abs medium">1/2</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="1" class="abs high">1/1</td> @@ </tr> 95,7 95,7 @@ <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Sep 06 2021 23:19:53 GMT-0300 (Chile Summer Time) at Mon Sep 06 2021 23:52:13 GMT-0300 (Chile Summer Time) </div> </div> <script src="../../prettify.js"></script>
M ejemplos/mtg-counter/coverage/lcov.info => ejemplos/mtg-counter/coverage/lcov.info +21 -23
@@ 5,42 5,40 @@ FN:19,(anonymous_1) FN:22,(anonymous_2) FN:27,(anonymous_3) FNF:4 FNH:0 FNDA:0,(anonymous_0) FNH:2 FNDA:1,(anonymous_0) FNDA:0,(anonymous_1) FNDA:0,(anonymous_2) FNDA:0,(anonymous_3) DA:3,0 DA:5,0 DA:8,0 DA:9,0 DA:12,0 DA:13,0 DA:14,0 DA:15,0 DA:16,0 DA:17,0 DA:19,0 FNDA:1,(anonymous_3) DA:3,1 DA:5,1 DA:8,1 DA:9,1 DA:12,1 DA:13,1 DA:14,1 DA:15,1 DA:16,1 DA:17,1 DA:19,1 DA:20,0 DA:22,0 DA:22,1 DA:23,0 DA:28,0 DA:29,0 DA:28,1 DA:29,1 DA:33,1 LF:17 LH:1 LH:15 BRF:0 BRH:0 end_of_record TN: SF:tests/integration/helpers.js FN:1,importHTML FN:2,(anonymous_1) FNF:2 FN:3,importHTML FNF:1 FNH:1 FNDA:1,importHTML FNDA:0,(anonymous_1) DA:2,1 DA:5,1 LF:1 LH:1 BRF:0
A ejemplos/mtg-counter/tests/integration/helpers.js => ejemplos/mtg-counter/tests/integration/helpers.js +8 -0
@@ 0,0 1,8 @@ import { readFileSync } from 'fs'; function importHTML(pathFromSrc) { // solution for node js return readFileSync(`src/${pathFromSrc}`, 'utf8'); } export { importHTML };
M ejemplos/mtg-counter/tests/integration/mtgPlayer.test.js => ejemplos/mtg-counter/tests/integration/mtgPlayer.test.js +2 -9
@@ 1,15 1,8 @@ import 'mtgPlayer.js'; import { importHTML } from './helpers.js'; beforeAll(() => { document.body.innerHTML = ` <template id="mtgPlayer-tpl"> <button type="button" id="lifeDown">-</button> <div> <p id="name">name</p> <p id="life">life</p> </div> <button type="button" id="lifeUp">+</button> </template>`; document.body.innerHTML = importHTML('index.html'); }); describe('mtgPlayer insertion on DOM', () => {