@@ -24,17 +24,7 @@ export interface HarnessLoader {
2424 * @return A `HarnessLoader` rooted at the element matching the given selector.
2525 * @throws If a matching element can't be found.
2626 */
27- findRequired ( selector : string ) : Promise < HarnessLoader > ;
28-
29- /**
30- * Searches for an element with the given selector under the current instances's root element,
31- * and returns a `HarnessLoader` rooted at the matching element. If multiple elements match the
32- * selector, the first is used. If no elements match, null is returned.
33- * @param selector The selector for the root element of the new `HarnessLoader`
34- * @return A `HarnessLoader` rooted at the element matching the given selector, or null if no
35- * matching element was found.
36- */
37- findOptional ( selector : string ) : Promise < HarnessLoader | null > ;
27+ getChildLoader ( selector : string ) : Promise < HarnessLoader > ;
3828
3929 /**
4030 * Searches for all elements with the given selector under the current instances's root element,
@@ -43,7 +33,7 @@ export interface HarnessLoader {
4333 * @param selector The selector for the root element of the new `HarnessLoader`
4434 * @return A list of `HarnessLoader`s, one for each matching element, rooted at that element.
4535 */
46- findAll ( selector : string ) : Promise < HarnessLoader [ ] > ;
36+ getAllChildLoaders ( selector : string ) : Promise < HarnessLoader [ ] > ;
4737
4838 /**
4939 * Searches for an instance of the component corresponding to the given harness type under the
@@ -54,27 +44,16 @@ export interface HarnessLoader {
5444 * @return An instance of the given harness type
5545 * @throws If a matching component instance can't be found.
5646 */
57- requiredHarness < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
47+ getHarness < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
5848 Promise < T > ;
5949
60- /**
61- * Searches for an instance of the component corresponding to the given harness type under the
62- * `HarnessLoader`'s root element, and returns a `ComponentHarness` for that instance. If multiple
63- * matching components are found, a harness for the first one is returned. If no matching
64- * component is found, null is returned.
65- * @param harnessType The type of harness to create
66- * @return An instance of the given harness type, or null if none is found.
67- */
68- optionalHarness < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
69- Promise < T | null > ;
70-
7150 /**
7251 * Searches for all instances of the component corresponding to the given harness type under the
7352 * `HarnessLoader`'s root element, and returns a list `ComponentHarness` for each instance.
7453 * @param harnessType The type of harness to create
7554 * @return A list instances of the given harness type.
7655 */
77- allHarnesses < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
56+ getAllHarnesses < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
7857 Promise < T [ ] > ;
7958}
8059
@@ -87,8 +66,8 @@ export interface LocatorFactory {
8766 /** Gets a locator factory rooted at the document root. */
8867 documentRootLocatorFactory ( ) : LocatorFactory ;
8968
90- /** Gets the root element of this `LocatorFactory` as a `TestElement`. */
91- rootElement ( ) : TestElement ;
69+ /** The root element of this `LocatorFactory` as a `TestElement`. */
70+ rootElement : TestElement ;
9271
9372 /**
9473 * Creates an asynchronous locator function that can be used to search for elements with the given
@@ -99,7 +78,7 @@ export interface LocatorFactory {
9978 * @return An asynchronous locator function that searches for elements with the given selector,
10079 * and either finds one or throws an error
10180 */
102- locatorForRequired ( selector : string ) : AsyncFn < TestElement > ;
81+ locatorFor ( selector : string ) : AsyncFn < TestElement > ;
10382
10483 /**
10584 * Creates an asynchronous locator function that can be used to find a `ComponentHarness` for a
@@ -110,7 +89,7 @@ export interface LocatorFactory {
11089 * @return An asynchronous locator function that searches components matching the given harness
11190 * type, and either returns a `ComponentHarness` for the component, or throws an error.
11291 */
113- locatorForRequired < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
92+ locatorFor < T extends ComponentHarness > ( harnessType : ComponentHarnessConstructor < T > ) :
11493 AsyncFn < T > ;
11594
11695 /**
@@ -165,11 +144,11 @@ export interface LocatorFactory {
165144 * should be inherited when defining user's own harness.
166145 */
167146export abstract class ComponentHarness {
168- constructor ( private readonly locatorFacotry : LocatorFactory ) { }
147+ constructor ( private readonly locatorFactory : LocatorFactory ) { }
169148
170149 /** Gets a `Promise` for the `TestElement` representing the host element of the component. */
171150 async host ( ) : Promise < TestElement > {
172- return this . locatorFacotry . rootElement ( ) ;
151+ return this . locatorFactory . rootElement ;
173152 }
174153
175154 /**
@@ -178,7 +157,7 @@ export abstract class ComponentHarness {
178157 * appending to document.body).
179158 */
180159 protected documentRootLocatorFactory ( ) : LocatorFactory {
181- return this . locatorFacotry . documentRootLocatorFactory ( ) ;
160+ return this . locatorFactory . documentRootLocatorFactory ( ) ;
182161 }
183162
184163 /**
@@ -190,7 +169,7 @@ export abstract class ComponentHarness {
190169 * @return An asynchronous locator function that searches for elements with the given selector,
191170 * and either finds one or throws an error
192171 */
193- protected locatorForRequired ( selector : string ) : AsyncFn < TestElement > ;
172+ protected locatorFor ( selector : string ) : AsyncFn < TestElement > ;
194173
195174 /**
196175 * Creates an asynchronous locator function that can be used to find a `ComponentHarness` for a
@@ -201,11 +180,11 @@ export abstract class ComponentHarness {
201180 * @return An asynchronous locator function that searches components matching the given harness
202181 * type, and either returns a `ComponentHarness` for the component, or throws an error.
203182 */
204- protected locatorForRequired < T extends ComponentHarness > (
183+ protected locatorFor < T extends ComponentHarness > (
205184 harnessType : ComponentHarnessConstructor < T > ) : AsyncFn < T > ;
206185
207- protected locatorForRequired ( arg : any ) : any {
208- return this . locatorFacotry . locatorForRequired ( arg ) ;
186+ protected locatorFor ( arg : any ) : any {
187+ return this . locatorFactory . locatorFor ( arg ) ;
209188 }
210189
211190 /**
@@ -232,7 +211,7 @@ export abstract class ComponentHarness {
232211 harnessType : ComponentHarnessConstructor < T > ) : AsyncFn < T | null > ;
233212
234213 protected locatorForOptional ( arg : any ) : any {
235- return this . locatorFacotry . locatorForOptional ( arg ) ;
214+ return this . locatorFactory . locatorForOptional ( arg ) ;
236215 }
237216
238217 /**
@@ -258,7 +237,7 @@ export abstract class ComponentHarness {
258237 AsyncFn < T [ ] > ;
259238
260239 protected locatorForAll ( arg : any ) : any {
261- return this . locatorFacotry . locatorForAll ( arg ) ;
240+ return this . locatorFactory . locatorForAll ( arg ) ;
262241 }
263242}
264243
0 commit comments