|
1 | 1 | import EmberObject from '@ember/object';
|
2 | 2 | import { moduleForComponent, test } from 'ember-qunit';
|
3 | 3 | import hbs from 'htmlbars-inline-precompile';
|
4 |
| -import { click, findAll, find } from 'ember-native-dom-helpers'; |
| 4 | +import { click, findAll } from 'ember-native-dom-helpers'; |
5 | 5 |
|
6 | 6 | moduleForComponent('api-index', 'Integration | Component | api index', {
|
7 | 7 | integration: true
|
@@ -63,13 +63,13 @@ test('should display api index', function (assert) {
|
63 | 63 | {{/each}}
|
64 | 64 | {{/api-index}}
|
65 | 65 | `);
|
66 |
| - assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections'); |
67 |
| - assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section'); |
68 |
| - assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section'); |
69 |
| - assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section'); |
70 |
| - assert.equal(find('.spec-method-list>li>a').textContent.trim(), 'doSomething', 'should display 1 method'); |
71 |
| - assert.equal(find('.spec-property-list>li>a').textContent.trim(), 'isSomething', 'should display 1 property'); |
72 |
| - assert.equal(find('.spec-event-list>li>a').textContent.trim(), 'didSomething', 'should display 1 event'); |
| 66 | + assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections'); |
| 67 | + assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section'); |
| 68 | + assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section'); |
| 69 | + assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section'); |
| 70 | + assert.dom('.spec-method-list>li>a').hasText('doSomething', 'should display 1 method'); |
| 71 | + assert.dom('.spec-property-list>li>a').hasText('isSomething', 'should display 1 property'); |
| 72 | + assert.dom('.spec-event-list>li>a').hasText('didSomething', 'should display 1 event'); |
73 | 73 | });
|
74 | 74 |
|
75 | 75 | test('should display text when no methods', function (assert) {
|
@@ -123,13 +123,13 @@ test('should display text when no methods', function (assert) {
|
123 | 123 | {{/each}}
|
124 | 124 | {{/api-index}}
|
125 | 125 | `);
|
126 |
| - assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections'); |
127 |
| - assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section'); |
128 |
| - assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section'); |
129 |
| - assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section'); |
130 |
| - assert.equal(find('.spec-method-list').textContent.trim(), 'No documented items', 'should display no items text'); |
131 |
| - assert.equal(find('.spec-property-list').textContent.trim(), 'isSomething', 'should display 1 property'); |
132 |
| - assert.equal(find('.spec-event-list').textContent.trim(), 'didSomething', 'should display 1 event'); |
| 126 | + assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections'); |
| 127 | + assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section'); |
| 128 | + assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section'); |
| 129 | + assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section'); |
| 130 | + assert.dom('.spec-method-list').hasText('No documented items', 'should display no items text'); |
| 131 | + assert.dom('.spec-property-list').hasText('isSomething', 'should display 1 property'); |
| 132 | + assert.dom('.spec-event-list').hasText('didSomething', 'should display 1 event'); |
133 | 133 | });
|
134 | 134 |
|
135 | 135 | test('should display api index with filter', function (assert) {
|
@@ -253,13 +253,13 @@ test('should display api index with filter', function (assert) {
|
253 | 253 | {{/api-index}}
|
254 | 254 | {{/api-index-filter}}
|
255 | 255 | `);
|
256 |
| - assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections'); |
257 |
| - assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section'); |
258 |
| - assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section'); |
259 |
| - assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section'); |
260 |
| - assert.equal(find('.spec-method-list').textContent.trim(), 'doSomething', 'should display 1 method'); |
261 |
| - assert.equal(find('.spec-property-list').textContent.trim(), 'isSomething', 'should display 1 property'); |
262 |
| - assert.equal(find('.spec-event-list').textContent.trim(), 'didSomething', 'should display 1 event'); |
| 256 | + assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections'); |
| 257 | + assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section'); |
| 258 | + assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section'); |
| 259 | + assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section'); |
| 260 | + assert.dom('.spec-method-list').hasText('doSomething', 'should display 1 method'); |
| 261 | + assert.dom('.spec-property-list').hasText('isSomething', 'should display 1 property'); |
| 262 | + assert.dom('.spec-event-list').hasText('didSomething', 'should display 1 event'); |
263 | 263 | });
|
264 | 264 |
|
265 | 265 |
|
@@ -382,17 +382,17 @@ test('should display inherited method when show inherited toggled on', async fun
|
382 | 382 | {{/api-index}}
|
383 | 383 | {{/api-index-filter}}
|
384 | 384 | `);
|
385 |
| - assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections'); |
386 |
| - assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section'); |
387 |
| - assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section'); |
388 |
| - assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section'); |
389 |
| - assert.equal(find('.spec-method-list>li>a').textContent.trim(), 'doSomething', 'should display 1 method'); |
390 |
| - assert.equal(find('.spec-property-list>li>a').textContent.trim(), 'isSomething', 'should display 1 property'); |
391 |
| - assert.equal(find('.spec-event-list>li>a').textContent.trim(), 'didSomething', 'should display 1 event'); |
| 385 | + assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections'); |
| 386 | + assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section'); |
| 387 | + assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section'); |
| 388 | + assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section'); |
| 389 | + assert.dom('.spec-method-list>li>a').hasText('doSomething', 'should display 1 method'); |
| 390 | + assert.dom('.spec-property-list>li>a').hasText('isSomething', 'should display 1 property'); |
| 391 | + assert.dom('.spec-event-list>li>a').hasText('didSomething', 'should display 1 event'); |
392 | 392 |
|
393 | 393 | await click('#inherited-toggle');
|
394 | 394 |
|
395 |
| - assert.equal(findAll('.spec-method-list>li>a').length, 2, 'should display 2 methods total'); |
396 |
| - assert.equal(findAll('.spec-method-list>li>a')[0].textContent.trim(), 'doSomething', 'should display 1 public method'); |
397 |
| - assert.equal(findAll('.spec-method-list>li>a')[1].textContent.trim(), 'parentDoSomething', 'should display 1 inherited method'); |
| 395 | + assert.dom('.spec-method-list>li>a').exists({ count: 2 }, 'should display 2 methods total'); |
| 396 | + assert.dom(findAll('.spec-method-list>li>a')[0]).hasText('doSomething', 'should display 1 public method'); |
| 397 | + assert.dom(findAll('.spec-method-list>li>a')[1]).hasText('parentDoSomething', 'should display 1 inherited method'); |
398 | 398 | });
|
0 commit comments