Cleanup of custom isVisible/isNotVisible assertions
Removes the custom implementation of `isVisible/isNotVisible` in favor of qunit-dom's variants.
MODIFY
package.json
package.json
]
},
"dependencies": {
- "ember-cli-babel": "^7.1.3",
"@types/ember": "^3.0.23",
- "@types/rsvp": "^4.0.2"
+ "@types/rsvp": "^4.0.2",
+ "ember-cli-babel": "^7.1.3"
},
"devDependencies": {
"@glimmer/env": "^0.1.7",

MODIFY
tests/integration/deferred-render-in-component-test.js
tests/integration/deferred-render-in-component-test.js
@@ -51,26 +51,22 @@ module('Integration | Component | when rendered in component', function(hooks) {
test('deferred element is visible following whenRoutePainted', async function(assert) {
assert.expect(2);
- let foo;
-
this.owner.register(
'template:components/deferred-render',
- hbs`{{#if showFoo}}<span class="foo"></span>{{/if}}`
+ hbs`{{#if showFoo}}<span class="foo">I can haz visibility</span>{{/if}}`
);
beginTransition();
await render(hbs`{{deferred-render}}`);
- foo = find('.foo');
-
- assert.isNotVisible(foo);
+ assert.dom('.foo').isNotVisible();
endTransition();
- foo = await waitFor('.foo');
+ await waitFor('.foo');
- assert.isVisible(foo);
+ assert.dom('.foo').isVisible();
await settled();
});
@@ -78,26 +74,22 @@ module('Integration | Component | when rendered in component', function(hooks) {
test('deferred element is visible following whenRouteIdle', async function(assert) {
assert.expect(2);
- let foo;
-
this.owner.register(
'template:components/deferred-render',
- hbs`{{#if showBar}}<span class="bar"></span>{{/if}}`
+ hbs`{{#if showBar}}<span class="bar">I can haz visibility</span>{{/if}}`
);
beginTransition();
await render(hbs`{{deferred-render}}`);
- foo = find('.bar');
-
- assert.isNotVisible(foo);
+ assert.dom('.bar').isNotVisible();
endTransition();
- foo = await waitFor('.bar');
+ await waitFor('.bar');
- assert.isVisible(foo);
+ assert.dom('.bar').isVisible();
await settled();
});

MODIFY
tests/test-helper.js
tests/test-helper.js
@@ -4,25 +4,6 @@ import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
import QUnit from 'qunit';
-function isVisible(el) {
- return (
- el.offsetWidth !== 0 ||
- el.offsetHeight !== 0 ||
- el.getClientRects().length !== 0
- );
-}
-
-QUnit.extend(QUnit.assert, {
- isVisible: function(el, message) {
- let result = el !== null && isVisible(el);
- this.pushResult({ result, actual: result, expected: true, message });
- },
- isNotVisible: function(el, message) {
- let result = el === null || !isVisible(el);
- this.pushResult({ result, actual: result, expected: true, message });
- },
-});
-
setApplication(Application.create(config.APP));
start({
setupTestIsolationValidation: true,

MODIFY
yarn.lock
yarn.lock
@@ -2892,7 +2892,26 @@ ember-assign-polyfill@^2.6.0:
ember-cli-babel "^6.16.0"
ember-cli-version-checker "^2.0.0"
-ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.16.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.1:
+ember-cli-babel@^6.0.0-beta.4:
+ version "6.18.0"
+ resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.18.0.tgz#3f6435fd275172edeff2b634ee7b29ce74318957"
+ integrity sha512-7ceC8joNYxY2wES16iIBlbPSxwKDBhYwC8drU3ZEvuPDMwVv1KzxCNu1fvxyFEBWhwaRNTUxSCsEVoTd9nosGA==
+ dependencies:
+ amd-name-resolver "1.2.0"
+ babel-plugin-debug-macros "^0.2.0-beta.6"
+ babel-plugin-ember-modules-api-polyfill "^2.6.0"
+ babel-plugin-transform-es2015-modules-amd "^6.24.0"
+ babel-polyfill "^6.26.0"
+ babel-preset-env "^1.7.0"
+ broccoli-babel-transpiler "^6.5.0"
+ broccoli-debug "^0.6.4"
+ broccoli-funnel "^2.0.0"
+ broccoli-source "^1.1.0"
+ clone "^2.0.0"
+ ember-cli-version-checker "^2.1.2"
+ semver "^5.5.0"
+
+ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.16.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.1:
version "6.17.1"
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.17.1.tgz#db2d325da1975149b688177f44915903fa2ecb9f"
dependencies:
@@ -3234,6 +3253,7 @@ ember-load-initializers@^2.0.0:
ember-maybe-import-regenerator@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/ember-maybe-import-regenerator/-/ember-maybe-import-regenerator-0.1.6.tgz#35d41828afa6d6a59bc0da3ce47f34c573d776ca"
+ integrity sha1-NdQYKK+m1qWbwNo85H80xXPXdso=
dependencies:
broccoli-funnel "^1.0.1"
broccoli-merge-trees "^1.0.0"
@@ -5023,7 +5043,6 @@ listr-silent-renderer@^1.1.1:
listr-update-renderer@^0.4.0:
version "0.4.0"
- uid "06073fa93166277607a7814f4e1f83960081414c"
resolved "https://github.com/okonet/listr-update-renderer/tarball/upgrade-log-update#06073fa93166277607a7814f4e1f83960081414c"
dependencies:
chalk "^1.1.3"
@@ -6555,6 +6574,7 @@ regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1:
regenerator-runtime@^0.9.5:
version "0.9.6"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.9.6.tgz#d33eb95d0d2001a4be39659707c51b0cb71ce029"
+ integrity sha1-0z65XQ0gAaS+OWWXB8UbDLcc4Ck=
regenerator-transform@0.9.11:
version "0.9.11"

Cleanup of custom isVisible/isNotVisible assertions (#188)

Removes the custom implementation of `isVisible/isNotVisible` in favor of qunit-dom's variants.