Skip to content

Commit cd2bdc2

Browse files
authored
fix: Remove ember-cli-string-helpers (#1672)
* 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 * 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 <body> 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.
1 parent 6c7633e commit cd2bdc2

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

addon/helpers/capitalize.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { helper } from '@ember/component/helper';
2+
import { capitalize } from '@ember/string';
3+
4+
export default helper(function capitalizeHelper(positional) {
5+
return capitalize(positional[0]);
6+
});

app/helpers/capitalize.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'ember-cli-addon-docs/helpers/capitalize';

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"ember-cli-clipboard": "^1.2.1",
5454
"ember-cli-htmlbars": "^6.3.0",
5555
"ember-cli-postcss": "^8.2.0",
56-
"ember-cli-string-helpers": "^6.1.0",
5756
"ember-cli-string-utils": "^1.1.0",
5857
"ember-cli-version-checker": "^5.1.2",
5958
"ember-code-snippet": "^3.0.0",

pnpm-lock.yaml

-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/dummy/config/environment.js

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ module.exports = function (environment) {
3939

4040
ENV.APP.rootElement = '#ember-testing';
4141
ENV.APP.autoboot = false;
42+
43+
ENV['ember-tether'] = {
44+
bodyElementId: 'ember-testing',
45+
};
4246
}
4347

4448
if (environment === 'production') {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'dummy/tests/helpers';
3+
import { render } from '@ember/test-helpers';
4+
import { hbs } from 'ember-cli-htmlbars';
5+
import { capitalize } from '@ember/string';
6+
7+
module('Integration | Helper | capitalize', function (hooks) {
8+
setupRenderingTest(hooks);
9+
10+
test('it renders', async function (assert) {
11+
const testString = 'abc 123 ABC !@# Foo Bar';
12+
this.set('inputValue', testString);
13+
14+
await render(hbs`{{capitalize this.inputValue}}`);
15+
16+
assert.dom().hasText(capitalize(testString));
17+
});
18+
});

0 commit comments

Comments
 (0)