Skip to content

Commit

Permalink
Move helper to test-app helper inside app to fix embroider-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp committed Jun 26, 2024
1 parent 326d2cb commit 23d4e5c
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 60 deletions.
5 changes: 5 additions & 0 deletions test-app-3.x/app/helpers/get-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { helper } from '@ember/component/helper';

export default helper(function getFormat(/*positional, named*/) {
return 'L';
});
12 changes: 0 additions & 12 deletions test-app-3.x/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ module.exports = function (defaults) {
});

return maybeEmbroider(app, {
packageRules: [
{
package: 'test-app-3.x',
// Pre-strict mode, helpers and components are ambiguous
helpers: {
'{{get-format}}': { safeToIgnore: true },
},
components: {
'{{get-format}}': { safeToIgnore: true },
},
},
],
skipBabel: [
{
package: 'qunit',
Expand Down
17 changes: 17 additions & 0 deletions test-app-3.x/tests/integration/helpers/get-format-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Helper | get-format', function (hooks) {
setupRenderingTest(hooks);

// TODO: Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', 'L');

await render(hbs`{{get-format 'global-format'}}`);

assert.dom(this.element).hasText('L');
});
});
8 changes: 0 additions & 8 deletions test-app-3.x/tests/unit/helpers/moment-format-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import EmberObject from '@ember/object';
import { run } from '@ember/runloop';
import { helper } from '@ember/component/helper';
import { settled } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { module, test } from 'qunit';
Expand Down Expand Up @@ -128,13 +127,6 @@ module('moment-format', function (hooks) {
test('can be called using subexpression', async function (assert) {
assert.expect(1);

this.owner.register(
'helper:get-format',
helper(function () {
return 'L';
})
);

this.set('date', date(0));
await render(hbs`{{moment-format this.date (get-format 'global-format')}}`);
assert.dom(this.element).hasText('12/31/1969');
Expand Down
5 changes: 5 additions & 0 deletions test-app-4.x/app/helpers/get-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { helper } from '@ember/component/helper';

export default helper(function getFormat(/*positional, named*/) {
return 'L';
});
12 changes: 0 additions & 12 deletions test-app-4.x/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ module.exports = function (defaults) {

const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
packageRules: [
{
package: 'test-app-4.x',
// Pre-strict mode, helpers and components are ambiguous
helpers: {
'{{get-format}}': { safeToIgnore: true },
},
components: {
'{{get-format}}': { safeToIgnore: true },
},
},
],
skipBabel: [
{
package: 'qunit',
Expand Down
17 changes: 17 additions & 0 deletions test-app-4.x/tests/integration/helpers/get-format-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Helper | get-format', function (hooks) {
setupRenderingTest(hooks);

// TODO: Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', 'L');

await render(hbs`{{get-format 'global-format'}}`);

assert.dom(this.element).hasText('L');
});
});
8 changes: 0 additions & 8 deletions test-app-4.x/tests/unit/helpers/moment-format-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import EmberObject from '@ember/object';
import { run } from '@ember/runloop';
import { helper } from '@ember/component/helper';
import { settled } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { module, test } from 'qunit';
Expand Down Expand Up @@ -128,13 +127,6 @@ module('moment-format', function (hooks) {
test('can be called using subexpression', async function (assert) {
assert.expect(1);

this.owner.register(
'helper:get-format',
helper(function () {
return 'L';
}),
);

this.set('date', date(0));
await render(hbs`{{moment-format this.date (get-format 'global-format')}}`);
assert.dom(this.element).hasText('12/31/1969');
Expand Down
5 changes: 5 additions & 0 deletions test-app-5.x/app/helpers/get-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { helper } from '@ember/component/helper';

export default helper(function getFormat(/*positional, named*/) {
return 'L';
});
12 changes: 0 additions & 12 deletions test-app-5.x/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ module.exports = function (defaults) {

const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
packageRules: [
{
package: 'test-app-5.x',
// Pre-strict mode, helpers and components are ambiguous
helpers: {
'{{get-format}}': { safeToIgnore: true },
},
components: {
'{{get-format}}': { safeToIgnore: true },
},
},
],
skipBabel: [
{
package: 'qunit',
Expand Down
17 changes: 17 additions & 0 deletions test-app-5.x/tests/integration/helpers/get-format-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Helper | get-format', function (hooks) {
setupRenderingTest(hooks);

// TODO: Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', 'L');

await render(hbs`{{get-format 'global-format'}}`);

assert.dom(this.element).hasText('L');
});
});
8 changes: 0 additions & 8 deletions test-app-5.x/tests/unit/helpers/moment-format-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import EmberObject from '@ember/object';
import { run } from '@ember/runloop';
import { helper } from '@ember/component/helper';
import { settled } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { module, test } from 'qunit';
Expand Down Expand Up @@ -128,13 +127,6 @@ module('moment-format', function (hooks) {
test('can be called using subexpression', async function (assert) {
assert.expect(1);

this.owner.register(
'helper:get-format',
helper(function () {
return 'L';
}),
);

this.set('date', date(0));
await render(hbs`{{moment-format this.date (get-format 'global-format')}}`);
assert.dom(this.element).hasText('12/31/1969');
Expand Down

0 comments on commit 23d4e5c

Please sign in to comment.