/*globals define, require*/
/*jslint nomen:true*/
// since jscoverage strips named defines, we mock the data directly as defined (in require.js)
require.s.contexts._.defined['de_epages/externalcontent/gadgetdialog/JSONGetGadgetInformation'] = {
"GadgetGroups": [{
"Alias": "Information",
"Gadgets": [{
"Alias": "RSS"
}, {
"Alias": "Maps"
}, {
"Alias": "Translation"
}]
}, {
"Alias": "Multimedia",
"Gadgets": [{
"Alias": "ExternalVideo"
}, {
"Alias": "ContentSlider"
}]
}, {
"Alias": "Social",
"Gadgets": [{
"Alias": "Facebook"
}, {
"Alias": "Twitter"
}, {
"Alias": "GooglePlus"
}, {
"Alias": "OtherButtons"
}]
}]
};
define([
'jquery',
'testsuite/qunit',
'./over-view',
'$ready!'
/**
* gadgetsdialog test case: constants
* @param {[type]} $ jQuery
* @param {[type]} QUnit QUnit
* @param {[type]} Overview Instance of overview
*/
], function ($, QUnit, Overview) {
'use strict';
var overview,
fixture = $('#qunit-fixture');
QUnit.module('de_epages/externalcontent/gadgetdialog/over-view', {
setup: function () {
overview = new Overview();
overview.render().$el.appendTo(fixture);
overview.on('select', function (_selectedGadget) {
QUnit.strictEqual(
_selectedGadget.alias,
'rss',
'Check gadget "rss" is selected'
);
})
},
teardown: function () {}
});
QUnit.test('Check over-view methods', 2, function () {
$.each([
'render',
'select'
], function () {
QUnit.strictEqual(
$.isFunction(overview[this]),
true,
'Check if ' + this + ' is a method of over-view'
);
});
});
QUnit.test('Check if content is rendered', 1 + 1, function () {
QUnit.strictEqual(
fixture.find('div').children().length > 0,
true,
'Check if content is rendered'
);
// 2nd test is executed when select event is fired (see setup)
$('input[value=RSS]').trigger('change');
});
});