File tree 4 files changed +49
-4
lines changed
addon-test-support/@ember/test-helpers/dom
4 files changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,14 @@ Find the first element matched by the given selector. Equivalent to calling
493
493
494
494
* ` selector ` ** [ string] [ 64 ] ** the selector to search for
495
495
496
+ #### Examples
497
+
498
+ Find all of the elements matching '.my-selector'.
499
+
500
+ ``` javascript
501
+ findAll (' .my-selector' );
502
+ ```
503
+
496
504
Returns ** [ Element] [ 65 ] ** matched element or null
497
505
498
506
### findAll
@@ -505,12 +513,29 @@ of a `NodeList`.
505
513
506
514
* ` selector ` ** [ string] [ 64 ] ** the selector to search for
507
515
516
+ #### Examples
517
+
518
+ Finding the first element with id 'foo'
519
+
520
+ ``` javascript
521
+ find (' #foo' );
522
+ ```
523
+
508
524
Returns ** [ Array] [ 70 ] ** array of matched elements
509
525
510
526
### getRootElement
511
527
512
528
Get the root element of the application under test (usually ` #ember-testing ` )
513
529
530
+ #### Examples
531
+
532
+ Getting the root element of the application and checking that it is equal
533
+ to the element with id 'ember-testing'.
534
+
535
+ ``` javascript
536
+ assert .equal (getRootElement (), document .querySelector (' #ember-testing' ));
537
+ ```
538
+
514
539
Returns ** [ Element] [ 65 ] ** the root element
515
540
516
541
## Routing Helpers
@@ -1216,23 +1241,23 @@ Returns **([Array][70]\<Warning> | [Promise][66]<[Array][70]\<Warning>>)** An ar
1216
1241
1217
1242
[ 54 ] : #getdeprecations
1218
1243
1219
- [ 55 ] : #examples-19
1244
+ [ 55 ] : #examples-22
1220
1245
1221
1246
[ 56 ] : #getdeprecationsduringcallback
1222
1247
1223
1248
[ 57 ] : #parameters-29
1224
1249
1225
- [ 58 ] : #examples-20
1250
+ [ 58 ] : #examples-23
1226
1251
1227
1252
[ 59 ] : #getwarnings
1228
1253
1229
- [ 60 ] : #examples-21
1254
+ [ 60 ] : #examples-24
1230
1255
1231
1256
[ 61 ] : #getwarningsduringcallback
1232
1257
1233
1258
[ 62 ] : #parameters-30
1234
1259
1235
- [ 63 ] : #examples-22
1260
+ [ 63 ] : #examples-25
1236
1261
1237
1262
[ 64 ] : https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
1238
1263
Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ import { toArray } from '../ie-11-polyfills';
9
9
@public
10
10
@param {string } selector the selector to search for
11
11
@return {Array } array of matched elements
12
+
13
+ @example
14
+ <caption>
15
+ Finding the first element with id 'foo'
16
+ </caption>
17
+ find('#foo');
12
18
*/
13
19
export default function findAll ( selector : string ) : Element [ ] {
14
20
if ( ! selector ) {
Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ import getElement from './-get-element';
7
7
@public
8
8
@param {string } selector the selector to search for
9
9
@return {Element } matched element or null
10
+
11
+ @example
12
+ <caption>
13
+ Find all of the elements matching '.my-selector'.
14
+ </caption>
15
+ findAll('.my-selector');
16
+
10
17
*/
11
18
export default function find ( selector : string ) : Element | null {
12
19
if ( ! selector ) {
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ import { isDocument, isElement } from './-target';
6
6
7
7
@public
8
8
@returns {Element } the root element
9
+
10
+ @example
11
+ <caption>
12
+ Getting the root element of the application and checking that it is equal
13
+ to the element with id 'ember-testing'.
14
+ </caption>
15
+ assert.equal(getRootElement(), document.querySelector('#ember-testing'));
9
16
*/
10
17
export default function getRootElement ( ) : Element | Document {
11
18
let context = getContext ( ) ;
You can’t perform that action at this time.
0 commit comments