Skip to content

Commit

Permalink
[v4] Drop ember-compatibility-helpers (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic authored and twokul committed Sep 7, 2022
1 parent 474f24b commit 4b4bd50
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 45 deletions.
11 changes: 2 additions & 9 deletions addon/-private/data-view/elements/occluded-content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { set } from '@ember/object';
import { DEBUG } from '@glimmer/env';
import { IS_GLIMMER_2, gte as emberVersionGTE } from 'ember-compatibility-helpers';

import document from '../../utils/document-shim';

Expand All @@ -27,12 +26,6 @@ export default class OccludedContent {
this.isOccludedContent = true;
this.rendered = false;

if (!emberVersionGTE('3.0.0')) {
// In older versions of Ember, binding anything on an object in the template
// adds observers which creates __ember_meta__
this.__ember_meta__ = null; // eslint-disable-line camelcase
}

if (DEBUG) {
Object.preventExtensions(this);
}
Expand All @@ -57,11 +50,11 @@ export default class OccludedContent {
}

get realUpperBound() {
return IS_GLIMMER_2 ? this.upperBound : this.upperBound.previousSibling;
return this.upperBound;
}

get realLowerBound() {
return IS_GLIMMER_2 ? this.lowerBound : this.lowerBound.nextSibling;
return this.lowerBound;
}

get parentNode() {
Expand Down
11 changes: 2 additions & 9 deletions addon/-private/data-view/elements/virtual-component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { set } from '@ember/object';
import { assert } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import { IS_GLIMMER_2, gte as emberVersionGTE } from 'ember-compatibility-helpers';

import document from '../../utils/document-shim';

Expand All @@ -22,23 +21,17 @@ export default class VirtualComponent {

this.rendered = false;

if (!emberVersionGTE('3.0.0')) {
// In older versions of Ember, binding anything on an object in the template
// adds observers which creates __ember_meta__
this.__ember_meta__ = null; // eslint-disable-line camelcase
}

if (DEBUG) {
Object.preventExtensions(this);
}
}

get realUpperBound() {
return IS_GLIMMER_2 ? this.upperBound : this.upperBound.previousSibling;
return this.upperBound;
}

get realLowerBound() {
return IS_GLIMMER_2 ? this.lowerBound : this.lowerBound.nextSibling;
return this.lowerBound;
}

getBoundingClientRect() {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"ember-cli-babel": "^7.12.0",
"ember-cli-htmlbars": "^6.0.0",
"ember-cli-version-checker": "^5.1.2",
"ember-compatibility-helpers": "^1.2.1",
"ember-raf-scheduler": "^0.3.0"
},
"devDependencies": {
Expand Down
30 changes: 4 additions & 26 deletions tests/integration/basic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,12 @@ import {
standardTemplate
} from 'dummy/tests/helpers/test-scenarios';

import { scheduler } from 'ember-raf-scheduler';
import { gte as emberVersionGTE } from 'ember-compatibility-helpers';

// Assert an odd timing: After initial render but before settledness. Because
// of changes to the `render` helper in test-helpers, this should be done
// differently in ember-test-helpers 1.x and 2.x.
//
// Use ember-compatibility-helpers < 3 as a proxy for identifying
// ember-test-helpers 1.x.
//
// This helpers can be killed off when Ember 2.18 support is dropped. The
// gte Ember 3 version can be inlined where the helper is used.
// Assert an odd timing: After initial render but before settledness.
//
async function assertAfterInitialRender(renderFn, assertFn) {
if (emberVersionGTE('3.0.0')) {
renderFn();
await new Promise(resolve => requestAnimationFrame(resolve));
assertFn();
} else {
// After ember-raf-schedulers queues have flushed.
// The schedule of sync inside measure starts a second flush.
scheduler.schedule('measure', () => {
scheduler.schedule('sync', () => {
assertFn();
});
});
renderFn();
}
renderFn();
await new Promise(resolve => requestAnimationFrame(resolve));
assertFn();
}

module('vertical-collection', 'Integration | Basic Tests', function(hooks) {
Expand Down

0 comments on commit 4b4bd50

Please sign in to comment.