Skip to content

Commit 51ae99b

Browse files
committed
[CLEANUP] remove branching for pre-Octane optional feature
This was deprecated and removed in 4.0, which is now the minimum supported version.
1 parent cbbadbe commit 51ae99b

File tree

3 files changed

+12
-50
lines changed

3 files changed

+12
-50
lines changed

addon/src/setup-application-context.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
isTestContext,
55
type TestContext,
66
} from './setup-context.ts';
7-
import global from './global.ts';
87
import hasEmberVersion from './has-ember-version.ts';
98
import settled from './settled.ts';
109
import getTestMetadata from './test-metadata.ts';
@@ -168,13 +167,7 @@ export function visit(
168167
return visitResult;
169168
})
170169
.then(() => {
171-
if (global.EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false) {
172-
context.element = document.querySelector(
173-
'#ember-testing > .ember-view',
174-
);
175-
} else {
176-
context.element = document.querySelector('#ember-testing');
177-
}
170+
context.element = document.querySelector('#ember-testing');
178171
})
179172
.then(settled)
180173
.then(() => {

addon/src/setup-rendering-context.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { run } from '@ember/runloop';
22
import Ember from 'ember';
3-
import global from './global.ts';
43
import {
54
type BaseContext,
65
type TestContext,
@@ -315,18 +314,7 @@ export default function setupRenderingContext(
315314
Object.defineProperty(renderingContext, 'element', {
316315
configurable: true,
317316
enumerable: true,
318-
// ensure the element is based on the wrapping toplevel view
319-
// Ember still wraps the main application template with a
320-
// normal tagged view
321-
//
322-
// In older Ember versions (2.4) the element itself is not stable,
323-
// and therefore we cannot update the `this.element` until after the
324-
// rendering is completed
325-
value:
326-
global.EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false
327-
? getRootElement().querySelector('.ember-view')
328-
: getRootElement(),
329-
317+
value: getRootElement(),
330318
writable: false,
331319
});
332320

test-app/tests/unit/setup-rendering-context-test.js

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* globals EmberENV */
21
import { module, test } from 'qunit';
32
import Service from '@ember/service';
43
import Component, { setComponentTemplate } from '@ember/component';
@@ -137,36 +136,18 @@ module('setupRenderingContext', function (hooks) {
137136
assert.equal(this.element.textContent, 'hello!');
138137
});
139138

140-
if (EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false) {
141-
test('render exposes an `.element` property with application template wrapper', async function (assert) {
142-
let rootElement = document.getElementById('ember-testing');
143-
assert.notEqual(
144-
this.element,
145-
rootElement,
146-
'this.element should not be rootElement'
147-
);
148-
assert.ok(
149-
rootElement.contains(this.element),
150-
'this.element is _within_ the rootElement'
151-
);
152-
await render(hbs`<p>Hello!</p>`);
153-
154-
assert.equal(this.element.textContent, 'Hello!');
155-
});
156-
} else {
157-
test('render exposes an `.element` property without an application template wrapper', async function (assert) {
158-
let rootElement = document.getElementById('ember-testing');
159-
assert.equal(
160-
this.element,
161-
rootElement,
162-
'this.element should _be_ rootElement'
163-
);
139+
test('render exposes an `.element` property without an application template wrapper', async function (assert) {
140+
let rootElement = document.getElementById('ember-testing');
141+
assert.equal(
142+
this.element,
143+
rootElement,
144+
'this.element should _be_ rootElement'
145+
);
164146

165-
await render(hbs`<p>Hello!</p>`);
147+
await render(hbs`<p>Hello!</p>`);
166148

167-
assert.equal(this.element.textContent, 'Hello!');
168-
});
169-
}
149+
assert.equal(this.element.textContent, 'Hello!');
150+
});
170151

171152
test('is settled after rendering', async function (assert) {
172153
await render(hbs`Hi!`);

0 commit comments

Comments
 (0)