Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
docs(base): improve api documentation (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
clebert committed Apr 23, 2018
1 parent 70523ba commit 2a596b6
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 64 deletions.
12 changes: 12 additions & 0 deletions @pageobject/base/src/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,23 @@ export abstract class Component<TNode, TAdapter extends Adapter<TNode>> {
this.ancestor = ancestor;
}

/**
* A call to this method is the same as: `this.nth(1)`
*/
public first(): this {
return this.nth(1);
}

/**
* A call to this method is the same as: `this.nth(-1)`
*/
public last(): this {
return this.nth(-1);
}

/**
* @returns An extended copy of `this` component.
*/
public nth(position: number): this {
const name = this.toString();

Expand All @@ -54,6 +63,9 @@ export abstract class Component<TNode, TAdapter extends Adapter<TNode>> {
return reconstruction;
}

/**
* @returns An extended copy of `this` component.
*/
public where<TValue>(
getter: (component: this) => Effect<TValue>,
predicate: Predicate<TValue>
Expand Down
32 changes: 24 additions & 8 deletions docs/api/base/classes/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ <h3>find<wbr>Nodes</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L72">Component.ts:72</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L84">Component.ts:84</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TNode</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -1162,7 +1162,7 @@ <h3>find<wbr>Unique<wbr>Node</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L112">Component.ts:112</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L124">Component.ts:124</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">TNode</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -1179,9 +1179,14 @@ <h3>first</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L24">Component.ts:24</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L27">Component.ts:27</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A call to this method is the same as: <code>this.nth(1)</code></p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
</li>
</ul>
Expand All @@ -1196,9 +1201,14 @@ <h3>last</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L28">Component.ts:28</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L34">Component.ts:34</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A call to this method is the same as: <code>this.nth(-1)</code></p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
</li>
</ul>
Expand All @@ -1213,16 +1223,19 @@ <h3>nth</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L32">Component.ts:32</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L41">Component.ts:41</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>position: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
<p>An extended copy of <code>this</code> component.</p>
</li>
</ul>
</section>
Expand All @@ -1236,7 +1249,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> reconstruct</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L131">Component.ts:131</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L143">Component.ts:143</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
Expand All @@ -1253,7 +1266,7 @@ <h3>to<wbr>String</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L127">Component.ts:127</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L139">Component.ts:139</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
Expand All @@ -1270,9 +1283,11 @@ <h3>where</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L57">Component.ts:57</a></li>
<li>Defined in <a href="https://github.com/clebert/pageobject/blob/master/@pageobject/base/src/Component.ts#L69">Component.ts:69</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li>
Expand Down Expand Up @@ -1307,6 +1322,7 @@ <h5>predicate: <a href="predicate.html" class="tsd-signature-type">Predicate</a>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
<p>An extended copy of <code>this</code> component.</p>
</li>
</ul>
</section>
Expand Down
32 changes: 24 additions & 8 deletions docs/api/todomvc/classes/label.html
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ <h3>find<wbr>Nodes</h3>
<aside class="tsd-sources">
<p>Inherited from Component.findNodes</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:18</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:30</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">WebNode</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -1217,7 +1217,7 @@ <h3>find<wbr>Unique<wbr>Node</h3>
<aside class="tsd-sources">
<p>Inherited from Component.findUniqueNode</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:19</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:31</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">WebNode</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -1235,9 +1235,14 @@ <h3>first</h3>
<aside class="tsd-sources">
<p>Inherited from Component.first</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:14</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:17</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A call to this method is the same as: <code>this.nth(1)</code></p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
</li>
</ul>
Expand Down Expand Up @@ -1369,9 +1374,14 @@ <h3>last</h3>
<aside class="tsd-sources">
<p>Inherited from Component.last</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:15</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:21</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A call to this method is the same as: <code>this.nth(-1)</code></p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
</li>
</ul>
Expand All @@ -1387,16 +1397,19 @@ <h3>nth</h3>
<aside class="tsd-sources">
<p>Inherited from Component.nth</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:16</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:25</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>position: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
<p>An extended copy of <code>this</code> component.</p>
</li>
</ul>
</section>
Expand All @@ -1411,7 +1424,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> reconstruct</h3>
<aside class="tsd-sources">
<p>Inherited from Component.reconstruct</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:21</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:33</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
Expand Down Expand Up @@ -1447,7 +1460,7 @@ <h3>to<wbr>String</h3>
<aside class="tsd-sources">
<p>Inherited from Component.toString</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:20</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:32</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
Expand All @@ -1465,9 +1478,11 @@ <h3>where</h3>
<aside class="tsd-sources">
<p>Inherited from Component.where</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:17</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:29</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li>
Expand Down Expand Up @@ -1502,6 +1517,7 @@ <h5>predicate: <span class="tsd-signature-type">Predicate</span><span class="tsd
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
<p>An extended copy of <code>this</code> component.</p>
</li>
</ul>
</section>
Expand Down
32 changes: 24 additions & 8 deletions docs/api/todomvc/classes/newtodoinput.html
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ <h3>find<wbr>Nodes</h3>
<aside class="tsd-sources">
<p>Inherited from Component.findNodes</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:18</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:30</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">WebNode</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -1217,7 +1217,7 @@ <h3>find<wbr>Unique<wbr>Node</h3>
<aside class="tsd-sources">
<p>Inherited from Component.findUniqueNode</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:19</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:31</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">WebNode</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -1235,9 +1235,14 @@ <h3>first</h3>
<aside class="tsd-sources">
<p>Inherited from Component.first</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:14</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:17</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A call to this method is the same as: <code>this.nth(1)</code></p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
</li>
</ul>
Expand Down Expand Up @@ -1369,9 +1374,14 @@ <h3>last</h3>
<aside class="tsd-sources">
<p>Inherited from Component.last</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:15</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:21</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A call to this method is the same as: <code>this.nth(-1)</code></p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
</li>
</ul>
Expand All @@ -1387,16 +1397,19 @@ <h3>nth</h3>
<aside class="tsd-sources">
<p>Inherited from Component.nth</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:16</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:25</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>position: <span class="tsd-signature-type">number</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
<p>An extended copy of <code>this</code> component.</p>
</li>
</ul>
</section>
Expand All @@ -1411,7 +1424,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> reconstruct</h3>
<aside class="tsd-sources">
<p>Inherited from Component.reconstruct</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:21</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:33</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
Expand Down Expand Up @@ -1447,7 +1460,7 @@ <h3>to<wbr>String</h3>
<aside class="tsd-sources">
<p>Inherited from Component.toString</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:20</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:32</li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
Expand All @@ -1465,9 +1478,11 @@ <h3>where</h3>
<aside class="tsd-sources">
<p>Inherited from Component.where</p>
<ul>
<li>Defined in @pageobject/base/dist/Component.d.ts:17</li>
<li>Defined in @pageobject/base/dist/Component.d.ts:29</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
</div>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
<ul class="tsd-type-parameters">
<li>
Expand Down Expand Up @@ -1502,6 +1517,7 @@ <h5>predicate: <span class="tsd-signature-type">Predicate</span><span class="tsd
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4>
<p>An extended copy of <code>this</code> component.</p>
</li>
</ul>
</section>
Expand Down

0 comments on commit 2a596b6

Please sign in to comment.