Hi guys, I am learning how to test but I failed. I want to make sure when a user click a button the fancybox open. Here is what I tried:
//test
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { make, manualSetup } from 'ember-data-factory-guy';
moduleForComponent('cal-cell', 'Integration | Component | cal cell', {
integration: true,
beforeEach: function () {
manualSetup(this.container);
}
test('it opens fancybox on zoom button click', function(assert) {
this.set('event', make('event', 'camera'));
this.render(hbs`{{cal-cell event=event}}`);
//Click on the button
this.$('.glyphicon-zoom-in').click();
assert.ok($.fancybox.isOpen, 'fancybox opened')
});
My template:
<a class="btn btn-xs btn-default fancybox" href="{{event.images.0.url}}" rel="cal">
<span class="glyphicon glyphicon-zoom-in"></span>
</a>
The component works well in development and production environment, when in test environment it just do redirect.
Please help. Thanks