From dcbcc783f7712e7fadd4efb1745d4bfc499490a9 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 19 May 2025 16:38:20 +0100 Subject: [PATCH 1/2] DEV: Add test for plugin-outlet whitespace Fixes for recent regressions: - da6b82f7767cbeb038dfbebda92a4474626ff1e8 - 2a18834db1cb6b9c8f071eeab8554257336b2802 --- .../components/plugin-outlet-test.gjs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs index 9e9711b50604e..4434f12a61c8c 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs +++ b/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs @@ -1134,3 +1134,53 @@ module( }); } ); + +module( + "Integration | Component | plugin-outlet | whitespace", + function (hooks) { + setupRenderingTest(hooks); + + test("no whitespace for unused outlet", async function (assert) { + await render( + + ); + assert.dom(".test-wrapper").hasText(/^$/, "no whitespace"); // using regex to avoid hasText builtin strip + }); + + test("no whitespace for used outlet", async function (assert) { + extraConnectorComponent("test-name", ); + + await render( + + ); + assert.dom(".test-wrapper").hasText(/^$/, "no whitespace"); // using regex to avoid hasText builtin strip + }); + + test("no whitespace for unused wrapper outlet", async function (assert) { + await render( + + ); + assert.dom(".test-wrapper").hasText(/^foo$/, "no whitespace"); // using regex to avoid hasText builtin strip + }); + + test("no whitespace for used wrapper outlet", async function (assert) { + extraConnectorComponent("test-name", ); + await render( + + ); + assert.dom(".test-wrapper").hasText(/^foo$/, "no whitespace"); // using regex to avoid hasText builtin strip + }); + } +); From 3b2299df08ff7a9e97165d5e3cba22252912499f Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 19 May 2025 16:42:48 +0100 Subject: [PATCH 2/2] lint --- .../tests/integration/components/plugin-outlet-test.gjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs index 4434f12a61c8c..b2f044d080947 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs +++ b/app/assets/javascripts/discourse/tests/integration/components/plugin-outlet-test.gjs @@ -1172,7 +1172,10 @@ module( }); test("no whitespace for used wrapper outlet", async function (assert) { - extraConnectorComponent("test-name", ); + extraConnectorComponent( + "test-name", + + ); await render(