/*globals define, require, start*/
/*jslint nomen: true*/
define([
'jquery',
'testsuite/qunit',
'de_epages/shop/ui/linkpicker',
'$ready!'
/**
* linkpicker test case: main view and controller
* @param {[type]} QUnit [description]
* @param {[type]} $ [description]
* @param {[type]} Linkpicker [description]
* @return {[type]} [description]
*/
], function ($, QUnit, de_epages) {
'use strict';
var container = $('#qunit-fixture'),
data = {},
linkpicker = {},
options = {
callback: function (_title, _url, _newFlag, _linkType) {
data = {
linkText: _title,
linkUrl: _url,
is_linkTargetBlank: _newFlag,
linkType: _linkType
};
}
};
linkpicker = container.shopUiLinkpicker();
QUnit.module("de_epages/shop/ui/linkpicker");
QUnit.test("Initiate Widget", function () {
QUnit.equal(linkpicker.shopUiLinkpicker('Instance') instanceof $.Widget, true, "Linkpicker widget is created and instance of jQuery.Widget");
});
QUnit.test("Check if dialog is opened / closed", function () {
linkpicker.shopUiLinkpicker('open', options);
QUnit.strictEqual($('.linkpickerDialog').length, 1, "Check if dialog is present $('.linkpickerDialog') && $('.linkpickerDialog') === 1");
linkpicker.shopUiLinkpicker('close');
QUnit.strictEqual($('.linkpickerDialog').parent().css('display'), 'none', "$('.linkpickerDialog').parent().css('display') === none");
});
QUnit.test("Check if widget is destroyed", function () {
linkpicker.shopUiLinkpicker('destroy');
QUnit.strictEqual(linkpicker.data('ui-shopUiLinkpicker'), undefined, 'Linkpicker widget was destroyed');
});
});