Permalink
Browse files

feat(booleanAttributes): Added booleanAttributes and changed boundAtt…

…ributes
  • Loading branch information...
calebdwilliams committed Oct 26, 2018
1 parent 3a81437 commit d496633f79d79d82b7edb42a319c0c8927cf2f01
@@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">75.46% </span>
<span class="strong">75.34% </span>
<span class="quiet">Statements</span>
<span class='fraction'>326/432</span>
<span class='fraction'>330/438</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">61.34% </span>
<span class="strong">60.92% </span>
<span class="quiet">Branches</span>
<span class='fraction'>146/238</span>
<span class='fraction'>145/238</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.36% </span>
<span class="strong">76.79% </span>
<span class="quiet">Functions</span>
<span class='fraction'>42/55</span>
<span class='fraction'>43/56</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.83% </span>
<span class="strong">76.68% </span>
<span class="quiet">Lines</span>
<span class='fraction'>315/410</span>
<span class='fraction'>319/416</span>
</div>
</div>
</div>
@@ -60,15 +60,15 @@ <h1>
</thead>
<tbody><tr>
<td class="file medium" data-value="src/"><a href="src/index.html">src/</a></td>
<td data-value="75.46" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75.46" class="pct medium">75.46%</td>
<td data-value="432" class="abs medium">326/432</td>
<td data-value="61.34" class="pct medium">61.34%</td>
<td data-value="238" class="abs medium">146/238</td>
<td data-value="76.36" class="pct medium">76.36%</td>
<td data-value="55" class="abs medium">42/55</td>
<td data-value="76.83" class="pct medium">76.83%</td>
<td data-value="410" class="abs medium">315/410</td>
<td data-value="75.34" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75.34" class="pct medium">75.34%</td>
<td data-value="438" class="abs medium">330/438</td>
<td data-value="60.92" class="pct medium">60.92%</td>
<td data-value="238" class="abs medium">145/238</td>
<td data-value="76.79" class="pct medium">76.79%</td>
<td data-value="56" class="abs medium">43/56</td>
<td data-value="76.68" class="pct medium">76.68%</td>
<td data-value="416" class="abs medium">319/416</td>
</tr>

</tbody>
@@ -77,7 +77,7 @@ <h1>
</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 Fri Sep 14 2018 13:25:07 GMT-0600 (MDT)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 25 2018 20:05:25 GMT-0500 (CDT)
</div>
</div>
<script src="prettify.js"></script>
@@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">75.46% </span>
<span class="strong">75.34% </span>
<span class="quiet">Statements</span>
<span class='fraction'>326/432</span>
<span class='fraction'>330/438</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">61.34% </span>
<span class="strong">60.92% </span>
<span class="quiet">Branches</span>
<span class='fraction'>146/238</span>
<span class='fraction'>145/238</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.36% </span>
<span class="strong">76.79% </span>
<span class="quiet">Functions</span>
<span class='fraction'>42/55</span>
<span class='fraction'>43/56</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.83% </span>
<span class="strong">76.68% </span>
<span class="quiet">Lines</span>
<span class='fraction'>315/410</span>
<span class='fraction'>319/416</span>
</div>
</div>
</div>
@@ -60,15 +60,15 @@ <h1>
</thead>
<tbody><tr>
<td class="file medium" data-value="templiteral.js"><a href="templiteral.js.html">templiteral.js</a></td>
<td data-value="75.46" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75.46" class="pct medium">75.46%</td>
<td data-value="432" class="abs medium">326/432</td>
<td data-value="61.34" class="pct medium">61.34%</td>
<td data-value="238" class="abs medium">146/238</td>
<td data-value="76.36" class="pct medium">76.36%</td>
<td data-value="55" class="abs medium">42/55</td>
<td data-value="76.83" class="pct medium">76.83%</td>
<td data-value="410" class="abs medium">315/410</td>
<td data-value="75.34" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75.34" class="pct medium">75.34%</td>
<td data-value="438" class="abs medium">330/438</td>
<td data-value="60.92" class="pct medium">60.92%</td>
<td data-value="238" class="abs medium">145/238</td>
<td data-value="76.79" class="pct medium">76.79%</td>
<td data-value="56" class="abs medium">43/56</td>
<td data-value="76.68" class="pct medium">76.68%</td>
<td data-value="416" class="abs medium">319/416</td>
</tr>

