From fed4d061d501b955a260ca82738984f8056d02ea Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 6 Jun 2025 10:20:27 -0400 Subject: [PATCH 1/2] Change assert to warn for unneeded restriction around creating sub-applications --- .../views/lib/system/event_dispatcher.ts | 4 ++-- .../application/tests/application_test.js | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/@ember/-internals/views/lib/system/event_dispatcher.ts b/packages/@ember/-internals/views/lib/system/event_dispatcher.ts index db3512393fc..35cd930e1e4 100644 --- a/packages/@ember/-internals/views/lib/system/event_dispatcher.ts +++ b/packages/@ember/-internals/views/lib/system/event_dispatcher.ts @@ -1,5 +1,5 @@ import { getOwner } from '@ember/-internals/owner'; -import { assert } from '@ember/debug'; +import { assert, warn } from '@ember/debug'; import { get, set } from '@ember/-internals/metal'; import EmberObject from '@ember/object'; import { getElementView } from './utils'; @@ -162,7 +162,7 @@ export default class EventDispatcher extends EmberObject { `You cannot use the same root element (${specifiedRootElement}) multiple times in an Ember.Application`, !rootElement.classList.contains(ROOT_ELEMENT_CLASS) ); - assert( + warn( 'You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', (() => { let target = rootElement.parentNode; diff --git a/packages/@ember/application/tests/application_test.js b/packages/@ember/application/tests/application_test.js index 71fdd5c2fa7..e83e3c6a5a3 100644 --- a/packages/@ember/application/tests/application_test.js +++ b/packages/@ember/application/tests/application_test.js @@ -74,14 +74,15 @@ moduleFor( }); } - [`@test you cannot make a new application that is a descendant of an existing application`]() { - expectAssertion(() => { - runTask(() => - this.createSecondApplication({ - rootElement: '#one-child', - }) - ); - }); + [`@test you cannot make a new application that is a descendant of an existing application`]( + assert + ) { + runTask(() => + this.createSecondApplication({ + rootElement: '#one-child', + }) + ); + assert.ok(true, 'should not raise'); } [`@test you cannot make a new application that is a duplicate of an existing application`]() { From af55f7e99379292572dad9a4e5d05abd8e959d3b Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Fri, 6 Jun 2025 13:09:14 -0400 Subject: [PATCH 2/2] expectWarning --- .../application/tests/application_test.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/@ember/application/tests/application_test.js b/packages/@ember/application/tests/application_test.js index e83e3c6a5a3..36ce6cdf113 100644 --- a/packages/@ember/application/tests/application_test.js +++ b/packages/@ember/application/tests/application_test.js @@ -74,15 +74,14 @@ moduleFor( }); } - [`@test you cannot make a new application that is a descendant of an existing application`]( - assert - ) { - runTask(() => - this.createSecondApplication({ - rootElement: '#one-child', - }) - ); - assert.ok(true, 'should not raise'); + [`@test you cannot make a new application that is a descendant of an existing application`]() { + expectWarning(() => { + runTask(() => + this.createSecondApplication({ + rootElement: '#one-child', + }) + ); + }); } [`@test you cannot make a new application that is a duplicate of an existing application`]() {