Skip to content

Use "qunit-dom" plugin #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"fastboot-app-server": "^1.0.1",
"loader.js": "^4.6.0",
"minimist": "^1.2.0",
"normalize.css": "^7.0.0"
"normalize.css": "^7.0.0",
"qunit-dom": "^0.3.2"
},
"engines": {
"node": "8",
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/app-layout-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ test('lists the project versions in a select box', async function(assert) {

await selectSearch('.select-container', '2');

assert.equal(find('.ember-power-select-options').length, 1);
assert.dom('.ember-power-select-options').exists({ count: 1 });
assert.ok(find('.ember-power-select-options')[0].children.length > 1);
});
4 changes: 2 additions & 2 deletions tests/acceptance/method-inheritance-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import moduleForAcceptance from 'ember-api-docs/tests/helpers/module-for-acceptance';
import {skip} from 'qunit';
import { visit, click, findAll, findWithAssert } from 'ember-native-dom-helpers';
import { visit, click, findWithAssert } from 'ember-native-dom-helpers';
import testSelector from 'ember-test-selectors';

moduleForAcceptance('Acceptance | method inheritance')

skip('no duplicate methods displayed', async function (assert) {
await visit('/ember-data/2.14/classes/DS.JSONAPIAdapter');
assert.equal(findAll("[data-test-item='createRecord']").length, 1);
assert.dom("[data-test-item='createRecord']").exists({ count: 1 });
});

skip('most local inherited method is shown', async function (assert) {
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/switch-project-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ skip('Can switch projects back and forth', async function(assert) {
async function ensureVersionsExist() {
await selectSearch('.select-container', '2');

assert.equal(findAll('.ember-power-select-options').length, 1);
assert.dom('.ember-power-select-options').exists({ count: 1 });
assert.ok(findAll('.ember-power-select-options')[0].children.length > 1);
}

Expand Down
48 changes: 24 additions & 24 deletions tests/integration/components/api-index-filter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ test('clicking inherited shows inherited methods', async function(assert) {
`);

await click('#inherited-toggle');
assert.equal(findAll('.method-name').length, 2, 'should display 2 methods total');
assert.equal(findAll('.method-name')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.equal(findAll('.method-name')[1].textContent.trim(), 'parentDoSomething', 'should display 1 inherited method');
assert.dom('.method-name').exists({ count: 2 }, 'should display 2 methods total');
assert.dom(findAll('.method-name')[0]).hasText('doSomething', 'should display 1 public method');
assert.dom(findAll('.method-name')[1]).hasText('parentDoSomething', 'should display 1 inherited method');
});

test('clicking private shows private methods', async function(assert) {
Expand Down Expand Up @@ -169,9 +169,9 @@ test('clicking private shows private methods', async function(assert) {
`);

await click('#private-toggle');
assert.equal(findAll('.method-name').length, 2, 'should display 2 methods total');
assert.equal(findAll('.method-name')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.equal(findAll('.method-name')[1].textContent.trim(), 'doSomethingPrivate', 'should display 1 private method');
assert.dom('.method-name').exists({ count: 2 }, 'should display 2 methods total');
assert.dom(findAll('.method-name')[0]).hasText('doSomething', 'should display 1 public method');
assert.dom(findAll('.method-name')[1]).hasText('doSomethingPrivate', 'should display 1 private method');
});

test('clicking private and inherited shows both methods', async function(assert) {
Expand Down Expand Up @@ -229,10 +229,10 @@ test('clicking private and inherited shows both methods', async function(assert)

await click('#private-toggle');
await click('#inherited-toggle');
assert.equal(findAll('.method-name').length, 3, 'should display 3 methods total');
assert.equal(findAll('.method-name')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.equal(findAll('.method-name')[1].textContent.trim(), 'doSomethingPrivate', 'should display 1 private method');
assert.equal(findAll('.method-name')[2].textContent.trim(), 'parentDoSomething', 'should display 1 inherited method');
assert.dom('.method-name').exists({ count: 3 }, 'should display 3 methods total');
assert.dom(findAll('.method-name')[0]).hasText('doSomething', 'should display 1 public method');
assert.dom(findAll('.method-name')[1]).hasText('doSomethingPrivate', 'should display 1 private method');
assert.dom(findAll('.method-name')[2]).hasText('parentDoSomething', 'should display 1 inherited method');
});


Expand Down Expand Up @@ -293,12 +293,12 @@ test('clicking all toggles shows all methods', async function(assert) {
await click('#inherited-toggle');
await click('#protected-toggle');
await click('#deprecated-toggle');
assert.equal(findAll('.method-name').length, 5, 'should display all methods');
assert.equal(findAll('.method-name')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.equal(findAll('.method-name')[1].textContent.trim(), 'doSomethingDeprecated', 'should display 1 deprecated method');
assert.equal(findAll('.method-name')[2].textContent.trim(), 'doSomethingPrivate', 'should display 1 private method');
assert.equal(findAll('.method-name')[3].textContent.trim(), 'doSomethingProtected', 'should display 1 protected method');
assert.equal(findAll('.method-name')[4].textContent.trim(), 'parentDoSomething', 'should display 1 inherited method');
assert.dom('.method-name').exists({ count: 5 }, 'should display all methods');
assert.dom(findAll('.method-name')[0]).hasText('doSomething', 'should display 1 public method');
assert.dom(findAll('.method-name')[1]).hasText('doSomethingDeprecated', 'should display 1 deprecated method');
assert.dom(findAll('.method-name')[2]).hasText('doSomethingPrivate', 'should display 1 private method');
assert.dom(findAll('.method-name')[3]).hasText('doSomethingProtected', 'should display 1 protected method');
assert.dom(findAll('.method-name')[4]).hasText('parentDoSomething', 'should display 1 inherited method');
});


Expand Down Expand Up @@ -355,19 +355,19 @@ test('clicking all toggles off should only show public', async function(assert)
{{/api-index-filter}}
`);

assert.equal(findAll('.method-name').length, 5, 'should display all methods');
assert.equal(findAll('.method-name')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.equal(findAll('.method-name')[1].textContent.trim(), 'doSomethingDeprecated', 'should display 1 deprecated method');
assert.equal(findAll('.method-name')[2].textContent.trim(), 'doSomethingPrivate', 'should display 1 private method');
assert.equal(findAll('.method-name')[3].textContent.trim(), 'doSomethingProtected', 'should display 1 protected method');
assert.equal(findAll('.method-name')[4].textContent.trim(), 'parentDoSomething', 'should display 1 inherited method');
assert.dom('.method-name').exists({ count: 5 }, 'should display all methods');
assert.dom(findAll('.method-name')[0]).hasText('doSomething', 'should display 1 public method');
assert.dom(findAll('.method-name')[1]).hasText('doSomethingDeprecated', 'should display 1 deprecated method');
assert.dom(findAll('.method-name')[2]).hasText('doSomethingPrivate', 'should display 1 private method');
assert.dom(findAll('.method-name')[3]).hasText('doSomethingProtected', 'should display 1 protected method');
assert.dom(findAll('.method-name')[4]).hasText('parentDoSomething', 'should display 1 inherited method');

await click('#private-toggle');
await click('#inherited-toggle');
await click('#protected-toggle');
await click('#deprecated-toggle');

assert.equal(findAll('.method-name').length, 1, 'should display all methods');
assert.equal(findAll('.method-name')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.dom('.method-name').exists({ count: 1 }, 'should display all methods');
assert.dom(findAll('.method-name')[0]).hasText('doSomething', 'should display 1 public method');

});
64 changes: 32 additions & 32 deletions tests/integration/components/api-index-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import EmberObject from '@ember/object';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { click, findAll, find } from 'ember-native-dom-helpers';
import { click, findAll } from 'ember-native-dom-helpers';

moduleForComponent('api-index', 'Integration | Component | api index', {
integration: true
Expand Down Expand Up @@ -63,13 +63,13 @@ test('should display api index', function (assert) {
{{/each}}
{{/api-index}}
`);
assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections');
assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section');
assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section');
assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section');
assert.equal(find('.spec-method-list>li>a').textContent.trim(), 'doSomething', 'should display 1 method');
assert.equal(find('.spec-property-list>li>a').textContent.trim(), 'isSomething', 'should display 1 property');
assert.equal(find('.spec-event-list>li>a').textContent.trim(), 'didSomething', 'should display 1 event');
assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections');
assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section');
assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section');
assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section');
assert.dom('.spec-method-list>li>a').hasText('doSomething', 'should display 1 method');
assert.dom('.spec-property-list>li>a').hasText('isSomething', 'should display 1 property');
assert.dom('.spec-event-list>li>a').hasText('didSomething', 'should display 1 event');
});

test('should display text when no methods', function (assert) {
Expand Down Expand Up @@ -123,13 +123,13 @@ test('should display text when no methods', function (assert) {
{{/each}}
{{/api-index}}
`);
assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections');
assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section');
assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section');
assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section');
assert.equal(find('.spec-method-list').textContent.trim(), 'No documented items', 'should display no items text');
assert.equal(find('.spec-property-list').textContent.trim(), 'isSomething', 'should display 1 property');
assert.equal(find('.spec-event-list').textContent.trim(), 'didSomething', 'should display 1 event');
assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections');
assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section');
assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section');
assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section');
assert.dom('.spec-method-list').hasText('No documented items', 'should display no items text');
assert.dom('.spec-property-list').hasText('isSomething', 'should display 1 property');
assert.dom('.spec-event-list').hasText('didSomething', 'should display 1 event');
});

test('should display api index with filter', function (assert) {
Expand Down Expand Up @@ -253,13 +253,13 @@ test('should display api index with filter', function (assert) {
{{/api-index}}
{{/api-index-filter}}
`);
assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections');
assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section');
assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section');
assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section');
assert.equal(find('.spec-method-list').textContent.trim(), 'doSomething', 'should display 1 method');
assert.equal(find('.spec-property-list').textContent.trim(), 'isSomething', 'should display 1 property');
assert.equal(find('.spec-event-list').textContent.trim(), 'didSomething', 'should display 1 event');
assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections');
assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section');
assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section');
assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section');
assert.dom('.spec-method-list').hasText('doSomething', 'should display 1 method');
assert.dom('.spec-property-list').hasText('isSomething', 'should display 1 property');
assert.dom('.spec-event-list').hasText('didSomething', 'should display 1 event');
});


Expand Down Expand Up @@ -382,17 +382,17 @@ test('should display inherited method when show inherited toggled on', async fun
{{/api-index}}
{{/api-index-filter}}
`);
assert.equal(findAll('.api-index-section-title').length, 3, 'should show 3 sections');
assert.equal(findAll('.api-index-section-title')[0].textContent, 'Methods', 'should have methods as first section');
assert.equal(findAll('.api-index-section-title')[1].textContent, 'Properties', 'should have properties as second section');
assert.equal(findAll('.api-index-section-title')[2].textContent, 'Events', 'should have events as third section');
assert.equal(find('.spec-method-list>li>a').textContent.trim(), 'doSomething', 'should display 1 method');
assert.equal(find('.spec-property-list>li>a').textContent.trim(), 'isSomething', 'should display 1 property');
assert.equal(find('.spec-event-list>li>a').textContent.trim(), 'didSomething', 'should display 1 event');
assert.dom('.api-index-section-title').exists({ count: 3 }, 'should show 3 sections');
assert.dom(findAll('.api-index-section-title')[0]).hasText('Methods', 'should have methods as first section');
assert.dom(findAll('.api-index-section-title')[1]).hasText('Properties', 'should have properties as second section');
assert.dom(findAll('.api-index-section-title')[2]).hasText('Events', 'should have events as third section');
assert.dom('.spec-method-list>li>a').hasText('doSomething', 'should display 1 method');
assert.dom('.spec-property-list>li>a').hasText('isSomething', 'should display 1 property');
assert.dom('.spec-event-list>li>a').hasText('didSomething', 'should display 1 event');

await click('#inherited-toggle');

assert.equal(findAll('.spec-method-list>li>a').length, 2, 'should display 2 methods total');
assert.equal(findAll('.spec-method-list>li>a')[0].textContent.trim(), 'doSomething', 'should display 1 public method');
assert.equal(findAll('.spec-method-list>li>a')[1].textContent.trim(), 'parentDoSomething', 'should display 1 inherited method');
assert.dom('.spec-method-list>li>a').exists({ count: 2 }, 'should display 2 methods total');
assert.dom(findAll('.spec-method-list>li>a')[0]).hasText('doSomething', 'should display 1 public method');
assert.dom(findAll('.spec-method-list>li>a')[1]).hasText('parentDoSomething', 'should display 1 inherited method');
});
12 changes: 6 additions & 6 deletions tests/integration/components/class-field-description-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import EmberObject from '@ember/object';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { find, findAll, triggerEvent } from 'ember-native-dom-helpers';
import { findAll, triggerEvent } from 'ember-native-dom-helpers';

moduleForComponent('class-field-description', 'Integration | Component | class field description', {
integration: true
Expand All @@ -19,10 +19,10 @@ test('it renders', function(assert) {

this.render(hbs`{{class-field-description type=type field=field}}`);

assert.equal(find('.method-name').textContent.trim(), 'concat');
assert.equal(findAll('.access')[0].textContent.trim(), 'public');
assert.equal(findAll('.access')[1].textContent.trim(), 'deprecated');
assert.equal(findAll('.args')[0].textContent.trim(), '(param1, param2, param3)');
assert.dom('.method-name').hasText('concat');
assert.dom(findAll('.access')[0]).hasText('public');
assert.dom(findAll('.access')[1]).hasText('deprecated');
assert.dom(findAll('.args')[0]).hasText('(param1, param2, param3)');
});


Expand All @@ -39,5 +39,5 @@ test('On hover -- the link icon shows up', async function(assert) {
this.render(hbs`{{class-field-description type=type field=field}}`);

await triggerEvent('.class-field-description--link', 'mouseenter');
assert.ok(find('.class-field-description--link-hover'), 'The link icon appears when hovering on the method text');
assert.dom('.class-field-description--link-hover').exists('The link icon appears when hovering on the method text');
});
8 changes: 4 additions & 4 deletions tests/integration/components/table-of-contents-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ skip('it renders', function(assert) {
classesIDs=classesIDs
}}`);

assert.equal(findAll('.toc-level-0 > a')[2].textContent.trim(), 'Classes');
assert.equal(findAll('.toc-level-1 li').length, 2, 'We have two items to display');
assert.equal(findAll('.toc-level-1 li')[0].textContent.trim(), 'Descriptor');
assert.equal(findAll('.toc-level-1 li')[1].textContent.trim(), 'Ember');
assert.dom(findAll('.toc-level-0 > a')[2]).hasText('Classes');
assert.dom('.toc-level-1 li').exists({ count: 2 }, 'We have two items to display');
assert.dom(findAll('.toc-level-1 li')[0]).hasText('Descriptor');
assert.dom(findAll('.toc-level-1 li')[1]).hasText('Ember');
});
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6959,6 +6959,13 @@ quick-temp@^0.1.0, quick-temp@^0.1.2, quick-temp@^0.1.3, quick-temp@^0.1.5, quic
rimraf "^2.5.4"
underscore.string "~3.3.4"

qunit-dom@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/qunit-dom/-/qunit-dom-0.3.2.tgz#175e70d5f2c084c9c0ab26a2869ed9ab2f9ab936"
dependencies:
broccoli-funnel "^2.0.0"
broccoli-merge-trees "^2.0.0"

qunit-notifications@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/qunit-notifications/-/qunit-notifications-0.1.1.tgz#3001afc6a6a77dfbd962ccbcddde12dec5286c09"
Expand Down