</tbody>
@@ -77,7 +77,7 @@ <h1>
</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 Fri Sep 14 2018 13:25:07 GMT-0600 (MDT)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 25 2018 20:05:25 GMT-0500 (CDT)
</div>
</div>
<script src="../prettify.js"></script>
@@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">75.46% </span>
<span class="strong">75.34% </span>
<span class="quiet">Statements</span>
<span class='fraction'>326/432</span>
<span class='fraction'>330/438</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">61.34% </span>
<span class="strong">60.92% </span>
<span class="quiet">Branches</span>
<span class='fraction'>146/238</span>
<span class='fraction'>145/238</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.36% </span>
<span class="strong">76.79% </span>
<span class="quiet">Functions</span>
<span class='fraction'>42/55</span>
<span class='fraction'>43/56</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.83% </span>
<span class="strong">76.68% </span>
<span class="quiet">Lines</span>
<span class='fraction'>315/410</span>
<span class='fraction'>319/416</span>
</div>
</div>
</div>
@@ -790,7 +790,15 @@ <h1>
745
746
747
748</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
748
749
750
751
752
753
754
755
756</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-yes">1×</span>
@@ -1318,6 +1326,7 @@ <h1>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">2×</span>
<span class="cline-any cline-yes">134×</span>
<span class="cline-any cline-yes">519×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@@ -1363,9 +1372,16 @@ <h1>
<span class="cline-any cline-yes">88×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">68×</span>
<span class="cline-any cline-yes">68×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">68×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">66×</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">66×</span>
<span class="cline-any cline-yes">33×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33×</span>
@@ -2065,6 +2081,7 @@ <h1>
static get adoptStyles<span class="fstat-no" title="function not covered" >() {</span> <span class="cstat-no" title="statement not covered" >return this.styles.adopt.bind(styleRegistry); </span>}
static get boundAttributes<span class="fstat-no" title="function not covered" >() {</span> <span class="cstat-no" title="statement not covered" >return []; </span>}
static get observedAttributes() { return [...this.boundAttributes]; }
static get booleanAttributes() { return []; }
static get renderer() { return 'render'; }

constructor(init) {
@@ -2109,10 +2126,17 @@ <h1>
this.constructor.boundAttributes.map((attr, index, currentArray) =&gt; {
Object.defineProperty(this, attr, {
get() {
return this.getAttribute(attr) || <span class="branch-1 cbranch-no" title="branch not covered" >this.hasAttribute(attr);</span>
const value = this.getAttribute(attr);
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.constructor.booleanAttributes.includes(attr)) {
<span class="cstat-no" title="statement not covered" > return !!value;</span>
}
return this.getAttribute(attr);
},
set(_attr) {
if (_attr || _attr === '') {
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.constructor.booleanAttributes.includes(attr)) {
<span class="cstat-no" title="statement not covered" > return !!_attr;</span>
}
if (_attr) {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -2290,7 +2314,7 @@ <h1>
</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 Fri Sep 14 2018 13:25:07 GMT-0600 (MDT)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 25 2018 20:05:25 GMT-0500 (CDT)
</div>
</div>
<script src="../prettify.js"></script>
@@ -58,6 +58,7 @@ export class Component extends HTMLElement {
static get adoptStyles() { return this.styles.adopt.bind(styleRegistry); }
static get boundAttributes() { return []; }
static get observedAttributes() { return [...this.boundAttributes]; }
static get booleanAttributes() { return []; }
static get renderer() { return 'render'; }

constructor(init) {
@@ -102,10 +103,17 @@ export class Component extends HTMLElement {
this.constructor.boundAttributes.map((attr, index, currentArray) => {
Object.defineProperty(this, attr, {
get() {
return this.getAttribute(attr) || this.hasAttribute(attr);
const value = this.getAttribute(attr);
if (this.constructor.booleanAttributes.includes(attr)) {
return !!value;
}
return this.getAttribute(attr);
},
set(_attr) {
if (_attr || _attr === '') {
if (this.constructor.booleanAttributes.includes(attr)) {
return !!_attr;
}
if (_attr) {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -523,6 +523,7 @@ class Component extends HTMLElement {
static get adoptStyles() { return this.styles.adopt.bind(styleRegistry); }
static get boundAttributes() { return []; }
static get observedAttributes() { return [...this.boundAttributes]; }
static get booleanAttributes() { return []; }
static get renderer() { return 'render'; }

constructor(init) {
@@ -567,10 +568,17 @@ class Component extends HTMLElement {
this.constructor.boundAttributes.map((attr, index, currentArray) => {
Object.defineProperty(this, attr, {
get() {
return this.getAttribute(attr) || this.hasAttribute(attr);
const value = this.getAttribute(attr);
if (this.constructor.booleanAttributes.includes(attr)) {
return !!value;
}
return this.getAttribute(attr);
},
set(_attr) {
if (_attr || _attr === '') {
if (this.constructor.booleanAttributes.includes(attr)) {
return !!_attr;
}
if (_attr) {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);

0 comments on commit d496633

Please sign in to comment.