Skip to content

Commit

Permalink
fix: embroider-safe and embroider-optimized builds (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhinterlong committed Oct 21, 2021
1 parent 88d68b3 commit 26e77a8
Show file tree
Hide file tree
Showing 6 changed files with 3,258 additions and 3,265 deletions.
6 changes: 3 additions & 3 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');
//const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');

module.exports = async function () {
return {
Expand Down Expand Up @@ -75,8 +75,8 @@ module.exports = async function () {
},
},
},
// embroiderSafe(),
// embroiderOptimized(),
embroiderSafe(),
embroiderOptimized(),
],
};
};
4 changes: 3 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ module.exports = function (defaults) {
*/

const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app);
return maybeEmbroider(app, {
skipBabel: [{ package: 'qunit' }, { package: 'gridstack' }],
});
};
8 changes: 8 additions & 0 deletions tests/dummy/app/components/event-listener.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Component from '@glimmer/component';

export default class EventListener extends Component {
constructor() {
super(...arguments);
this.args.init();
}
}
2 changes: 0 additions & 2 deletions tests/integration/components/grid-stack-item-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-components */
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
Expand Down
20 changes: 7 additions & 13 deletions tests/integration/components/grid-stack-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable ember/no-component-lifecycle-hooks */
/* eslint-disable ember/no-classic-components */
import Component from '@ember/component';
import { action } from '@ember/object';
import { run, next } from '@ember/runloop';
import { A, isArray } from '@ember/array';
Expand Down Expand Up @@ -117,24 +114,21 @@ module('Integration | Component | grid stack', function (hooks) {
});

test('grid stack item events', async function (assert) {
const done = assert.async();
assert.expect(1);

// Create fake component for listening to events
let eventListener = class extends Component {
didInsertElement() {
super.didInsertElement(...arguments);
this.containerComponent.element.addEventListener('resizestop', () => {
assert.ok(true, 'resize action is called when item is resized');
});
}
this.init = (containerComponent) => {
containerComponent.element.addEventListener('resizestop', () => {
assert.ok(true, 'resize action is called when item is resized');
done();
});
};

this.owner.register('component:event-listener', eventListener);

await render(hbs`
<GridStack>
<GridStackItem as |item|>
<EventListener @containerComponent={{item}}/>
<EventListener @init={{fn this.init item}}/>
</GridStackItem>
<div class="a-different-item" />
</GridStack>
Expand Down

0 comments on commit 26e77a8

Please sign in to comment.