From 916cd8604cac0eda1ab1924d150fdd5008c79f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bryxi=CC=81?= Date: Wed, 23 Apr 2025 09:15:34 +0200 Subject: [PATCH 1/2] fix: Remove ember-cli-string-helpers - This pulls @ember/string 3.1.1 into dependent project and that causes a lot of issues - Since we have `capitalize` in @ember/string, we can just call that in our internal helper - Also bumped internal version of @ember/string to v4.x Fixes #1666 --- addon/helpers/capitalize.js | 6 ++++++ app/helpers/capitalize.js | 1 + package.json | 1 - pnpm-lock.yaml | 16 ---------------- tests/integration/helpers/capitalize-test.js | 18 ++++++++++++++++++ 5 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 addon/helpers/capitalize.js create mode 100644 app/helpers/capitalize.js create mode 100644 tests/integration/helpers/capitalize-test.js diff --git a/addon/helpers/capitalize.js b/addon/helpers/capitalize.js new file mode 100644 index 000000000..8c30a5874 --- /dev/null +++ b/addon/helpers/capitalize.js @@ -0,0 +1,6 @@ +import { helper } from '@ember/component/helper'; +import { capitalize } from '@ember/string'; + +export default helper(function capitalizeHelper(positional) { + return capitalize(positional[0]); +}); diff --git a/app/helpers/capitalize.js b/app/helpers/capitalize.js new file mode 100644 index 000000000..9a588d7c0 --- /dev/null +++ b/app/helpers/capitalize.js @@ -0,0 +1 @@ +export { default } from 'ember-cli-addon-docs/helpers/capitalize'; diff --git a/package.json b/package.json index a8cfbff3f..9e4c4375c 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "ember-cli-clipboard": "^1.2.1", "ember-cli-htmlbars": "^6.3.0", "ember-cli-postcss": "^8.2.0", - "ember-cli-string-helpers": "^6.1.0", "ember-cli-string-utils": "^1.1.0", "ember-cli-version-checker": "^5.1.2", "ember-code-snippet": "^3.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 944807cda..e42a77865 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,9 +77,6 @@ importers: ember-cli-postcss: specifier: ^8.2.0 version: 8.2.0 - ember-cli-string-helpers: - specifier: ^6.1.0 - version: 6.1.0 ember-cli-string-utils: specifier: ^1.1.0 version: 1.1.0 @@ -3954,10 +3951,6 @@ packages: resolution: {integrity: sha512-YG/lojDxkur9Bnskt7xB6gUOtJ6aPl/+JyGYm9HNDk3GECVHB3SMN3rlGhDKHa1ndS5NK2W2TSLb9bzRbGlMdg==} engines: {node: '>= 0.10.0'} - ember-cli-string-helpers@6.1.0: - resolution: {integrity: sha512-Lw8B6MJx2n8CNF2TSIKs+hWLw0FqSYjr2/NRPyquyYA05qsl137WJSYW3ZqTsLgoinHat0DGF2qaCXocLhLmyA==} - engines: {node: 10.* || >=12.*} - ember-cli-string-utils@1.1.0: resolution: {integrity: sha512-PlJt4fUDyBrC/0X+4cOpaGCiMawaaB//qD85AXmDRikxhxVzfVdpuoec02HSiTGTTB85qCIzWBIh8lDOiMyyFg==} @@ -13477,15 +13470,6 @@ snapshots: transitivePeerDependencies: - supports-color - ember-cli-string-helpers@6.1.0: - dependencies: - '@babel/core': 7.26.0 - broccoli-funnel: 3.0.8 - ember-cli-babel: 7.26.11 - resolve: 1.22.8 - transitivePeerDependencies: - - supports-color - ember-cli-string-utils@1.1.0: {} ember-cli-terser@4.0.2: diff --git a/tests/integration/helpers/capitalize-test.js b/tests/integration/helpers/capitalize-test.js new file mode 100644 index 000000000..9d464d1ca --- /dev/null +++ b/tests/integration/helpers/capitalize-test.js @@ -0,0 +1,18 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'dummy/tests/helpers'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { capitalize } from '@ember/string'; + +module('Integration | Helper | capitalize', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + const testString = 'abc 123 ABC !@# Foo Bar'; + this.set('inputValue', testString); + + await render(hbs`{{capitalize this.inputValue}}`); + + assert.dom().hasText(capitalize(testString)); + }); +}); From 3ea95ac8946a4aca29e906f36720fbc29ddb8f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Bryxi=CC=81?= Date: Fri, 2 May 2025 16:01:01 +0200 Subject: [PATCH 2/2] fix: ember-tether & testing issues - As per [ember-tether documentation](https://github.com/yapplabs/ember-tether) in testing mode we have to make sure that the portal is attached to correct DOM scope > Tether works by appending tethered elements to the tag. Unfortunately, this moves your content outside of the Ember application rootElement during acceptance testing. This breaks event dispatch and action handling, including traditional Ember test helpers like click. This fixes all tests that fail because search popup can't be find. --- tests/dummy/config/environment.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 017884246..eee6b681f 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -39,6 +39,10 @@ module.exports = function (environment) { ENV.APP.rootElement = '#ember-testing'; ENV.APP.autoboot = false; + + ENV['ember-tether'] = { + bodyElementId: 'ember-testing', + }; } if (environment === 'production') {