');
- element.appendTo('body');
- element.loader();
-
- //Loader show
- element.loader('show');
- equal($('.loading-mask').is(':visible'), true, '.loader() open');
-
- //Loader hide
- element.loader('hide');
- equal($('.loading-mask').is( ":hidden" ), true, '.loader() closed' );
-
- //Loader hide on process complete
- element.loader('show');
- element.trigger('processStop');
- equal($('.loading-mask').is('visible'), false, '.loader() closed after process');
-
- element.loader('destroy');
-
-});
-
-TestCase( 'destroy', function() {
- expect(1);
-
- var element = $("#loader").loader();
- element.loader('show');
- element.loader('destroy');
- equal( $('.loading-mask').is(':visible'), false, '.loader() destroyed');
-
-});
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader-test.js
deleted file mode 100644
index 3dd08f57ab8b3..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader-test.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-LoaderTest = TestCase('LoaderTest');
-LoaderTest.prototype.setUp = function() {
- /*:DOC +=
*/
-};
-LoaderTest.prototype.tearDown = function() {
- var loaderInstance = jQuery('#loader').data('loader');
- if(loaderInstance && loaderInstance.destroy) {
- loaderInstance.destroy();
- }
-};
-LoaderTest.prototype.getInstance = function() {
- return jQuery('#loader').data('loader');
-};
-LoaderTest.prototype.testInit = function() {
- var div = jQuery('#loader').loader();
- div.loader('show');
- assertEquals(true, div.is(':mage-loader'));
-};
-// @TODO Need to be fixed to avoid errors on the bamboo server in context of MAGETWO-5085 ticket
-/*LoaderTest.prototype._testCreateOnBeforeSend = function() {
- /*:DOC +=
*/
-/* var loader = jQuery('#loader').trigger('ajaxSend');
- assertEquals(true, loader.is(':mage-loader'));
- loader.loader('destroy');
-};*/
-LoaderTest.prototype.testLoaderOnBody = function() {
- var body = jQuery('body').loader();
- body.loader('show');
- assertEquals(true, jQuery('body div:first').is('.loading-mask'));
- body.loader('destroy');
-};
-LoaderTest.prototype.testLoaderOnDOMElement = function() {
- var div = jQuery('#loader').loader(),
- loaderInstance = this.getInstance();
- div.loader('show');
- assertEquals(true, div.find(':first-child').is(loaderInstance.spinner));
-};
-LoaderTest.prototype.testLoaderOptions = function() {
- /*:DOC +=
*/
- var div = jQuery('#loader').loader({
- icon: 'icon.gif',
- texts: {
- loaderText: 'Loader Text',
- imgAlt: 'Image Alt Text'
- }
- }),
- loaderInstance = this.getInstance();
- div.loader('show');
- assertEquals('icon.gif', loaderInstance.spinner.find('img').attr('src'));
- assertEquals('Image Alt Text', loaderInstance.spinner.find('img').attr('alt'));
- assertEquals('Loader Text', loaderInstance.spinner.find('div.popup-inner').text());
- div.loader('destroy');
- div.loader({
- template:'
'
- });
- div.loader('show');
- loaderInstance = this.getInstance();
- assertEquals(true, loaderInstance.spinner.is('#test-template'));
- div.loader('destroy');
-};
-LoaderTest.prototype.testHideOnComplete = function() {
- /*:DOC +=
*/
- var div = jQuery('#loader').loader();
- div.loader('show');
- loaderIsVisible = jQuery('.loading-mask').is(':visible');
- div.trigger('processStop');
- assertEquals(false, jQuery('.loading-mask').is(':visible') === loaderIsVisible);
-};
-LoaderTest.prototype.testRender = function() {
- /*:DOC +=
*/
- var div = jQuery('#loader').loader();
- div.loader('show');
- assertEquals(true, $('.loading-mask').is(':visible'));
-};
-LoaderTest.prototype.testShowHide = function() {
- /*:DOC +=
*/
- var div = jQuery('#loader').loader();
- div.loader('show');
- assertEquals(true, $('.loading-mask').is(':visible'));
- div.loader('hide');
- assertEquals(false, $('.loading-mask').is(':visible'));
-};
-LoaderTest.prototype.testDestroy = function() {
- /*:DOC +=
*/
- var div = jQuery('#loader').loader(),
- loaderExist = div.is(':mage-loader');
- div.loader('destroy');
- assertEquals(false, div.is(':mage-loader') === loaderExist);
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader.html b/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader.html
deleted file mode 100644
index 362dec7138276..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/loader/loader.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js
deleted file mode 100644
index 445f6619e7e35..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/mage-test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-MageTest = TestCase('MageTest');
-
-MageTest.prototype.setUp = function() {
- /*:DOC +=
*/
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js b/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js
deleted file mode 100644
index 0e1c4a3682b89..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/menu/test-menu.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * @category mage.js
- * @package test
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-
- /*
- Set key logger to check key press event
- */
- function KeyLogger( target ) {
- if ( !(this instanceof KeyLogger) ) {
- return new KeyLogger( target );
- }
- this.target = target;
- this.log = [];
-
- var self = this;
-
- this.target.off( 'keydown' ).on( 'keydown', function( event ) {
- self.log.push( event.keyCode );
- });
-}
-/*
- testing if menu get expanded class when option set to true
- */
-test( 'Menu Expanded', function() {
- expect(1);
- var menu = $('#menu');
- var menuItems = menu.find('li');
- var submenu = menuItems.find('ul');
- menu.menu({
- expanded: true
- });
- ok(submenu.hasClass('expanded'), 'Expanded Class added');
-});
-/*
- testing if down arrow is pressed
- */
-test( 'Down Arrow', function() {
- expect(1);
- var event,
- menu = $('#menu'),
- keys = KeyLogger(menu);
- event = $.Event('keydown');
- event.keyCode = $.ui.keyCode.DOWN;
- menu.trigger( event );
- equal( keys.log[ 0 ], 40, 'Down Arrow Was Pressed' );
-});
-/*
- testing if up arrow is pressed
- */
-test( 'Up Arrow', function() {
- expect(1);
- var event,
- menu = $('#menu'),
- keys = KeyLogger(menu);
- event = $.Event('keydown');
- event.keyCode = $.ui.keyCode.UP;
- menu.trigger( event );
- equal( keys.log[ 0 ], 38, 'Up Arrow Was Pressed' );
-});
-/*
- testing if left arrow is pressed
- */
-test( 'Left Arrow', function() {
- expect(1);
- var event,
- menu = $('#menu'),
- keys = KeyLogger(menu);
- event = $.Event('keydown');
- event.keyCode = $.ui.keyCode.LEFT;
- menu.trigger( event );
- equal( keys.log[ 0 ], 37, 'Left Arrow Was Pressed' );
-});
-/*
- testing if right arrow is pressed
- */
-test( 'Right Arrow', function() {
- expect(1);
- var event,
- menu = $('#menu'),
- keys = KeyLogger(menu);
- event = $.Event('keydown');
- event.keyCode = $.ui.keyCode.RIGHT;
- menu.trigger( event );
- equal( keys.log[ 0 ], 39, 'Right Arrow Was Pressed' );
-});
-/*
- testing if max limit being set
- */
-test( 'Max Limit', function() {
- expect(1);
- var menu = $('#menu');
- menu.navigation({
- maxItems: 3
- });
- var menuItems = menu.find('> li:visible');
- equal(menuItems.length, 4, 'Max Limit Reach');
-});
-/*
- testing if responsive menu is set
- */
-test( 'Responsive: More Menu', function() {
- expect(1);
- var menu = $('#menu');
- menu.navigation({
- responsive: 'onResize'
- });
- ok($('body').find('.ui-menu.more'), 'More Menu Created');
-});
-
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js
deleted file mode 100644
index a79d05ba8a246..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/search/regular-search-test.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @category mage.js
- * @package test
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-//Code to be tested for /app/code/Magento/Search/view/frontend/form-mini.js (_onSubmit)
-function regularSearch() {
- if (this.document.getElementById('search').value === this.document.getElementById('search').placeholder || this.document.getElementById('search').value === '') {
- this.document.getElementById('search').placeholder = 'Please specify at least one search term';
- this.document.getElementById('search').value = this.document.getElementById('search').placeholder;
- }
-}
-//The test case
-RegularSearchTest = TestCase("RegularSearchTest");
-RegularSearchTest.prototype.setUp = function() {
- /*:DOC +=
-
-
',
- data:{
- id: 'translate-form-id'
- }
- },
- dialog: {
- id: 'dialog-id',
- buttons : [{
- 'class': 'submit-button'
- }]
- }
- },
- translateInline = jQuery(document).translateInline(options),
- submit = jQuery('.ui-dialog-buttonset .submit-button'),
- ajaxParametersCorrect = false;
-
- translateInline.trigger('edit.editTrigger');
- var parameters = jQuery.param({area: options.area}) +
- '&' + jQuery('#' + options.translateForm.data.id).serialize(),
- dialog = jQuery('#' + options.dialog.id),
- dialogVisibleOnAjaxSend = false,
- dialogHiddenAfterAjaxComplete = false;
- jQuery(document)
- .on('ajaxSend', function(e, jqXHR, settings){
- jqXHR.abort();
- dialogVisibleOnAjaxSend = dialog.is(':visible');
- ajaxParametersCorrect = settings.data.indexOf(parameters) >= 0;
- jQuery(this).trigger('ajaxComplete');
- });
- submit.trigger('click');
- assertEquals(true, dialogVisibleOnAjaxSend);
- assertEquals(true, ajaxParametersCorrect);
- assertEquals(true, dialog.is(':hidden'));
- translateInline.translateInline('destroy');
-};*/
-TranslateInlineTest.prototype.testDestroy = function() {
- /*:DOC +=
-
-
- */
- var options = {
- translateForm: {
- data:{
- id: 'translate-form-id',
- newTemplateVariable: ''
- }
- }
- },
- translateInline = jQuery('[data-role="translate-dialog"]').translateInline(options),
- editTrigger = jQuery('#edit-trigger-id').editTrigger(),
- editTriggerCreated = editTrigger.size() && jQuery('#edit-trigger-id').is(':mage-editTrigger'),
- editTriggerEventIsBound = false;
-
- assertTrue(translateInline.is(':mage-translateInline'));
- assertTrue(editTriggerCreated);
- translateInline.on('edit.editTrigger', function(){editTriggerEventIsBound = true;});
- translateInline.translateInline('destroy');
- translateInline.trigger('edit.editTrigger');
- assertFalse(translateInline.is(':mage-translateInline'));
- assertFalse(editTriggerEventIsBound);
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js
deleted file mode 100644
index 358235eb13bf8..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-dialog-test.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-TranslateInlineDialogVdeTest = TestCase('TranslateInlineDialogVdeTest');
-
-TranslateInlineDialogVdeTest.prototype.testInit = function() {
- /*:DOC +=
-
-
- */
- var translateInlineDialogVde = jQuery('#translate-dialog').translateInlineDialogVde();
- assertTrue(translateInlineDialogVde.is(':mage-translateInlineDialogVde'));
- translateInlineDialogVde.translateInlineDialogVde('destroy');
-};
-TranslateInlineDialogVdeTest.prototype.testWithTemplate = function() {
- /*:DOC +=
-
-
- */
- var translateInlineDialogVde = jQuery('#translate-dialog').translateInlineDialogVde();
- assertEquals(true, translateInlineDialogVde.is(':mage-translateInlineDialogVde'));
- translateInlineDialogVde.translateInlineDialogVde('destroy');
-};
-TranslateInlineDialogVdeTest.prototype.testOpenAndClose = function() {
- /*:DOC +=
-
-
-
- */
- var options = {
- textTranslations: jQuery('[data-translate-mode="text"]'),
- imageTranslations: jQuery('[data-translate-mode="alt"]'),
- scriptTranslations: jQuery('[data-translate-mode="script"]')
- };
-
- var translateInlineDialogVde = jQuery('#translate-dialog').translateInlineDialogVde(options);
-
- var widget = {
- element : jQuery('#randomElement')
- };
-
- jQuery('#translate-dialog').translateInlineDialogVde('openWithWidget', null, widget, function() { });
- assertTrue(jQuery('#translate-dialog').translateInlineDialogVde('isOpen'));
-
- jQuery('#translate-dialog').translateInlineDialogVde('close');
- assertFalse(jQuery('#translate-dialog').translateInlineDialogVde('isOpen'));
-
- jQuery('#translate-dialog').translateInlineDialogVde('destroy');
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js
deleted file mode 100644
index 3822310460132..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/translate_inline_vde/translate-inline-vde-test.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-TranslateInlineVdeTest = TestCase('TranslateInlineVdeTest');
-TranslateInlineVdeTest.prototype.testInit = function() {
- /*:DOC +=
text
-
- */
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde();
- assertTrue(translateInlineVde.is(':mage-translateInlineVde'));
- translateInlineVde.translateInlineVde('destroy');
-};
-TranslateInlineVdeTest.prototype.testCreate = function() {
- /*:DOC +=
text
-
- */
- assertEquals(0, jQuery('[data-translate] > img').size());
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde();
- assertEquals(1, jQuery('[data-translate] > img').size());
- translateInlineVde.translateInlineVde('destroy');
-};
-TranslateInlineVdeTest.prototype.testHideAndShow = function() {
- /*:DOC +=
text
-
- */
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde(),
- iconImg = jQuery('[data-translate] > img');
- assertFalse(iconImg.is('.hidden'));
-
- translateInlineVde.translateInlineVde('hide');
- assertTrue(iconImg.is('.hidden') );
-
- translateInlineVde.translateInlineVde('show');
- assertFalse(iconImg.is('.hidden') );
- assertFalse(jQuery('[data-translate]').is(':hidden') );
-
- translateInlineVde.translateInlineVde('destroy');
-};
-TranslateInlineVdeTest.prototype.testReplaceTextNormal = function() {
- /*:DOC +=
text
-
- */
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde();
- var newValue = 'New value';
-
- jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue);
-
- var translateData = jQuery('#translateElem').data('translate');
- assertEquals(newValue, translateData[0]['shown']);
- assertEquals(newValue, translateData[0]['translated']);
-
- translateInlineVde.translateInlineVde('destroy');
-};
-TranslateInlineVdeTest.prototype.testReplaceTextNullOrBlank = function() {
- /*:DOC +=
text
-
- */
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde();
- var newValue = null;
-
- jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue);
-
- var translateData = jQuery('#translateElem').data('translate');
- assertEquals(' ', translateData[0]['shown']);
- assertEquals(' ', translateData[0]['translated']);
-
- newValue = 'Some value';
- jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue);
-
- translateData = jQuery('#translateElem').data('translate');
- assertEquals(newValue, translateData[0]['shown']);
- assertEquals(newValue, translateData[0]['translated']);
-
- newValue = '';
- jQuery('[data-translate]').translateInlineVde('replaceText', 0, newValue);
-
- translateData = jQuery('#translateElem').data('translate');
- assertEquals(' ', translateData[0]['shown']);
- assertEquals(' ', translateData[0]['translated']);
-
- translateInlineVde.translateInlineVde('destroy');
-};
-TranslateInlineVdeTest.prototype.testClick = function() {
- /*:DOC +=
text
-
- */
- var counter = 0;
- var callback = function() {
- counter++;
- };
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde({
- onClick: callback
- }),
- iconImg = jQuery('[data-translate] > img');
-
- iconImg.trigger('click');
- assertEquals(1, counter);
- assertTrue(jQuery('#translateElem').hasClass('invisible'));
-
- translateInlineVde.translateInlineVde('destroy');
-};
-TranslateInlineVdeTest.prototype.testDblClick = function() {
- /*:DOC +=
text
-
- */
- var counter = 0;
- var callback = function() {
- counter++;
- };
- var translateInlineVde = jQuery('[data-translate]').translateInlineVde({
- onClick: callback
- }),
- iconImg = jQuery('[data-translate] > img');
-
- assertEquals(1, jQuery('#translateElem').find('img').size());
-
- translateInlineVde.trigger('dblclick');
- assertEquals(1, counter);
-
- assertEquals(0, jQuery('#translateElem').find('img').size());
- assertTrue(jQuery('#translateElem').hasClass('invisible'));
-
- translateInlineVde.translateInlineVde('destroy');
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html
deleted file mode 100644
index 00661de6d8153..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/validation/index.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
Validation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js b/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js
deleted file mode 100644
index 602ba4b8d3e60..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/validation/test-validation.js
+++ /dev/null
@@ -1,611 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-test( "testValidateNoHtmlTags", function() {
- expect(4);
- equal($.validator.methods['validate-no-html-tags'].call(this, ""),true);
- equal($.validator.methods['validate-no-html-tags'].call(this, null),true);
- equal($.validator.methods['validate-no-html-tags'].call(this, "abc"),true);
- equal($.validator.methods['validate-no-html-tags'].call(this, "
abc
"),false);
-
-});
-
-test( "testAllowContainerClassName", function() {
- expect(4);
- var radio = $('
');
- radio.appendTo("#qunit-fixture");
- equal($.validator.methods['allow-container-className'].call(this, radio[0]),true);
- var checkbox = $('
');
- equal($.validator.methods['allow-container-className'].call(this, checkbox[0]),true);
- var radio2 = $('
');
- equal($.validator.methods['allow-container-className'].call(this, radio2[0]),false);
- var checkbox2 = $('
');
- equal($.validator.methods['allow-container-className'].call(this, checkbox2[0]),false);
-});
-
-test( "testValidateSelect", function() {
- expect(5);
- equal($.validator.methods['validate-select'].call(this, ""),false);
- equal($.validator.methods['validate-select'].call(this, "none"),false);
- equal($.validator.methods['validate-select'].call(this, null),false);
- equal($.validator.methods['validate-select'].call(this, undefined),false);
- equal($.validator.methods['validate-select'].call(this, "abc"),true);
-});
-
-test( "testValidateNotEmpty", function() {
- expect(5);
- ok(!$.validator.methods['validate-no-empty'].call(this, ""));
- ok(!$.validator.methods['validate-no-empty'].call(this, null));
- ok(!$.validator.methods['validate-no-empty'].call(this, undefined));
- ok(!$.validator.methods['validate-no-empty'].call(this, " "));
- ok($.validator.methods['validate-no-empty'].call(this, "test"));
-});
-
-test( "testValidateStreet", function() {
- expect(9);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, ""),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, null),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, undefined),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " "),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, "abc "),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " 123 "),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " abc123 "),true);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " !@# "),false);
- equal($.validator.methods['validate-alphanum-with-spaces'].call(this, " abc.123 "),false);
-});
-
-test( "testValidatePhoneStrict", function() {
- expect(9);
- equal($.validator.methods['validate-phoneStrict'].call(this, ""),true);
- equal($.validator.methods['validate-phoneStrict'].call(this, null),true);
- equal($.validator.methods['validate-phoneStrict'].call(this, undefined),true);
- equal($.validator.methods['validate-phoneStrict'].call(this, " "),false);
- equal($.validator.methods['validate-phoneStrict'].call(this, "5121231234"),false);
- equal($.validator.methods['validate-phoneStrict'].call(this, "512.123.1234"),false);
- equal($.validator.methods['validate-phoneStrict'].call(this, "512-123-1234"),true);
- equal($.validator.methods['validate-phoneStrict'].call(this, "(512)123-1234"),true);
- equal($.validator.methods['validate-phoneStrict'].call(this, "(512) 123-1234"),true);
-});
-
-test( "testValidatePhoneLax", function() {
- expect(11);
- equal($.validator.methods['validate-phoneLax'].call(this, ""),true);
- equal($.validator.methods['validate-phoneLax'].call(this, null),true);
- equal($.validator.methods['validate-phoneLax'].call(this, undefined),true);
- equal($.validator.methods['validate-phoneLax'].call(this, " "),false);
- equal($.validator.methods['validate-phoneLax'].call(this, "5121231234"),true);
- equal($.validator.methods['validate-phoneLax'].call(this, "512.123.1234"),true);
- equal($.validator.methods['validate-phoneLax'].call(this, "512-123-1234"),true);
- equal($.validator.methods['validate-phoneLax'].call(this, "(512)123-1234"),true);
- equal($.validator.methods['validate-phoneLax'].call(this, "(512) 123-1234"),true);
- equal($.validator.methods['validate-phoneLax'].call(this, "(512)1231234"),true);
- equal($.validator.methods['validate-phoneLax'].call(this, "(512)_123_1234"),false);
-});
-
-test( "testValidateFax", function() {
- expect(9);
- equal($.validator.methods['validate-fax'].call(this, ""),true);
- equal($.validator.methods['validate-fax'].call(this, null),true);
- equal($.validator.methods['validate-fax'].call(this, undefined),true);
- equal($.validator.methods['validate-fax'].call(this, " "),false);
- equal($.validator.methods['validate-fax'].call(this, "5121231234"),false);
- equal($.validator.methods['validate-fax'].call(this, "512.123.1234"),false);
- equal($.validator.methods['validate-fax'].call(this, "512-123-1234"),true);
- equal($.validator.methods['validate-fax'].call(this, "(512)123-1234"),true);
- equal($.validator.methods['validate-fax'].call(this, "(512) 123-1234"),true);
-});
-
-test( "testValidateEmail", function() {
- expect(11);
- equal($.validator.methods['validate-email'].call(this, ""),true);
- equal($.validator.methods['validate-email'].call(this, null),true);
- equal($.validator.methods['validate-email'].call(this, undefined),true);
- equal($.validator.methods['validate-email'].call(this, " "),false);
- equal($.validator.methods['validate-email'].call(this, "123@123.com"),true);
- equal($.validator.methods['validate-email'].call(this, "abc@124.en"),true);
- equal($.validator.methods['validate-email'].call(this, "abc@abc.commmmm"),true);
- equal($.validator.methods['validate-email'].call(this, "abc.abc.abc@abc.commmmm"),true);
- equal($.validator.methods['validate-email'].call(this, "abc.abc-abc@abc.commmmm"),true);
- equal($.validator.methods['validate-email'].call(this, "abc.abc_abc@abc.commmmm"),true);
- equal($.validator.methods['validate-email'].call(this, "abc.abc_abc@abc"),false);
-});
-
-test( "testValidateEmailSender", function() {
- expect(10);
- equal($.validator.methods['validate-emailSender'].call(this, ""),true);
- equal($.validator.methods['validate-emailSender'].call(null),true);
- equal($.validator.methods['validate-emailSender'].call(undefined),true);
- equal($.validator.methods['validate-emailSender'].call(" "),true);
- equal($.validator.methods['validate-emailSender'].call("123@123.com"),true);
- equal($.validator.methods['validate-emailSender'].call("abc@124.en"),true);
- equal($.validator.methods['validate-emailSender'].call("abc@abc.commmmm"),true);
- equal($.validator.methods['validate-emailSender'].call("abc.abc.abc@abc.commmmm"),true);
- equal($.validator.methods['validate-emailSender'].call("abc.abc-abc@abc.commmmm"),true);
- equal($.validator.methods['validate-emailSender'].call("abc.abc_abc@abc.commmmm"),true);
-});
-
-test( "testValidatePassword", function() {
- expect(9);
- equal($.validator.methods['validate-password'].call(this, ""),true);
- equal($.validator.methods['validate-password'].call(this, null),false);
- equal($.validator.methods['validate-password'].call(this, undefined),false);
- equal($.validator.methods['validate-password'].call(this, " "),true);
- equal($.validator.methods['validate-password'].call(this, "123@123.com"),true);
- equal($.validator.methods['validate-password'].call(this, "abc"),false);
- equal($.validator.methods['validate-password'].call(this, "abc "),false);
- equal($.validator.methods['validate-password'].call(this, " abc "),false);
- equal($.validator.methods['validate-password'].call(this, "dddd"),false);
-});
-
-test( "testValidateAdminPassword", function() {
- expect(9);
- equal(true, $.validator.methods['validate-admin-password'].call(this, ""));
- equal(false, $.validator.methods['validate-admin-password'].call(this, null));
- equal(false, $.validator.methods['validate-admin-password'].call(this, undefined));
- equal(true, $.validator.methods['validate-admin-password'].call(this, " "));
- equal(true, $.validator.methods['validate-admin-password'].call(this, "123@123.com"));
- equal(false, $.validator.methods['validate-admin-password'].call(this, "abc"));
- equal(false, $.validator.methods['validate-admin-password'].call(this, "abc "));
- equal(false, $.validator.methods['validate-admin-password'].call(this, " abc "));
- equal(false, $.validator.methods['validate-admin-password'].call(this, "dddd"));
-});
-
-test( "testValidateUrl", function() {
- expect(8);
- equal(true, $.validator.methods['validate-url'].call(this, ""));
- equal(true, $.validator.methods['validate-url'].call(this, null));
- equal(true, $.validator.methods['validate-url'].call(this, undefined));
- equal(false, $.validator.methods['validate-url'].call(this, " "));
- equal(true, $.validator.methods['validate-url'].call(this, "http://www.google.com"));
- equal(true, $.validator.methods['validate-url'].call(this, "http://127.0.0.1:8080/index.php"));
- equal(true, $.validator.methods['validate-url'].call(this, "http://app-spot.com/index.php"));
- equal(true, $.validator.methods['validate-url'].call(this, "http://app-spot_space.com/index.php"));
-});
-
-test( "testValidateCleanUrl", function() {
- expect(8);
- equal(true, $.validator.methods['validate-clean-url'].call(this, ""));
- equal(true, $.validator.methods['validate-clean-url'].call(this, null));
- equal(true, $.validator.methods['validate-clean-url'].call(this, undefined));
- equal(false, $.validator.methods['validate-clean-url'].call(this, " "));
- equal(true, $.validator.methods['validate-clean-url'].call(this, "http://www.google.com"));
- equal(false, $.validator.methods['validate-clean-url'].call(this, "http://127.0.0.1:8080/index.php"));
- equal(false, $.validator.methods['validate-clean-url'].call(this, "http://127.0.0.1:8080"));
- equal(false, $.validator.methods['validate-clean-url'].call(this, "http://127.0.0.1"));
-});
-
-test( "testValidateXmlIdentifier", function() {
- expect(8);
- equal(true, $.validator.methods['validate-xml-identifier'].call(this, ""));
- equal(true, $.validator.methods['validate-xml-identifier'].call(this, null));
- equal(true, $.validator.methods['validate-xml-identifier'].call(this, undefined));
- equal(false, $.validator.methods['validate-xml-identifier'].call(this, " "));
- equal(true, $.validator.methods['validate-xml-identifier'].call(this, "abc"));
- equal(true, $.validator.methods['validate-xml-identifier'].call(this, "abc_123"));
- equal(true, $.validator.methods['validate-xml-identifier'].call(this, "abc-123"));
- equal(false, $.validator.methods['validate-xml-identifier'].call(this, "123-abc"));
-});
-
-test( "testValidateSsn", function() {
- expect(8);
- equal(true, $.validator.methods['validate-ssn'].call(this, ""));
- equal(true, $.validator.methods['validate-ssn'].call(this, null));
- equal(true, $.validator.methods['validate-ssn'].call(this, undefined));
- equal(false, $.validator.methods['validate-ssn'].call(this, " "));
- equal(false, $.validator.methods['validate-ssn'].call(this, "abc"));
- equal(true, $.validator.methods['validate-ssn'].call(this, "123-13-1234"));
- equal(true, $.validator.methods['validate-ssn'].call(this, "012-12-1234"));
- equal(false, $.validator.methods['validate-ssn'].call(this, "23-12-1234"));
-});
-
-test( "testValidateZip", function() {
- expect(8);
- equal(true, $.validator.methods['validate-zip-us'].call(this, ""));
- equal(true, $.validator.methods['validate-zip-us'].call(this, null));
- equal(true, $.validator.methods['validate-zip-us'].call(this, undefined));
- equal(false, $.validator.methods['validate-zip-us'].call(this, " "));
- equal(true, $.validator.methods['validate-zip-us'].call(this, "12345-1234"));
- equal(true, $.validator.methods['validate-zip-us'].call(this, "02345"));
- equal(false, $.validator.methods['validate-zip-us'].call(this, "1234"));
- equal(false, $.validator.methods['validate-zip-us'].call(this, "1234-1234"));
-});
-
-test( "testValidateDateAu", function() {
- expect(8);
- equal(true, $.validator.methods['validate-date-au'].call(this, ""));
- equal(true, $.validator.methods['validate-date-au'].call(this, null));
- equal(true, $.validator.methods['validate-date-au'].call(this, undefined));
- equal(false, $.validator.methods['validate-date-au'].call(this, " "));
- equal(true, $.validator.methods['validate-date-au'].call(this, "01/01/2012"));
- equal(true, $.validator.methods['validate-date-au'].call(this, "30/01/2012"));
- equal(false, $.validator.methods['validate-date-au'].call(this, "01/30/2012"));
- equal(false, $.validator.methods['validate-date-au'].call(this, "1/1/2012"));
-});
-
-test( "testValidateCurrencyDollar", function() {
- expect(8);
- equal(true, $.validator.methods['validate-currency-dollar'].call(this, ""));
- equal(true, $.validator.methods['validate-currency-dollar'].call(this, null));
- equal(true, $.validator.methods['validate-currency-dollar'].call(this, undefined));
- equal(false, $.validator.methods['validate-currency-dollar'].call(this, " "));
- equal(true, $.validator.methods['validate-currency-dollar'].call(this, "$123"));
- equal(true, $.validator.methods['validate-currency-dollar'].call(this, "$1,123.00"));
- equal(true, $.validator.methods['validate-currency-dollar'].call(this, "$1234"));
- equal(false, $.validator.methods['validate-currency-dollar'].call(this, "$1234.1234"));
-});
-
-test( "testValidateNotNegativeNumber", function() {
- expect(11);
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, ""));
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, null));
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, undefined));
- equal(false, $.validator.methods['validate-not-negative-number'].call(this, " "));
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, "0"));
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, "1"));
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, "1234"));
- equal(true, $.validator.methods['validate-not-negative-number'].call(this, "1,234.1234"));
- equal(false, $.validator.methods['validate-not-negative-number'].call(this, "-1"));
- equal(false, $.validator.methods['validate-not-negative-number'].call(this, "-1e"));
- equal(false, $.validator.methods['validate-not-negative-number'].call(this, "-1,234.1234"));
-});
-
-test( "testValidateGreaterThanZero", function() {
- expect(11);
- equal(true, $.validator.methods['validate-greater-than-zero'].call(this, ""));
- equal(true, $.validator.methods['validate-greater-than-zero'].call(this, null));
- equal(true, $.validator.methods['validate-greater-than-zero'].call(this, undefined));
- equal(false, $.validator.methods['validate-greater-than-zero'].call(this, " "));
- equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "0"));
- equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "1"));
- equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "1234"));
- equal(true, $.validator.methods['validate-greater-than-zero'].call(this, "1,234.1234"));
- equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "-1"));
- equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "-1e"));
- equal(false, $.validator.methods['validate-greater-than-zero'].call(this, "-1,234.1234"));
-});
-
-test( "testValidateCssLength", function() {
- expect(11);
- equal(true, $.validator.methods['validate-css-length'].call(this, ""));
- equal(true, $.validator.methods['validate-css-length'].call(this, null));
- equal(true, $.validator.methods['validate-css-length'].call(this, undefined));
- equal(false, $.validator.methods['validate-css-length'].call(this, " "));
- equal(false, $.validator.methods['validate-css-length'].call(this, "0"));
- equal(true, $.validator.methods['validate-css-length'].call(this, "1"));
- equal(true, $.validator.methods['validate-css-length'].call(this, "1234"));
- equal(true, $.validator.methods['validate-css-length'].call(this, "1,234.1234"));
- equal(false, $.validator.methods['validate-css-length'].call(this, "-1"));
- equal(false, $.validator.methods['validate-css-length'].call(this, "-1e"));
- equal(false, $.validator.methods['validate-css-length'].call(this, "-1,234.1234"));
-});
-
-test( "testValidateData", function() {
- expect(9);
- equal(true, $.validator.methods['validate-data'].call(this, ""));
- equal(true, $.validator.methods['validate-data'].call(this, null));
- equal(true, $.validator.methods['validate-data'].call(this, undefined));
- equal(false, $.validator.methods['validate-data'].call(this, " "));
- equal(false, $.validator.methods['validate-data'].call(this, "123abc"));
- equal(true, $.validator.methods['validate-data'].call(this, "abc"));
- equal(false, $.validator.methods['validate-data'].call(this, " abc"));
- equal(true, $.validator.methods['validate-data'].call(this, "abc123"));
- equal(false, $.validator.methods['validate-data'].call(this, "abc-123"));
-});
-
-
-test( "testValidateOneRequiredByName", function() {
- expect(4);
- var radio = $('
');
- radio.appendTo("#qunit-fixture");
- ok(!$.validator.methods['validate-one-required-by-name'].call(this,
- null, radio[0]));
- var radio2 = $('
');
- radio2.appendTo("#qunit-fixture");
- ok($.validator.methods['validate-one-required-by-name'].call(this,
- null, radio2[0]));
-
- var checkbox = $('
');
- checkbox.appendTo("#qunit-fixture");
- ok(!$.validator.methods['validate-one-required-by-name'].call(this,
- null, checkbox[0]));
- var checkbox2 = $('
');
- checkbox2.appendTo("#qunit-fixture");
- ok($.validator.methods['validate-one-required-by-name'].call(this,
- null, checkbox2[0]));
-});
-
-test( "testLessThanEqualsTo", function() {
- expect(5);
- var elm1 = $('
');
- var elm2 = $('
');
- ok(!$.validator.methods['less-than-equals-to'].call(this, elm1[0].value,
- elm1, elm2));
- elm1[0].value = 4;
- ok($.validator.methods['less-than-equals-to'].call(this, elm1[0].value,
- elm1, elm2));
-
- var elm3 = $('
');
- var elm4= $('
');
- ok($.validator.methods['less-than-equals-to'].call(this, elm3[0].value,
- elm3, elm4));
-
- var elm5 = $('
');
- var elm6= $('
');
- ok($.validator.methods['less-than-equals-to'].call(this, elm5[0].value,
- elm5, elm6));
-
- var elm7 = $('
');
- var elm8= $('
');
- ok($.validator.methods['less-than-equals-to'].call(this, elm7[0].value,
- elm7, elm8));
-});
-
-test( "testGreaterThanEqualsTo", function() {
- expect(5);
-
- var elm1 = $('
');
- var elm2 = $('
');
- ok(!$.validator.methods['greater-than-equals-to'].call(this, elm1[0].value,
- elm1, elm2));
- elm1[0].value = 9;
- ok($.validator.methods['greater-than-equals-to'].call(this, elm1[0].value,
- elm1, elm2));
-
- var elm3 = $('
');
- var elm4= $('
');
- ok($.validator.methods['greater-than-equals-to'].call(this, elm3[0].value,
- elm3, elm4));
-
- var elm5 = $('
');
- var elm6= $('
');
- ok($.validator.methods['greater-than-equals-to'].call(this, elm5[0].value,
- elm5, elm6));
-
- var elm7 = $('
');
- var elm8= $('
');
- ok($.validator.methods['greater-than-equals-to'].call(this, elm7[0].value,
- elm7, elm8));
-});
-
-test( "testValidateGroupedQty", function() {
- expect(5);
- var div1 = $('
');
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div1);
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div1);
- $('
').appendTo(div1);
-
- ok(!$.validator.methods['validate-grouped-qty'].call(this, null, null, div1[0]));
-
- var div2 = $('
');
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div2);
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div2);
- $('
').appendTo(div2);
- ok(!$.validator.methods['validate-grouped-qty'].call(this, null, null, div2[0]));
-
- var div3 = $('
');
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div3);
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div3);
- $('
').appendTo(div3);
- ok(!$.validator.methods['validate-grouped-qty'].call(this, null, null, div3[0]));
-
- var div4 = $('
');
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div4);
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div4);
- $('
').appendTo(div4);
- ok($.validator.methods['validate-grouped-qty'].call(this, null, null, div4[0]));
-
- var div5 = $('
');
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div5);
- $('
').attr("data-validate","{'validate-grouped-qty':'#super-product-table'}")
- .appendTo(div5);
- $('
').appendTo(div5);
- ok($.validator.methods['validate-grouped-qty'].call(this, null, null, div5[0]));
-
-});
-
-test( "testValidateCCTypeSelect", function() {
- expect(14);
- var visaValid = $('
');
- var visaInvalid = $('
');
- var mcValid = $('
');
- var mcInvalid = $('
');
- var aeValid = $('
');
- var aeInvalid = $('
');
-
- var diValid = $('
');
- var diInvalid = $('
');
- var dnValid = $('
');
- var dnInvalid = $('
');
- var jcbValid = $('
');
- var jcbInvalid = $('
');
- var upValid = $('
');
- var upInvalid = $('
');
-
- ok($.validator.methods['validate-cc-type-select'].call(this, 'VI', null, visaValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'VI', null, visaInvalid));
- ok($.validator.methods['validate-cc-type-select'].call(this, 'MC', null, mcValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'MC', null, mcInvalid));
- ok($.validator.methods['validate-cc-type-select'].call(this, 'AE', null, aeValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'AE', null, aeInvalid));
- ok($.validator.methods['validate-cc-type-select'].call(this, 'DI', null, diValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'DI', null, diInvalid));
- ok($.validator.methods['validate-cc-type-select'].call(this, 'DN', null, dnValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'DN', null, dnInvalid));
- ok($.validator.methods['validate-cc-type-select'].call(this, 'JCB', null, jcbValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'JCB', null, jcbInvalid));
- ok($.validator.methods['validate-cc-type-select'].call(this, 'UP', null, upValid));
- ok(!$.validator.methods['validate-cc-type-select'].call(this, 'UP', null, upInvalid));
-});
-
-test( "testValidateCCNumber", function() {
- expect(37);
- ok($.validator.methods['validate-cc-number'].call(this, '4916835098995909', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '5265071363284878', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '6011120623356953', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '371293266574617', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '4916835098995901', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '5265071363284870', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6011120623356951', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '371293266574619', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '2221220000000003', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '2721220000000008', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '601109020000000003', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6011111144444444', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '6011222233334444', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6011522233334447', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '601174455555553', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6011745555555550', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '601177455555556', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '601182455555556', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '601187999555558', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '601287999555556', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '6444444444444443', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6644444444444441', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '3044444444444444', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '3064444444444449', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '3095444444444442', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '3096444444444441', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '3696444444444445', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '3796444444444444', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '3896444444444443', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '3528444444444449', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '3529444444444448', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '6221262244444440', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6229981111111111', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '6249981111111117', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6279981111111110', null, null));
- ok($.validator.methods['validate-cc-number'].call(this, '6282981111111115', null, null));
- ok(!$.validator.methods['validate-cc-number'].call(this, '6289981111111118', null, null));
-});
-
-test( "testValidateCCType", function() {
- expect(14);
- var select = $('
' +
- '' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ');
-
- select.val('VI');
- ok($.validator.methods['validate-cc-type'].call(this, '4916835098995909', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '5265071363284878', null, select));
- select.val('MC');
- ok($.validator.methods['validate-cc-type'].call(this, '5265071363284878', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '4916835098995909', null, select));
- select.val('AE');
- ok($.validator.methods['validate-cc-type'].call(this, '371293266574617', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '5265071363284878', null, select));
- select.val('DI');
- ok($.validator.methods['validate-cc-type'].call(this, '6011050000000009', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '371293266574617', null, select));
- select.val('DN');
- ok($.validator.methods['validate-cc-type'].call(this, '3095434000000001', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '6011050000000009', null, select));
- select.val('JCB');
- ok($.validator.methods['validate-cc-type'].call(this, '3528000000000007', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '3095434000000001', null, select));
- select.val('UP');
- ok($.validator.methods['validate-cc-type'].call(this, '6221260000000000', null, select));
- ok(!$.validator.methods['validate-cc-type'].call(this, '3528000000000007', null, select));
-});
-
-test( "testValidateCCExp", function() {
- expect(3);
- var year = $('
'),
- currentTime = new Date(),
- currentMonth = currentTime.getMonth() + 1,
- currentYear = currentTime.getFullYear();
- year.val(currentYear);
- if (currentMonth > 1) {
- ok(!$.validator.methods['validate-cc-exp'].call(this, currentMonth - 1, null, year));
- }
- ok($.validator.methods['validate-cc-exp'].call(this, currentMonth, null, year));
- year.val(currentYear + 1);
- ok($.validator.methods['validate-cc-exp'].call(this, currentMonth, null, year));
-
-});
-
-test( "testValidateCCCvn", function() {
- expect(8);
- var ccType = $('
'+
- ' '+
- ' '+
- ' '+
- ' '+
- ' '+
- ' ');
-
- ccType.val('VI');
- ok($.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType));
- ok(!$.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType));
- ccType.val('MC');
- ok($.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType));
- ok(!$.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType));
- ccType.val('AE');
- ok($.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType));
- ok(!$.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType));
- ccType.val('DI');
- ok($.validator.methods['validate-cc-cvn'].call(this, '123', null, ccType));
- ok(!$.validator.methods['validate-cc-cvn'].call(this, '1234', null, ccType));
-});
-
-test( "testValidateNumberRange", function() {
- expect(14);
- ok($.validator.methods['validate-number-range'].call(this, '-1', null, null));
- ok($.validator.methods['validate-number-range'].call(this, '1', null, null));
- ok($.validator.methods['validate-number-range'].call(this, '', null, null));
- ok($.validator.methods['validate-number-range'].call(this, null, null, null));
- ok($.validator.methods['validate-number-range'].call(this, '0', null, null));
- ok(!$.validator.methods['validate-number-range'].call(this, 'asds', null, null));
-
- ok($.validator.methods['validate-number-range'].call(this, '10', null, '10-20.06'));
- ok($.validator.methods['validate-number-range'].call(this, '15', null, '10-20.06'));
- ok(!$.validator.methods['validate-number-range'].call(this, '1', null, '10-20.06'));
- ok(!$.validator.methods['validate-number-range'].call(this, '30', null, '10-20.06'));
-
- var el1 = $('
').get(0);
- ok($.validator.methods['validate-number-range'].call(this, '10', el1, null));
- ok($.validator.methods['validate-number-range'].call(this, '15', el1, null));
- ok(!$.validator.methods['validate-number-range'].call(this, '1', el1, null));
- ok($.validator.methods['validate-number-range'].call(this, '30', el1, null));
-});
-
-
-
-test( "testValidateDigitsRange", function() {
- expect(15);
- ok($.validator.methods['validate-digits-range'].call(this, '-1', null, null));
- ok($.validator.methods['validate-digits-range'].call(this, '1', null, null));
- ok($.validator.methods['validate-digits-range'].call(this, '', null, null));
- ok($.validator.methods['validate-digits-range'].call(this, null, null, null));
- ok($.validator.methods['validate-digits-range'].call(this, '0', null, null));
- ok(!$.validator.methods['validate-digits-range'].call(this, 'asds', null, null));
-
- ok($.validator.methods['validate-digits-range'].call(this, '10', null, '10-20'));
- ok($.validator.methods['validate-digits-range'].call(this, '15', null, '10-20'));
- ok(!$.validator.methods['validate-digits-range'].call(this, '1', null, '10-20'));
- ok(!$.validator.methods['validate-digits-range'].call(this, '30', null, '10-20'));
- ok($.validator.methods['validate-digits-range'].call(this, '30', null, '10-20.06'));
-
- var el1 = $('
').get(0);
- ok($.validator.methods['validate-digits-range'].call(this, '10', el1, null));
- ok($.validator.methods['validate-digits-range'].call(this, '15', el1, null));
- ok(!$.validator.methods['validate-digits-range'].call(this, '1', el1, null));
- ok(!$.validator.methods['validate-digits-range'].call(this, '30', el1, null));
-});
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js
deleted file mode 100644
index b03b3bc3d889a..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/webapi-test.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-WebapiTest = TestCase('WebapiTest');
-
-WebapiTest.prototype.testConstructorSuccess = function() {
- var successCallback = function(){};
- new $.mage.Webapi('baseUrl', {'timeout': 100, 'success': successCallback});
-};
-
-WebapiTest.prototype.testConstructorSuccessEmptyArgs = function() {
- new $.mage.Webapi('baseUrl');
-};
-
-WebapiTest.prototype.testConstructorInvalidBaseUrl = function() {
- expectAsserts(1);
- try {
- var invalidBaseUrl = 1;
- new $.mage.Webapi(invalidBaseUrl);
- } catch (e) {
- var expectedException = "String baseUrl parameter required";
- assertEquals("Invalid exception was thrown.", expectedException, e);
- }
-};
-
-WebapiTest.prototype.testCallInvalidMethod = function() {
- var Webapi = new $.mage.Webapi('baseUrl');
- expectAsserts(1);
- try {
- Webapi.call('resourceUri', 'INVALID_HTTP_METHOD');
- } catch (e) {
- var expectedException = "Method name is not valid: INVALID_HTTP_METHOD";
- assertEquals("Invalid exception was thrown.", expectedException, e);
- }
-};
-
-WebapiTest.prototype.testCallSuccessCallback = function() {
- // ensure that custom successCallback was executed
- expectAsserts(1);
- var successCallback = function(response) {
- assertObject("Response is expected to be an object", response);
- };
- var Webapi = new $.mage.Webapi('baseUrl', {'success': successCallback});
- $.ajax = function(settings) {
- settings.success({});
- };
- Webapi.call('products', 'GET');
-};
-
-WebapiTest.prototype.testCallErrorCallback = function() {
- // ensure that custom successCallback was executed
- expectAsserts(1);
- var errorCallback = function(response) {
- assertObject("Response is expected to be an object", response);
- };
- var Webapi = new $.mage.Webapi('baseUrl', {'error': errorCallback});
- $.ajax = function(settings) {
- settings.error({});
- };
- Webapi.call('products', 'GET');
-};
-
-WebapiTest.prototype.testCallProductGet = function() {
- var baseUri = 'baseUrl';
- var Webapi = new $.mage.Webapi(baseUri);
- var httpMethod = Webapi.method.get;
- var idObj = {id: 1};
- var productResourceUri = '/products/';
- var resourceVersion = 'v1';
- var expectedUri = baseUri + '/webapi/rest/' + resourceVersion + productResourceUri + '1';
- // ensure that $.ajax() was executed
- expectAsserts(3);
- $.ajax = function(settings) {
- assertEquals("URI for API call does not match with expected one.", expectedUri, settings.url);
- assertEquals("HTTP method for API call does not match with expected one.", httpMethod, settings.type);
- assertEquals("Data for API call does not match with expected one.", '1', settings.data);
- };
- Webapi.Product(resourceVersion).get(idObj);
-};
-
-WebapiTest.prototype.testCallProductCreate = function() {
- var baseUri = 'baseUrl';
- var Webapi = new $.mage.Webapi(baseUri);
- var httpMethod = Webapi.method.create;
- var productResourceUri = '/products/';
- var resourceVersion = 'v1';
- var expectedUri = baseUri + '/webapi/rest/' + resourceVersion + productResourceUri;
- productData = {
- "type_id": "simple",
- "attribute_set_id": 4,
- "sku": "1234567890",
- "weight": 1,
- "status": 1,
- "visibility": 4,
- "name": "Simple Product",
- "description": "Simple Description",
- "price": 99.95,
- "tax_class_id": 0
- };
- // ensure that $.ajax() was executed
- expectAsserts(3);
- $.ajax = function(settings) {
- assertEquals("URI for API call does not match with expected one.", expectedUri, settings.url);
- assertEquals("HTTP method for API call does not match with expected one.", httpMethod, settings.type);
- assertEquals("Data for API call does not match with expected one.", productData, settings.data);
- };
- Webapi.Product(resourceVersion).create(productData);
-};
-
-WebapiTest.prototype.testCallProductCreateInvalidVersion = function() {
- expectAsserts(1);
- var invalidVersion = 'invalidVersion';
- try {
- var Webapi = new $.mage.Webapi('BaseUrl');
- Webapi.Product(invalidVersion);
- } catch (e) {
- var expectedException = "Incorrect version format: " + invalidVersion;
- assertEquals("Invalid exception was thrown.", expectedException, e);
- }
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js b/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js
deleted file mode 100644
index a9dc0fd239a28..0000000000000
--- a/dev/tests/js/JsTestDriver/testsuite/mage/zoom/zoom-test.js
+++ /dev/null
@@ -1,337 +0,0 @@
-/**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-ZoomTest = TestCase('ZoomTest');
-ZoomTest.prototype.setUp = function() {
- /*:DOC +=
-
-
-
-
-
-
-
-
- */
- this.zoomElement = jQuery('[data-role=zoom-test]');
-};
-ZoomTest.prototype.tearDown = function() {
- this.zoomDestroy();
-};
-ZoomTest.prototype.zoomDestroy = function() {
- if(this.zoomElement.data('zoom')) {
- this.zoomElement.zoom('destroy');
- }
-};
-ZoomTest.prototype.zoomCreate = function(options, element) {
- return (element || this.zoomElement).zoom(options || {} ).data('zoom');
-};
-ZoomTest.prototype.testInit = function() {
- this.zoomElement.zoom();
- assertTrue(this.zoomElement.is(':mage-zoom'));
-};
-ZoomTest.prototype.testCreate = function() {
- var zoomInstance = this.zoomCreate(),
- _setZoomData = jsunit.stub(zoomInstance, '_setZoomData'),
- _render = jsunit.stub(zoomInstance, '_render'),
- _bind = jsunit.stub(zoomInstance, '_bind'),
- _hide = jsunit.stub(zoomInstance, '_hide'),
- _largeImageLoaded = jsunit.stub(zoomInstance, '_largeImageLoaded');
-
- zoomInstance.largeImage = [{
- complete: false
- }];
-
- zoomInstance._create();
- assertTrue(_setZoomData.callCount === 1);
- assertTrue(_render.callCount === 1);
- assertTrue(_bind.callCount === 1);
- assertNull(_largeImageLoaded.callCount);
- assertTrue(_hide.callCount === 2);
- _setZoomData.reset();
- _render.reset();
- _bind.reset();
- _hide.reset();
-
- zoomInstance.largeImage[0].complete = true;
- zoomInstance._create();
- assertTrue(_setZoomData.callCount === 1);
- assertTrue(_render.callCount === 1);
- assertTrue(_bind.callCount === 1);
- assertTrue(_largeImageLoaded.callCount === 1);
- assertTrue(_hide.callCount === 2);
-};
-ZoomTest.prototype.testRender = function() {
- var zoomInstance = this.zoomCreate(),
- _renderControl = jsunit.stub(zoomInstance, '_renderControl'),
- _renderLargeImage = jsunit.stub(zoomInstance, '_renderLargeImage');
- _renderControl.returnCallback = function(control) {
- return jQuery('
', {'data-control': control});
- };
-
- zoomInstance._render();
- assertTrue(_renderControl.callCount === 4);
- assertTrue(zoomInstance.element.find('[data-control=track]').length > 0);
- assertTrue(zoomInstance.element.find('[data-control=lens]').length > 0);
- assertTrue(zoomInstance.element.find('[data-control=display]').length > 0);
- assertTrue(zoomInstance.element.find('[data-control=notice]').length > 0);
- assertTrue(_renderLargeImage.callCount === 1);
-};
-ZoomTest.prototype.testToggleNotice = function() {
- var zoomInstance = this.zoomCreate(),
- getZoomRatio = jsunit.stub(zoomInstance, 'getZoomRatio');
-
- zoomInstance.noticeOriginal = 'notice original';
- zoomInstance.options.controls.notice = {
- text: 'test text'
- };
-
- zoomInstance.notice.text('');
- zoomInstance.largeImageSrc = 'image.large.jpg';
- zoomInstance.activated = false;
- getZoomRatio.returnValue = 2;
- zoomInstance._toggleNotice();
- assertEquals(zoomInstance.notice.text(), zoomInstance.options.controls.notice.text);
- assertTrue(getZoomRatio.callCount === 1);
-
- zoomInstance.notice.text('');
- zoomInstance.largeImageSrc = null;
- zoomInstance.activated = false;
- getZoomRatio.returnValue = 2;
- zoomInstance._toggleNotice();
- assertEquals(zoomInstance.notice.text(), zoomInstance.noticeOriginal);
-
- zoomInstance.notice.text('');
- zoomInstance.largeImageSrc = 'image.large.jpg';
- zoomInstance.activated = true;
- getZoomRatio.returnValue = 2;
- zoomInstance._toggleNotice();
- assertEquals(zoomInstance.notice.text(), zoomInstance.noticeOriginal);
-
- zoomInstance.notice.text('');
- zoomInstance.largeImageSrc = 'image.large.jpg';
- zoomInstance.activated = false;
- getZoomRatio.returnValue = 0;
- zoomInstance._toggleNotice();
- assertEquals(zoomInstance.notice.text(), zoomInstance.noticeOriginal);
-};
-
-ZoomTest.prototype.testRefresh = function() {
- var zoomInstance = this.zoomCreate(),
- _refreshControl = jsunit.stub(zoomInstance, '_refreshControl');
-
- zoomInstance._refresh();
- assertTrue(_refreshControl.callCount === 3);
- assertTrue(_refreshControl.callArgsStack[0][0] === 'display');
- assertTrue(_refreshControl.callArgsStack[1][0] === 'track');
- assertTrue(_refreshControl.callArgsStack[2][0] === 'lens');
-};
-
-ZoomTest.prototype.testBind = function() {
- var zoomInstance = this.zoomCreate(),
- _on = jsunit.stub(zoomInstance, '_on'),
- events = {};
-
- zoomInstance.largeImage = jQuery('
');
- zoomInstance._bind();
- assertTrue(_on.callCount > 0);
- assertTrue(
- _on.callArgsStack[0][0][
- zoomInstance.options.startZoomEvent +
- ' ' +
- zoomInstance.options.selectors.image
- ] === 'show'
- );
- assertTrue(
- jQuery.type(_on.callArgsStack[0][0][
- zoomInstance.options.stopZoomEvent +
- ' ' +
- zoomInstance.options.selectors.track
- ]) === 'function'
- );
- assertTrue(_on.callArgsStack[0][0]['mousemove ' + zoomInstance.options.selectors.track] === '_move');
- assertTrue(_on.callArgsStack[0][0].imageupdated === '_onImageUpdated');
- assertTrue(_on.callArgsStack[1][0].is(zoomInstance.largeImage));
- assertTrue(_on.callArgsStack[1][1].load === '_largeImageLoaded');
-};
-ZoomTest.prototype.testEnable = function() {
- var zoomInstance = this.zoomCreate(),
- _onImageUpdated = jsunit.stub(zoomInstance, '_onImageUpdated');
-
- zoomInstance.enable();
- assertTrue(_onImageUpdated.callCount === 1);
-};
-ZoomTest.prototype.testDisable = function() {
- var zoomInstance = this.zoomCreate();
-
- zoomInstance.noticeOriginal = 'original notice';
- zoomInstance.notice.text('');
- zoomInstance.disable();
- assertEquals(zoomInstance.noticeOriginal, zoomInstance.notice.text());
-};
-ZoomTest.prototype.testShow = function() {
- var zoomInstance = this.zoomCreate(),
- e = {
- preventDefault: jsunit.stub(),
- stopImmediatePropagation: jsunit.stub()
- },
- getZoomRatio = jsunit.stub(zoomInstance, 'getZoomRatio'),
- _show = jsunit.stub(zoomInstance, '_show'),
- _refresh = jsunit.stub(zoomInstance, '_refresh'),
- _toggleNotice = jsunit.stub(zoomInstance, '_toggleNotice'),
- _trigger = jsunit.stub(zoomInstance, '_trigger');
-
- getZoomRatio.returnValue = 0;
- zoomInstance.show(e);
- assertTrue(e.preventDefault.callCount === 1);
-
- e.preventDefault.reset();
- getZoomRatio.reset();
- getZoomRatio.returnValue = 2;
- zoomInstance.largeImageSrc = 'image.large.jpg';
- zoomInstance.show(e);
- assertTrue(e.preventDefault.callCount === 1);
- assertTrue(e.stopImmediatePropagation.callCount === 1);
- assertTrue(zoomInstance.activated);
- assertTrue(_show.callCount > 0);
- assertTrue(_refresh.callCount === 1);
- assertTrue(_toggleNotice.callCount === 1);
- assertTrue(_trigger.callCount === 1);
- assertTrue(_trigger.lastCallArgs[0] === 'show');
-};
-ZoomTest.prototype.testHide = function() {
- var zoomInstance = this.zoomCreate(),
- _hide = jsunit.stub(zoomInstance, '_hide'),
- _toggleNotice = jsunit.stub(zoomInstance, '_toggleNotice'),
- _trigger = jsunit.stub(zoomInstance, '_trigger');
-
- zoomInstance.hide();
- assertTrue(_hide.callCount > 0);
- assertTrue(_toggleNotice.callCount === 1);
- assertTrue(_trigger.callCount === 1);
- assertTrue(_trigger.lastCallArgs[0] === 'hide');
-};
-ZoomTest.prototype.testOnImageUpdated = function() {
- var zoomInstance = this.zoomCreate(),
- _setZoomData = jsunit.stub(zoomInstance, '_setZoomData'),
- _refreshLargeImage = jsunit.stub(zoomInstance, '_refreshLargeImage'),
- _refresh = jsunit.stub(zoomInstance, '_refresh'),
- hide = jsunit.stub(zoomInstance, 'hide'),
- testImage = jQuery('
');
-
- zoomInstance.options.selectors.image = "[data-role=test-image]";
- zoomInstance.element.append(testImage);
- zoomInstance.image = testImage;
- zoomInstance._onImageUpdated();
- assertNull(_setZoomData.callCount);
- assertNull(_refreshLargeImage.callCount);
- assertNull(_refresh.callCount);
- assertNull(hide.callCount);
-
- zoomInstance.image = jQuery('
');
- zoomInstance.largeImageSrc = null;
- zoomInstance._onImageUpdated();
- assertTrue(_setZoomData.callCount === 1);
- assertNull(_refreshLargeImage.callCount);
- assertNull(_refresh.callCount);
- assertTrue(hide.callCount === 1);
-
- _setZoomData.reset();
- hide.reset();
- zoomInstance.largeImageSrc = 'image.large.jpg';
- zoomInstance._onImageUpdated();
- assertTrue(_setZoomData.callCount === 1);
- assertTrue(_refreshLargeImage.callCount === 1);
- assertTrue(_refresh.callCount === 1);
- assertNull(hide.callCount);
-};
-ZoomTest.prototype.testLargeImageLoaded = function() {
- var zoomInstance = this.zoomCreate(),
- _toggleNotice = jsunit.stub(zoomInstance, '_toggleNotice'),
- _getAspectRatio = jsunit.stub(zoomInstance, '_getAspectRatio'),
- _getWhiteBordersOffset = jsunit.stub(zoomInstance, '_getWhiteBordersOffset'),
- processStopTriggered = false,
- image = jQuery('
');
-
- _getWhiteBordersOffset.returnValue = 1;
- zoomInstance.element.append(image);
- zoomInstance.options.selectors.image = '[data-role=test-image]';
- zoomInstance.image = image;
- _getAspectRatio.returnCallback = function(image) {
- if (image.is(zoomInstance.image)) {
- return 0;
- } else {
- return 1;
- }
- };
-
- jQuery(zoomInstance.options.selectors.image).on('processStop', function() {
- processStopTriggered = true;
- });
- zoomInstance.ratio = 1;
-
- zoomInstance._largeImageLoaded();
- assertNull(zoomInstance.ratio);
- assertTrue(_toggleNotice.callCount === 1);
- assertTrue(processStopTriggered);
- assertTrue(_getAspectRatio.callCount > 0);
- assertTrue(_getWhiteBordersOffset.callCount === 1);
- assertEquals(zoomInstance.whiteBordersOffset, _getWhiteBordersOffset.returnValue);
-};
-ZoomTest.prototype.testRefreshLargeImage = function() {
- var zoomInstance = this.zoomCreate(),
- css = {top: 0, left: 0};
- zoomInstance.largeImage = jQuery('
');
- zoomInstance.largeImageSrc = 'large.image.jpg';
-
- zoomInstance._refreshLargeImage();
- assertNotUndefined(zoomInstance.largeImage.prop('src'));
- assertEquals(zoomInstance.largeImage.css('top'), css.top + 'px');
- assertEquals(zoomInstance.largeImage.css('left'), css.left + 'px');
-};
-ZoomTest.prototype.testRenderLargeImage = function() {
- var zoomInstance = this.zoomCreate();
-
- zoomInstance.element.append(jQuery('
'));
- zoomInstance.options.selectors.image = '[data-role=test-image]';
-
- var image = zoomInstance._renderLargeImage();
- assertTrue(image.is('img'));
- assertTrue(image.is(zoomInstance.largeImage));
-};
-ZoomTest.prototype.testGetZoomRatio = function() {
- var zoomInstance = this.zoomCreate(),
- imageSize = {width: 100, height: 100},
- largeImageSize = {width: 200, height: 200};
-
- zoomInstance.ratio = null;
- zoomInstance.image = jQuery('
', imageSize);
- zoomInstance.largeImageSize = largeImageSize;
- var zoomRatio = zoomInstance.getZoomRatio();
-
- assertEquals(zoomRatio, (largeImageSize.width / imageSize.width));
- zoomInstance.ratio = 100;
- zoomRatio = zoomInstance.getZoomRatio();
- assertEquals(zoomRatio, zoomInstance.ratio);
-};
-ZoomTest.prototype.testGetAspectRatio = function() {
- var zoomInstance = this.zoomCreate(),
- aspectRatio = zoomInstance._getAspectRatio(),
- size = {width: 200, height: 100};
- assertNull(aspectRatio);
- aspectRatio = zoomInstance._getAspectRatio(jQuery('
', size));
- assertEquals((Math.round((size.width / size.height) * 100) / 100), aspectRatio);
-};
diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html b/dev/tests/js/jasmine/assets/lib/web/mage/menu.html
similarity index 50%
rename from dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html
rename to dev/tests/js/jasmine/assets/lib/web/mage/menu.html
index d0a3b9b873801..03c673a7dac5f 100644
--- a/dev/tests/js/JsTestDriver/testsuite/mage/menu/index.html
+++ b/dev/tests/js/jasmine/assets/lib/web/mage/menu.html
@@ -1,36 +1,10 @@
-
-
-
-
-
-
Unit test
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/dev/tests/js/jasmine/assets/lib/web/mage/tabs.html b/dev/tests/js/jasmine/assets/lib/web/mage/tabs.html
new file mode 100644
index 0000000000000..dd4d665ca188e
--- /dev/null
+++ b/dev/tests/js/jasmine/assets/lib/web/mage/tabs.html
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/dev/tests/js/jasmine/assets/lib/web/mage/translate-inline.html b/dev/tests/js/jasmine/assets/lib/web/mage/translate-inline.html
new file mode 100644
index 0000000000000..5e48598a081a2
--- /dev/null
+++ b/dev/tests/js/jasmine/assets/lib/web/mage/translate-inline.html
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js b/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js
new file mode 100644
index 0000000000000..19a54d95cf704
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js
@@ -0,0 +1,80 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+define([
+ 'jquery',
+ 'mage/accordion'
+], function ($) {
+ 'use strict';
+
+ describe('Test for mage/accordion jQuery plugin', function () {
+ it('check if accordion can be initialized', function () {
+ var accordion = $('
');
+
+ accordion.accordion();
+ expect(accordion.is(':mage-accordion')).toBeTruthy();
+
+ accordion.accordion('destroy');
+ expect(accordion.is(':mage-accordion')).toBeFalsy();
+ });
+ it('check one-collapsible element accordion', function () {
+ var accordion = $('
'),
+ title1 = $('
').appendTo(accordion),
+ content1 = $('
').appendTo(accordion),
+ title2 = $('
').appendTo(accordion),
+ content2 = $('
').appendTo(accordion);
+
+ accordion.appendTo('body');
+
+ accordion.accordion();
+
+ expect(accordion.is(':mage-accordion')).toBeTruthy();
+
+ expect(content1.is(':visible')).toBeTruthy();
+ expect(content2.is(':hidden')).toBeTruthy();
+
+ title2.trigger('click');
+
+ expect(content1.is(':hidden')).toBeTruthy();
+ expect(content2.is(':visible')).toBeTruthy();
+
+ title1.trigger('click');
+
+ expect(content1.is(':visible')).toBeTruthy();
+ expect(content2.is(':hidden')).toBeTruthy();
+
+ accordion.accordion('destroy');
+
+ expect(accordion.is(':mage-accordion')).toBeFalsy();
+ });
+ it('check multi-collapsible element accordion', function () {
+ var accordion = $('
'),
+ title1 = $('
').appendTo(accordion),
+ content1 = $('
').appendTo(accordion),
+ title2 = $('
').appendTo(accordion),
+ content2 = $('
').appendTo(accordion);
+
+ accordion.appendTo('body');
+
+ accordion.accordion({
+ multipleCollapsible: true
+ });
+
+ expect(accordion.is(':mage-accordion')).toBeTruthy();
+ expect(content1.is(':visible')).toBeTruthy();
+ expect(content2.is(':hidden')).toBeTruthy();
+
+ $(title1).trigger('click');
+ expect(content1.is(':visible')).toBeTruthy();
+ expect(content2.is(':hidden')).toBeTruthy();
+
+ $(title2).trigger('click');
+ expect(content1.is(':visible')).toBeTruthy();
+ expect(content2.is(':visible')).toBeTruthy();
+
+ accordion.accordion('destroy');
+ expect(accordion.is(':mage-accordion')).toBeFalsy();
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/backend/suggest.test.js b/dev/tests/js/jasmine/tests/lib/mage/backend/suggest.test.js
new file mode 100644
index 0000000000000..84880e6af72c5
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/backend/suggest.test.js
@@ -0,0 +1,524 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'mage/backend/suggest'
+], function ($) {
+ 'use strict';
+
+ describe('mage/backend/suggest', function () {
+ var suggestSelector = '#suggest';
+
+ beforeEach(function () {
+ var $suggest = $('
');
+
+ $('body').append($suggest);
+ $('body').append('');
+ });
+
+ afterEach(function () {
+ $(suggestSelector).remove();
+ $('#test-template').remove();
+ $(suggestSelector).suggest('destroy');
+ });
+
+ it('Check that suggest inited', function () {
+ var $suggest = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ });
+
+ expect($suggest.is(':mage-suggest')).toBe(true);
+ });
+
+ it('Check suggest create', function () {
+ var options = {
+ template: '#test-template',
+ choiceTemplate: '
',
+ controls: {
+ selector: '.test',
+ eventsMap: {
+ focus: ['testfocus'],
+ blur: ['testblur'],
+ select: ['testselect']
+ }
+ },
+ showRecent: true,
+ storageKey: 'test-suggest-recent',
+ multiselect: true
+ },
+ recentItems = [{
+ id: '1',
+ label: 'TestLabel1'
+ },
+ {
+ id: '2',
+ label: 'TestLabel2'
+ }
+ ],
+ nonSelectedItem = {
+ id: '',
+ label: ''
+ },
+ suggestInstance;
+
+ if (window.localStorage) {
+ localStorage.setItem(options.storageKey, JSON.stringify(recentItems));
+ }
+
+ suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest');
+
+ expect(suggestInstance._term).toBe(null);
+ expect(suggestInstance._nonSelectedItem).toEqual(nonSelectedItem);
+ expect(suggestInstance._renderedContext).toBe(null);
+ expect(suggestInstance._selectedItem).toEqual(nonSelectedItem);
+ expect(suggestInstance._control).toEqual(suggestInstance.options.controls);
+ expect(suggestInstance._recentItems).toEqual(window.localStorage ? recentItems : []);
+ expect(suggestInstance.valueField.is(':hidden')).toBe(true);
+
+ if (window.localStorage) {
+ localStorage.removeItem(options.storageKey);
+ }
+ });
+
+ it('Check suggest render', function () {
+ var options = {
+ template: '#test-template',
+ choiceTemplate: '
',
+ dropdownWrapper: '
',
+ className: 'test-suggest',
+ inputWrapper: '
'
+ },
+ suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest');
+
+ suggestInstance._render();
+
+ expect(suggestInstance.dropdown.hasClass('wrapper-test')).toBe(true);
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+ expect(suggestInstance.element.closest('.test-input-wrapper').size()).toBeGreaterThan(0);
+ expect(suggestInstance.element.closest('.' + options.className).size()).toBeGreaterThan(0);
+ expect(suggestInstance.element.attr('autocomplete')).toBe('off');
+
+ options.appendMethod = 'before';
+ $(suggestSelector).suggest('destroy');
+ suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest');
+ suggestInstance._render();
+ expect(suggestInstance.element.prev().is(suggestInstance.dropdown)).toBe(true);
+
+ options.appendMethod = 'after';
+ $(suggestSelector).suggest('destroy');
+ suggestInstance = $(suggestSelector).suggest(options).data('mage-suggest');
+ suggestInstance._render();
+ expect(suggestInstance.element.next().is(suggestInstance.dropdown)).toBe(true);
+ });
+
+ it('Check suggest createValueField', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ valueField = suggestInstance._createValueField();
+
+ expect(valueField.is('input')).toBe(true);
+ expect(valueField.is(':hidden')).toBe(true);
+
+ $(suggestSelector).suggest('destroy');
+ suggestInstance = $(suggestSelector).suggest({
+ multiselect: true,
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest');
+ valueField = suggestInstance._createValueField();
+
+ expect(valueField.is('select')).toBe(true);
+ expect(valueField.is(':hidden')).toBe(true);
+ expect(valueField.attr('multiple')).toBe('multiple');
+ });
+
+ it('Check suggest prepareValueField', function () {
+ var $suggest = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }),
+ suggestInstance = $suggest.data('mage-suggest'),
+ suggestName = $suggest.attr('name');
+
+ suggestInstance._prepareValueField();
+
+ expect(suggestInstance.valueField).not.toBe(true);
+ expect(suggestInstance.element.prev().is(suggestInstance.valueField)).toBe(true);
+ expect(suggestInstance.element.attr('name')).toBe(undefined);
+ expect(suggestInstance.valueField.attr('name')).toBe(suggestName);
+ });
+
+ it('Check suggest destroy', function () {
+ var options = {
+ template: '#test-template',
+ choiceTemplate: '
',
+ inputWrapper: '
',
+ valueField: null
+ },
+ $suggest = $(suggestSelector).suggest(options),
+ suggestInstance = $suggest.data('mage-suggest'),
+ suggestName = $suggest.attr('name');
+
+ expect(suggestInstance.dropdown).not.toBe(undefined);
+ expect(suggestInstance.valueField).not.toBe(undefined);
+ expect(suggestName).toBe(undefined);
+
+ $suggest.suggest('destroy');
+
+ expect($suggest.closest('.test-input-wrapper').length).toBe(0);
+ expect($suggest.attr('autocomplete')).toBe(undefined);
+ expect($suggest.attr('name')).toBe(suggestInstance.valueField.attr('name'));
+ expect(suggestInstance.valueField.parents('html').length).not.toBeGreaterThan(0);
+ expect(suggestInstance.dropdown.parents('html').length).not.toBeGreaterThan(0);
+ });
+
+ it('Check suggest value', function () {
+ var value = 'test-value',
+ suggestInstance, suggestDivInstance;
+
+ $(suggestSelector).val(value);
+ $('body').append('
' + value + '
');
+
+ suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest');
+ suggestDivInstance = $('#suggest-div').suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest');
+
+ expect(suggestInstance._value()).toBe(value);
+ expect(suggestDivInstance._value()).toBe(value);
+ $('#suggest-div').remove();
+ });
+
+ it('Check suggest bind', function () {
+ var eventIsBinded = false,
+ options = {
+ template: '#test-template',
+ choiceTemplate: '
',
+ events: {
+ /** Stub function */
+ click: function () {
+ eventIsBinded = true;
+ }
+ }
+ },
+ $suggest = $(suggestSelector).suggest(options);
+
+ $suggest.trigger('click');
+ expect(eventIsBinded).toBe(true);
+ });
+
+ it('Check suggest focus/blur', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ };
+
+ expect(suggestInstance._focused).toBe(undefined);
+ expect(suggestInstance.element.val()).toBe('');
+
+ suggestInstance._focusItem($.Event('focus'), uiHash);
+
+ expect(suggestInstance._focused).toEqual(uiHash.item);
+ expect(suggestInstance.element.val()).toBe(uiHash.item.label);
+
+ suggestInstance._blurItem();
+
+ expect(suggestInstance._focused).toBe(null);
+ expect(suggestInstance.element.val()).toBe('');
+ });
+
+ it('Check suggest select', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ };
+
+ suggestInstance._focused = suggestInstance._term = suggestInstance._selectedItem = null;
+ suggestInstance.valueField.val('');
+ suggestInstance._selectItem($.Event('select'));
+
+ expect(suggestInstance._selectedItem).toBe(null);
+ expect(suggestInstance._term).toBe(null);
+ expect(suggestInstance.valueField.val()).toBe('');
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+
+ suggestInstance._focused = uiHash.item;
+ suggestInstance._selectItem($.Event('select'));
+
+ expect(suggestInstance._selectedItem).toEqual(suggestInstance._focused);
+ expect(suggestInstance._term).toBe(suggestInstance._focused.label);
+ expect(suggestInstance.valueField.val()).toBe(suggestInstance._focused.id.toString());
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+ });
+
+ it('Check suggest multiselect', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
',
+ multiselect: true
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ },
+ event = $.Event('select'),
+ selectedElement = $('
');
+
+ event.target = selectedElement[0];
+ suggestInstance._focused = suggestInstance._term = suggestInstance._selectedItem = null;
+ suggestInstance.valueField.val('');
+ suggestInstance._selectItem(event);
+
+ expect(suggestInstance._selectedItem).toBe(null);
+ expect(suggestInstance._term).toBe(null);
+ expect(suggestInstance.valueField.find('option').length).not.toBeGreaterThan(0);
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+
+ suggestInstance._focused = uiHash.item;
+ suggestInstance._selectItem(event);
+
+ expect(suggestInstance._selectedItem).toEqual(suggestInstance._focused);
+ expect(suggestInstance._term).toBe('');
+ expect(suggestInstance._getOption(suggestInstance._focused).length).toBeGreaterThan(0);
+ expect(selectedElement.hasClass(suggestInstance.options.selectedClass)).toBe(true);
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+
+ suggestInstance._selectItem(event);
+ expect(suggestInstance._selectedItem).toEqual(suggestInstance._nonSelectedItem);
+ expect(suggestInstance._term).toBe('');
+ expect(suggestInstance._getOption(suggestInstance._focused).length).not.toBeGreaterThan(0);
+ expect(selectedElement.hasClass(suggestInstance.options.selectedClass)).toBe(false);
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+ });
+
+ it('Check suggest reset value', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest');
+
+ suggestInstance.valueField.val('test');
+ expect(suggestInstance.valueField.val()).toBe('test');
+ suggestInstance._resetSuggestValue();
+ expect(suggestInstance.valueField.val()).toBe(suggestInstance._nonSelectedItem.id);
+ });
+
+ it('Check suggest reset multiselect value', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
',
+ multiselect: true
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ },
+ event = $.Event('select');
+
+ event.target = $('
')[0];
+ suggestInstance._focused = uiHash.item;
+
+ suggestInstance._selectItem(event);
+ suggestInstance._resetSuggestValue();
+
+ expect(suggestInstance.valueField.val() instanceof Array).toBe(true);
+ expect(suggestInstance.valueField.val()[0]).not.toBe(undefined);
+ expect(suggestInstance.valueField.val()[0]).toBe(uiHash.item.id.toString());
+ });
+
+ it('Check suggest read item data', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ testElement = $('
');
+
+ expect(suggestInstance._readItemData(testElement)).toEqual(suggestInstance._nonSelectedItem);
+ testElement.data('suggestOption', 'test');
+ expect(suggestInstance._readItemData(testElement)).toEqual('test');
+ });
+
+ it('Check suggest template', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '
<%= data.test %>
',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ tmpl = suggestInstance.templates[suggestInstance.templateName],
+ html = $('
').append(tmpl({
+ data: {
+ test: 'test'
+ }
+ })).html();
+
+ expect(html).toEqual('
test
');
+ suggestInstance.destroy();
+ $('body').append('');
+
+ suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest');
+ tmpl = suggestInstance.templates[suggestInstance.templateName];
+ html = $('
').append(tmpl({
+ data: {
+ test: 'test'
+ }
+ })).html();
+
+ expect(html).toEqual('
test
');
+ $('#test-template').remove();
+ });
+
+ it('Check suggest dropdown visibility', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest');
+
+ suggestInstance.dropdown.hide();
+ expect(suggestInstance.isDropdownShown()).toBe(false);
+ expect(suggestInstance.dropdown.is(':hidden')).toBe(true);
+
+ suggestInstance.dropdown.show();
+ expect(suggestInstance.isDropdownShown()).toBe(true);
+ expect(suggestInstance.dropdown.is(':visible')).toBe(true);
+ });
+
+ it('Check suggest create option', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ },
+ option = suggestInstance._createOption(uiHash.item);
+
+ expect(option.val()).toBe('1');
+ expect(option.prop('selected')).toBe(true);
+ expect(option.text()).toBe('Test Label');
+ expect(option.data('renderedOption')).not.toBe(undefined);
+ });
+
+ it('Check suggest add option', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ },
+ selectTarget = $('
'),
+ event = $.Event('add'),
+ option;
+
+ event.target = selectTarget[0];
+ suggestInstance._addOption(event, uiHash.item);
+ option = suggestInstance.valueField.find('option[value=' + uiHash.item.id + ']');
+
+ expect(option.length).toBeGreaterThan(0);
+ expect(option.data('selectTarget').is(selectTarget)).toBe(true);
+ });
+
+ it('Check suggest get option', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
'
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ },
+ option = $('
Test Label ');
+
+ expect(suggestInstance._getOption(uiHash.item).length).not.toBeGreaterThan(0);
+
+ suggestInstance.valueField.append(option);
+ expect(suggestInstance._getOption(uiHash.item).length).toBeGreaterThan(0);
+ expect(suggestInstance._getOption(option).length).toBeGreaterThan(0);
+ });
+
+ it('Check suggest last added', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
',
+ multiselect: true
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ };
+
+ suggestInstance._addOption({}, uiHash.item);
+ expect(suggestInstance.valueField.find('option').length).toBeGreaterThan(0);
+ suggestInstance._removeLastAdded();
+ expect(suggestInstance.valueField.find('option').length).not.toBeGreaterThan(0);
+ });
+
+ it('Check suggest remove option', function () {
+ var suggestInstance = $(suggestSelector).suggest({
+ template: '#test-template',
+ choiceTemplate: '
',
+ multiselect: true
+ }).data('mage-suggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ },
+ selectTarget = $('
'),
+ event = $.Event('select');
+
+ selectTarget.addClass(suggestInstance.options.selectedClass);
+ event.target = selectTarget[0];
+
+ suggestInstance._addOption(event, uiHash.item);
+ expect(suggestInstance.valueField.find('option').length).toBeGreaterThan(0);
+ suggestInstance.removeOption(event, uiHash.item);
+ expect(suggestInstance.valueField.find('option').length).not.toBeGreaterThan(0);
+ expect(selectTarget.hasClass(suggestInstance.options.selectedClass)).toBe(false);
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/backend/tree-suggest.test.js b/dev/tests/js/jasmine/tests/lib/mage/backend/tree-suggest.test.js
new file mode 100644
index 0000000000000..b116fc7058808
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/backend/tree-suggest.test.js
@@ -0,0 +1,52 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'mage/backend/tree-suggest'
+], function ($) {
+ 'use strict';
+
+ describe('mage/backend/tree-suggest', function () {
+ var treeSuggestSelector = '#tree-suggest';
+
+ beforeEach(function () {
+ var $treeSuggest = $('
');
+
+ $('body').append($treeSuggest);
+ });
+
+ afterEach(function () {
+ $(treeSuggestSelector).remove();
+ $(treeSuggestSelector).treeSuggest('destroy');
+ });
+
+ it('Check that treeSuggest inited', function () {
+ var $treeSuggest = $(treeSuggestSelector).treeSuggest(),
+ treeSuggestInstance = $treeSuggest.data('mage-treeSuggest');
+
+ expect($treeSuggest.is(':mage-treeSuggest')).toBe(true);
+ expect(treeSuggestInstance.widgetEventPrefix).toBe('suggest');
+ });
+
+ it('Check treeSuggest filter', function () {
+ var treeSuggestInstance = $(treeSuggestSelector).treeSuggest().data('mage-treeSuggest'),
+ uiHash = {
+ item: {
+ id: 1,
+ label: 'Test Label'
+ }
+ };
+
+ expect(treeSuggestInstance._filterSelected(
+ [uiHash.item],
+ {
+ _allShown: true
+ }
+ )).toEqual([uiHash.item]);
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/calendar.test.js b/dev/tests/js/jasmine/tests/lib/mage/calendar.test.js
new file mode 100644
index 0000000000000..b2c6aed2c9fba
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/calendar.test.js
@@ -0,0 +1,173 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'jquery/ui',
+ 'mage/calendar'
+], function ($) {
+ 'use strict';
+
+ describe('mage/calendar', function () {
+ describe('Check calendar', function () {
+ var calendarSelector = '#calendar';
+
+ beforeEach(function () {
+ var $calendar = $('
');
+
+ $('body').append($calendar);
+ });
+
+ afterEach(function () {
+ $(calendarSelector).remove();
+ $(calendarSelector).calendar('destroy');
+ });
+
+ it('Check that calendar inited', function () {
+ var $calendar = $(calendarSelector).calendar();
+
+ expect($calendar.is(':mage-calendar')).toBe(true);
+ });
+
+ it('Check configuration merge', function () {
+ var $calendar;
+
+ $.extend(true, $, {
+ calendarConfig: {
+ showOn: 'button',
+ showAnim: '',
+ buttonImageOnly: true,
+ showButtonPanel: true,
+ showWeek: true,
+ timeFormat: '',
+ showTime: false,
+ showHour: false,
+ showMinute: false
+ }
+ });
+
+ $calendar = $(calendarSelector).calendar();
+
+ expect($calendar.calendar('option', 'showOn')).toBe('button');
+ expect($calendar.calendar('option', 'showAnim')).toBe('');
+ expect($calendar.calendar('option', 'buttonImageOnly')).toBe(true);
+ expect($calendar.calendar('option', 'showButtonPanel')).toBe(true);
+ expect($calendar.calendar('option', 'showWeek')).toBe(true);
+ expect($calendar.calendar('option', 'timeFormat')).toBe('');
+ expect($calendar.calendar('option', 'showTime')).toBe(false);
+ expect($calendar.calendar('option', 'showHour')).toBe(false);
+ expect($calendar.calendar('option', 'showMinute')).toBe(false);
+
+ delete $.calendarConfig;
+ });
+
+ it('Specifying AM/PM in timeformat option changes AMPM option to true', function () {
+ var $calendar = $(calendarSelector).calendar({
+ timeFormat: 'hh:mm tt',
+ ampm: false
+ });
+
+ expect($calendar.calendar('option', 'ampm')).toBe(true);
+ });
+
+ it('Omitting AM/PM in timeformat option changes AMPM option to false', function () {
+ var $calendar = $(calendarSelector).calendar({
+ timeFormat: 'hh:mm'
+ });
+
+ expect($calendar.calendar('option', 'ampm')).toBe(null);
+ });
+
+ it('With server timezone offset', function () {
+ var serverTimezoneSeconds = 1346122095,
+ $calendar = $(calendarSelector).calendar({
+ serverTimezoneSeconds: serverTimezoneSeconds
+ }),
+ currentDate = new Date();
+
+ currentDate.setTime((serverTimezoneSeconds + currentDate.getTimezoneOffset() * 60) * 1000);
+
+ expect($calendar.calendar('getTimezoneDate').toString()).toBe(currentDate.toString());
+ });
+
+ it('Without sever timezone offset', function () {
+ var $calendar = $(calendarSelector).calendar(),
+ currentDate = new Date();
+
+ expect($calendar.calendar('getTimezoneDate').toString()).toBe(currentDate.toString());
+ });
+
+ it('Check destroy', function () {
+ var $calendar = $(calendarSelector).calendar();
+
+ expect($calendar.is(':mage-calendar')).toBe(true);
+ $calendar.calendar('destroy');
+ expect($calendar.is(':mage-calendar')).toBe(false);
+ });
+ });
+ describe('Check dateRange', function () {
+ var dateRangeSelector = '#date-range';
+
+ beforeEach(function () {
+ var $dateRange = $('
' +
+ ' ' +
+ ' ' +
+ '
');
+
+ $('body').append($dateRange);
+ });
+
+ afterEach(function () {
+ $(dateRangeSelector).remove();
+ $(dateRangeSelector).dateRange('destroy');
+ });
+
+ it('Check that dateRange inited', function () {
+ var $dateRange = $(dateRangeSelector).dateRange();
+
+ expect($dateRange.is(':mage-dateRange')).toBe(true);
+ });
+
+ it('Check that dateRange inited with additional options', function () {
+ var $from = $('#from'),
+ $to = $('#to');
+
+ $(dateRangeSelector).dateRange({
+ from: {
+ id: 'from'
+ },
+ to: {
+ id: 'to'
+ }
+ });
+
+ expect($from.hasClass('_has-datepicker')).toBe(true);
+ expect($to.hasClass('_has-datepicker')).toBe(true);
+ });
+
+ it('Check destroy', function () {
+ var $dateRange = $(dateRangeSelector).dateRange({
+ from: {
+ id: 'from'
+ },
+ to: {
+ id: 'to'
+ }
+ }),
+ $from = $('#from'),
+ $to = $('#to');
+
+ expect($dateRange.is(':mage-dateRange')).toBe(true);
+ expect($from.hasClass('_has-datepicker')).toBe(true);
+ expect($to.hasClass('_has-datepicker')).toBe(true);
+ $dateRange.dateRange('destroy');
+ expect($dateRange.is(':mage-dateRange')).toBe(false);
+ expect($from.hasClass('_has-datepicker')).toBe(false);
+ expect($to.hasClass('_has-datepicker')).toBe(false);
+ });
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/collapsible.test.js b/dev/tests/js/jasmine/tests/lib/mage/collapsible.test.js
new file mode 100644
index 0000000000000..d6c95d2887ec7
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/collapsible.test.js
@@ -0,0 +1,211 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+/* eslint-disable max-nested-callbacks */
+/* jscs:disable jsDoc */
+
+define([
+ 'jquery',
+ 'jquery/ui',
+ 'mage/collapsible'
+], function ($) {
+ 'use strict';
+
+ describe('Test for mage/collapsible jQuery plugin', function () {
+ it('check if collapsible can be initialized and destroyed', function () {
+ var group = $('
');
+
+ group.collapsible();
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ group.remove();
+ });
+
+ describe('Test enable, disable, activate and deactivate methods', function () {
+ var group = $('
'),
+ content = $('
').appendTo(group);
+
+ $('
').prependTo(group);
+
+ beforeEach(function () {
+ group.appendTo('body');
+ });
+
+ afterEach(function () {
+ group.remove();
+ });
+
+ it('check enable and disable methods', function () {
+ group.collapsible();
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+
+ group.collapsible('disable');
+ expect(content.is(':hidden')).toBeTruthy();
+
+ group.collapsible('enable');
+ expect(content.is(':visible')).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ });
+
+ it('check activate and deactivate methods', function () {
+ group.collapsible();
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+
+ group.collapsible('deactivate');
+ expect(content.is(':hidden')).toBeTruthy();
+
+ group.collapsible('activate');
+ expect(content.is(':visible')).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ });
+ });
+
+ it('check if the widget gets expanded/collapsed when the title is clicked', function () {
+ var group = $('
'),
+ title = $('
').appendTo(group),
+ content = $('
').appendTo(group);
+
+ group.appendTo('body');
+
+ group.collapsible();
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+
+ group.collapsible('deactivate');
+ expect(content.is(':hidden')).toBeTruthy();
+
+ title.trigger('click');
+ expect(content.is(':visible')).toBeTruthy();
+
+ title.trigger('click');
+ expect(content.is(':hidden')).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ group.remove();
+ });
+
+ it('check state classes', function () {
+ var group = $('
'),
+ title = $('
').appendTo(group);
+
+ $('
').appendTo(group);
+
+ group.appendTo('body');
+
+ group.collapsible({
+ openedState: 'opened',
+ closedState: 'closed',
+ disabledState: 'disabled'
+ });
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+ expect(group.hasClass('closed')).toBeTruthy();
+
+ title.trigger('click');
+ expect(group.hasClass('opened')).toBeTruthy();
+
+ group.collapsible('disable');
+ expect(group.hasClass('disabled')).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ group.remove();
+ });
+
+ it('check if icons are added to title when initialized and removed when destroyed', function () {
+ var group = $('
'),
+ title = $('
').appendTo(group);
+
+ $('
').appendTo(group);
+
+ group.appendTo('body');
+
+ group.collapsible({
+ icons: {
+ header: 'minus',
+ activeHeader: 'plus'
+ }
+ });
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+ expect(title.children('[data-role=icons]').length).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ expect(title.children('[data-role=icons]').length).toBeFalsy();
+ group.remove();
+ });
+
+ it('check if icon classes are changed when content gets expanded/collapsed', function () {
+ var group = $('
'),
+ title = $('
').appendTo(group),
+ content = $('
').appendTo(group),
+ icons;
+
+ group.appendTo('body');
+
+ group.collapsible({
+ icons: {
+ header: 'minus',
+ activeHeader: 'plus'
+ }
+ });
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+
+ icons = group.collapsible('option', 'icons');
+ group.collapsible('deactivate');
+ expect(content.is(':hidden')).toBeTruthy();
+ expect(title.children('[data-role=icons]').hasClass(icons.header)).toBeTruthy();
+
+ title.trigger('click');
+ expect(title.children('[data-role=icons]').hasClass(icons.activeHeader)).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ group.remove();
+ });
+
+ it('check if content gets updated via Ajax when title is clicked', function () {
+ var group = $('
'),
+ title = $('
').appendTo(group),
+ content = $('
').appendTo(group);
+
+ $('
').appendTo(group);
+
+ $.get = jasmine.createSpy().and.callFake(function () {
+ var d = $.Deferred();
+
+ d.promise().success = function () {
+ };
+
+ d.promise().complete = function () {
+ };
+
+ return d.promise();
+ });
+
+ group.appendTo('body');
+
+ group.collapsible({
+ ajaxContent: true
+ });
+ expect(group.is(':mage-collapsible')).toBeTruthy();
+
+ group.collapsible('deactivate');
+ expect(content.is(':hidden')).toBeTruthy();
+ expect(content.children('p').length).toBeFalsy();
+
+ title.trigger('click');
+ expect(content.children('p')).toBeTruthy();
+
+ group.collapsible('destroy');
+ expect(group.is(':mage-collapsible')).toBeFalsy();
+ group.remove();
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/decorate.test.js b/dev/tests/js/jasmine/tests/lib/mage/decorate.test.js
new file mode 100644
index 0000000000000..898bcf8b51128
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/decorate.test.js
@@ -0,0 +1,201 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'mage/decorate',
+ 'jquery'
+], function (decorate, $) {
+ 'use strict';
+
+ describe('mage/decorate', function () {
+ describe('"list" method', function () {
+ var listId = 'testList';
+
+ beforeEach(function () {
+ var list = $('
');
+
+ $('body').append(list);
+ });
+
+ afterEach(function () {
+ $('#' + listId).remove();
+ });
+
+ it('Check correct class decoration', function () {
+ var $list = $('#' + listId);
+
+ $list.decorate('list');
+ expect($list.find('li:first').hasClass('first')).toBe(false);
+ expect($list.find('li:first').hasClass('odd')).toBe(true);
+ expect($list.find('li:last').hasClass('last')).toBe(true);
+ expect($list.find('li:odd').hasClass('even')).toBe(true);
+ expect($list.find('li:even').hasClass('odd')).toBe(true);
+ });
+ });
+
+ describe('"generic" method', function () {
+ var listId = 'testList';
+
+ beforeEach(function () {
+ var list = $('
');
+
+ $('body').append(list);
+ });
+
+ afterEach(function () {
+ $('#' + listId).remove();
+ });
+
+ it('Check correct class decoration with default params', function () {
+ var $list = $('#' + listId);
+
+ $list.find('li').decorate('generic');
+ expect($list.find('li:first').hasClass('first')).toBe(true);
+ expect($list.find('li:first').hasClass('odd')).toBe(true);
+ expect($list.find('li:last').hasClass('last')).toBe(true);
+ expect($list.find('li:odd').hasClass('even')).toBe(true);
+ expect($list.find('li:even').hasClass('odd')).toBe(true);
+ });
+
+ it('Check correct class decoration with custom params', function () {
+ var $list = $('#' + listId);
+
+ $list.find('li').decorate('generic', ['last', 'first']);
+ expect($list.find('li:first').hasClass('first')).toBe(true);
+ expect($list.find('li:first').hasClass('odd')).toBe(false);
+ expect($list.find('li:last').hasClass('last')).toBe(true);
+ expect($list.find('li:odd').hasClass('even')).toBe(false);
+ expect($list.find('li:even').hasClass('odd')).toBe(false);
+ });
+
+ it('Check correct class decoration with empty items', function () {
+ var $list = $('#' + listId);
+
+ $list.find('span').decorate('generic', ['last', 'first']);
+ expect($list.find('li:first').hasClass('first')).toBe(false);
+ expect($list.find('li:first').hasClass('odd')).toBe(false);
+ expect($list.find('li:last').hasClass('last')).toBe(false);
+ expect($list.find('li:odd').hasClass('even')).toBe(false);
+ expect($list.find('li:even').hasClass('odd')).toBe(false);
+ });
+ });
+
+ describe('"table" method', function () {
+ var tableId = 'testTable';
+
+ beforeEach(function () {
+ var table = $('
' +
+ ' ' +
+ '' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' >' +
+ ' ' +
+ '
');
+
+ $('body').append(table);
+ });
+
+ afterEach(function () {
+ $('#' + tableId).remove();
+ });
+
+ it('Check correct class decoration with default params', function () {
+ var $table = $('#' + tableId);
+
+ $table.decorate('table');
+ expect($table.find('tbody tr:first').hasClass('first')).toBe(true);
+ expect($table.find('tbody tr:first').hasClass('odd')).toBe(true);
+ expect($table.find('tbody tr:odd').hasClass('even')).toBe(true);
+ expect($table.find('tbody tr:even').hasClass('odd')).toBe(true);
+ expect($table.find('tbody tr:last').hasClass('last')).toBe(true);
+ expect($table.find('thead tr:first').hasClass('first')).toBe(true);
+ expect($table.find('thead tr:last').hasClass('last')).toBe(true);
+ expect($table.find('tfoot tr:first').hasClass('first')).toBe(true);
+ expect($table.find('tfoot tr:last').hasClass('last')).toBe(true);
+ expect($table.find('tr td:last').hasClass('last')).toBe(true);
+ expect($table.find('tr td:first').hasClass('first')).toBe(false);
+ });
+
+ it('Check correct class decoration with custom params', function () {
+ var $table = $('#' + tableId);
+
+ $table.decorate('table', {
+ 'tbody': ['first'],
+ 'tbody tr': ['first'],
+ 'thead tr': ['first'],
+ 'tfoot tr': ['last'],
+ 'tr td': ['first']
+ });
+ expect($table.find('tbody:first').hasClass('first')).toBe(true);
+ expect($table.find('tbody tr:first').hasClass('first')).toBe(true);
+ expect($table.find('tbody tr:first').hasClass('odd')).toBe(false);
+ expect($table.find('tbody tr:odd').hasClass('even')).toBe(false);
+ expect($table.find('tbody tr:even').hasClass('odd')).toBe(false);
+ expect($table.find('tbody tr:last').hasClass('last')).toBe(false);
+ expect($table.find('thead tr:first').hasClass('first')).toBe(true);
+ expect($table.find('thead tr:last').hasClass('last')).toBe(false);
+ expect($table.find('tfoot tr:first').hasClass('first')).toBe(false);
+ expect($table.find('tfoot tr:last').hasClass('last')).toBe(true);
+ expect($table.find('tr td:last').hasClass('last')).toBe(false);
+ expect($table.find('tr td:first').hasClass('first')).toBe(true);
+ });
+ });
+
+ describe('"dataList" method', function () {
+ var listId = 'testDataList';
+
+ beforeEach(function () {
+ var list = $('
');
+
+ $('body').append(list);
+ });
+
+ afterEach(function () {
+ $('#' + listId).remove();
+ });
+
+ it('Check correct class decoration', function () {
+ var $list = $('#' + listId);
+
+ $list.decorate('dataList');
+ expect($list.find('dt:first').hasClass('first')).toBe(false);
+ expect($list.find('dt:first').hasClass('odd')).toBe(true);
+ expect($list.find('dt:odd').hasClass('even')).toBe(true);
+ expect($list.find('dt:even').hasClass('odd')).toBe(true);
+ expect($list.find('dt:last').hasClass('last')).toBe(true);
+ expect($list.find('dd:first').hasClass('first')).toBe(false);
+ expect($list.find('dd:first').hasClass('odd')).toBe(true);
+ expect($list.find('dd:odd').hasClass('even')).toBe(true);
+ expect($list.find('dd:even').hasClass('odd')).toBe(true);
+ expect($list.find('dd:last').hasClass('last')).toBe(true);
+ });
+ });
+
+ describe('Call decorate with fake method', function () {
+ var listId = 'testDataList';
+
+ beforeEach(function () {
+ var list = $('
');
+
+ $('body').append(list);
+ });
+
+ afterEach(function () {
+ $('#' + listId).remove();
+ });
+
+ it('Check error message', function () {
+ var $list = $('#' + listId);
+
+ spyOn($, 'error');
+ $list.decorate('customMethod');
+ expect($.error).toHaveBeenCalledWith('Method customMethod does not exist on jQuery.decorate');
+ });
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/dropdown.test.js b/dev/tests/js/jasmine/tests/lib/mage/dropdown.test.js
new file mode 100644
index 0000000000000..1d149efe040e0
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/dropdown.test.js
@@ -0,0 +1,357 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+/* eslint-disable max-nested-callbacks */
+
+define([
+ 'jquery',
+ 'mage/dropdown'
+], function ($) {
+ 'use strict';
+
+ describe('Test for mage/dropdown jQuery plugin', function () {
+ it('check if dialog opens when the triggerEvent is triggered', function () {
+ var opener = $('
'),
+ dialog = $('
');
+
+ dialog.dropdownDialog({
+ 'triggerEvent': 'click',
+ 'triggerTarget': opener
+ });
+
+ opener.trigger('click');
+ expect(dialog.dropdownDialog('isOpen')).toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'triggerEvent': null,
+ 'triggerTarget': opener
+ });
+
+ opener.trigger('click');
+ expect(dialog.dropdownDialog('isOpen')).toBeFalsy();
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if a specified class is added to the trigger', function () {
+ var opener = $('
'),
+ dialog = $('
');
+
+ dialog.dropdownDialog({
+ 'triggerClass': 'active',
+ 'triggerTarget': opener
+ });
+
+ dialog.dropdownDialog('open');
+ expect(opener.hasClass('active')).toBeTruthy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'triggerClass': null,
+ 'triggerTarget': opener
+ });
+
+ dialog.dropdownDialog('open');
+ expect(opener.hasClass('active')).toBeFalsy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if a specified class is added to the element which the dialog appends to', function () {
+ var parent = $('
'),
+ dialog = $('
');
+
+ dialog.dropdownDialog({
+ 'parentClass': 'active',
+ 'appendTo': parent
+ });
+
+ dialog.dropdownDialog('open');
+ expect(parent.hasClass('active')).toBeTruthy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'parentClass': null,
+ 'appendTo': parent
+ });
+
+ dialog.dropdownDialog('open');
+ expect(parent.hasClass('active')).toBeFalsy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if a specified class is added to the element that becomes dialog', function () {
+ var dialog = $('
'),
+ content;
+
+ dialog.dropdownDialog({
+ 'dialogContentClass': 'active'
+ });
+
+ content = $('.ui-dialog-content');
+ dialog.dropdownDialog('open');
+ expect(content.hasClass('active')).toBeTruthy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'dialogContentClass': null
+ });
+
+ dialog.dropdownDialog('open');
+ expect(content.hasClass('active')).toBeFalsy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if a specified class is added to dialog', function () {
+ var dialog = $('
'),
+ uiClass = '.ui-dialog',
+ ui;
+
+ dialog.dropdownDialog({
+ 'defaultDialogClass': 'custom'
+ });
+
+ ui = $(uiClass);
+ expect(ui.hasClass('custom')).toBeTruthy();
+ expect(ui.hasClass('mage-dropdown-dialog')).toBeFalsy();
+
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({});
+ ui = $(uiClass);
+ expect(ui.hasClass('mage-dropdown-dialog')).toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if the specified trigger actually opens the dialog', function () {
+ var opener = $('
'),
+ dialog = $('
');
+
+ dialog.dropdownDialog({
+ 'triggerTarget': opener
+ });
+
+ opener.trigger('click');
+ expect(dialog.dropdownDialog('isOpen')).toBeTruthy();
+
+ dialog.dropdownDialog('close');
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'triggerTarget': null
+ });
+
+ opener.trigger('click');
+ expect(dialog.dropdownDialog('isOpen')).toBeFalsy();
+
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if the dialog gets closed when clicking outside of it', function () {
+ var container = $('
'),
+ outside = $('
').attr('id', 'outside').appendTo(container),
+ dialog = $('
').attr('id', 'dialog').appendTo(container);
+
+ container.appendTo('body');
+
+ dialog.dropdownDialog({
+ 'closeOnClickOutside': true
+ });
+
+ dialog.dropdownDialog('open');
+ outside.trigger('click');
+ expect(dialog.dropdownDialog('isOpen')).toBeFalsy();
+
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'closeOnClickOutside': false
+ });
+
+ dialog.dropdownDialog('open');
+ outside.trigger('click');
+ expect(dialog.dropdownDialog('isOpen')).toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if the dialog gets closed when mouse leaves the dialog area', function () {
+ var container = $('
'),
+ dialog = $('
').attr('id', 'dialog').appendTo(container);
+
+ $('
').attr('id', 'outside').appendTo(container);
+ $('
').attr('id', 'opener').appendTo(container);
+
+ container.appendTo('body');
+
+ jasmine.clock().install();
+
+ dialog.dropdownDialog({
+ 'closeOnMouseLeave': true
+ });
+
+ dialog.dropdownDialog('open');
+ dialog.trigger('mouseenter');
+ expect(dialog.dropdownDialog('isOpen')).toBeTruthy();
+
+ dialog.trigger('mouseleave');
+
+ jasmine.clock().tick(10);
+
+ expect(dialog.dropdownDialog('isOpen')).toBeFalsy();
+ dialog.dropdownDialog('destroy');
+
+ jasmine.clock().uninstall();
+ });
+
+ it('check if the dialog does not close when mouse leaves the dialog area', function () {
+ var container = $('
'),
+ dialog = $('
').attr('id', 'dialog').appendTo(container);
+
+ $('
').attr('id', 'outside').appendTo(container);
+ $('
').attr('id', 'opener').appendTo(container);
+
+ container.appendTo('body');
+
+ jasmine.clock().install();
+
+ dialog.dropdownDialog({
+ 'closeOnMouseLeave': false
+ });
+
+ dialog.dropdownDialog('open');
+ dialog.trigger('mouseenter');
+ dialog.trigger('mouseleave');
+ jasmine.clock().tick(10);
+ expect(dialog.dropdownDialog('isOpen')).toBeTruthy();
+ dialog.dropdownDialog('destroy');
+
+ jasmine.clock().uninstall();
+ });
+
+ it('check if the dialog gets closed with the specified delay', function (done) {
+ var container = $('
'),
+ dialog = $('
').attr('id', 'dialog').appendTo(container);
+
+ $('
').attr('id', 'outside').appendTo(container);
+ $('
').attr('id', 'opener').appendTo(container);
+
+ container.appendTo('body');
+
+ dialog.dropdownDialog({
+ 'timeout': 5
+ });
+
+ dialog.dropdownDialog('open');
+ dialog.trigger('mouseenter');
+ dialog.trigger('mouseleave');
+ expect(dialog.dropdownDialog('isOpen')).toBeTruthy();
+
+ setTimeout(function () {
+ expect(dialog.dropdownDialog('isOpen')).toBeFalsy();
+ dialog.dropdownDialog('destroy');
+ done();
+ }, 6);
+ });
+
+ /*
+ * jQuery ui version 1.9.2 belongs to the adminhtml.
+ *
+ * This test will fail on backend since backend's jquery.ui will
+ * add ui-dialog-titlebar class anyway on create.
+ */
+ if ($.ui.version !== '1.9.2') {
+ it('check if the title bar is prevented from being created', function () {
+ var dialog = $('
'),
+ uiClass = '.ui-dialog',
+ ui;
+
+ dialog.dropdownDialog({
+ 'createTitleBar': true
+ });
+
+ ui = $(uiClass);
+ expect(ui.find('.ui-dialog-titlebar').length > 0).toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'createTitleBar': false
+ });
+
+ ui = $(uiClass);
+ expect(ui.find('.ui-dialog-titlebar').length <= 0).toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+ });
+ }
+
+ it('check if the position function gets disabled', function () {
+ var dialog = $('
'),
+ uiClass = '.ui-dialog',
+ ui;
+
+ dialog.dropdownDialog({
+ 'autoPosition': false
+ });
+
+ ui = $(uiClass);
+ dialog.dropdownDialog('open');
+ expect(ui.css('top') === 'auto').toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'autoPosition': true
+ });
+
+ ui = $(uiClass);
+ dialog.dropdownDialog('open');
+ expect(ui.css('top') !== '0px').toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+ });
+
+ it('check if the size function gets disabled', function () {
+ var dialog = $('
'),
+ uiClass = '.ui-dialog',
+ ui;
+
+ dialog.dropdownDialog({
+ 'autoSize': true,
+ 'width': '300'
+ });
+
+ ui = $(uiClass);
+ dialog.dropdownDialog('open');
+ expect(ui.css('width') === '300px').toBeTruthy();
+
+ dialog.dropdownDialog('destroy');
+
+ dialog.dropdownDialog({
+ 'autoSize': false,
+ 'width': '300'
+ });
+
+ ui = $(uiClass);
+ dialog.dropdownDialog('open');
+ expect(ui.css('width') === '300px').toBeFalsy();
+
+ dialog.dropdownDialog('destroy');
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/form.test.js b/dev/tests/js/jasmine/tests/lib/mage/form.test.js
new file mode 100644
index 0000000000000..6202f93da999a
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/form.test.js
@@ -0,0 +1,262 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+/* eslint-disable max-nested-callbacks */
+/* jscs:disable jsDoc */
+
+define([
+ 'jquery',
+ 'mage/backend/form'
+], function ($) {
+ 'use strict';
+
+ /*
+ * jQuery ui version 1.9.2 belongs to the adminhtml.
+ *
+ * This test will fail on frontend since mage/backend/form only belongs to backend.
+ */
+ if ($.ui.version === '1.9.2') {
+ describe('Test for mage/form jQuery plugin', function () {
+ var id = 'edit_form',
+ elementId = '#' + id;
+
+ beforeEach(function () {
+ var element = $('
');
+
+ element.appendTo('body');
+ });
+
+ afterEach(function () {
+ $(elementId).remove();
+ });
+
+ it('check if form can be initialized', function () {
+ var form = $(elementId).form();
+
+ expect(form.is(':mage-form')).toBeTruthy();
+ });
+
+ it('check get handlers', function () {
+ var form = $(elementId).form(),
+ handlersData = form.form('option', 'handlersData'),
+ handlers = [];
+
+ $.each(handlersData, function (key) {
+ handlers.push(key);
+ });
+ expect(handlers.join(' ')).toBe(form.data('form')._getHandlers().join(' '));
+ });
+
+ it('check store attribute', function () {
+ var form = $(elementId).form(),
+ initialFormAttrs = {
+ action: form.attr('action'),
+ target: form.attr('target'),
+ method: form.attr('method')
+ };
+
+ form.data('form')._storeAttribute('action');
+ form.data('form')._storeAttribute('target');
+ form.data('form')._storeAttribute('method');
+
+ expect(form.data('form').oldAttributes.action).toBe(initialFormAttrs.action);
+ expect(form.data('form').oldAttributes.target).toBe(initialFormAttrs.target);
+ expect(form.data('form').oldAttributes.method).toBe(initialFormAttrs.method);
+ });
+
+ it('check bind', function () {
+ var form = $(elementId).form(),
+ submitted = false,
+ handlersData = form.form('option', 'handlersData');
+
+ form.on('submit', function (e) {
+ submitted = true;
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ });
+
+ $.each(handlersData, function (key) {
+ form.trigger(key);
+ expect(submitted).toBeTruthy();
+ submitted = false;
+ });
+
+ form.off('submit');
+ });
+
+ it('check get action URL', function () {
+ var form = $(elementId).form(),
+ action = form.attr('action'),
+ testUrl = 'new/action/url',
+ testArgs = {
+ args: {
+ arg: 'value'
+ }
+ };
+
+ form.data('form')._storeAttribute('action');
+ expect(form.data('form')._getActionUrl(testArgs)).toBe(action + '/arg/value/');
+ expect(form.data('form')._getActionUrl(testUrl)).toBe(testUrl);
+ expect(form.data('form')._getActionUrl()).toBe(action);
+ });
+
+ it('check process data', function () {
+ var form = $(elementId).form(),
+ initialFormAttrs = {
+ action: form.attr('action'),
+ target: form.attr('target'),
+ method: form.attr('method')
+ },
+ testSimpleData = {
+ action: 'new/action/url',
+ target: '_blank',
+ method: 'POST'
+ },
+ testActionArgsData = {
+ action: {
+ args: {
+ arg: 'value'
+ }
+ }
+ },
+ processedData = form.data('form')._processData(testSimpleData);
+
+ expect(form.data('form').oldAttributes.action).toBe(initialFormAttrs.action);
+ expect(form.data('form').oldAttributes.target).toBe(initialFormAttrs.target);
+ expect(form.data('form').oldAttributes.method).toBe(initialFormAttrs.method);
+ expect(processedData.action).toBe(testSimpleData.action);
+ expect(processedData.target).toBe(testSimpleData.target);
+ expect(processedData.method).toBe(testSimpleData.method);
+
+ form.data('form')._rollback();
+ processedData = form.data('form')._processData(testActionArgsData);
+ form.data('form')._storeAttribute('action');
+ expect(processedData.action).toBe(form.data('form')._getActionUrl(testActionArgsData.action));
+ });
+
+ it('check before submit', function () {
+ var testForm = $('
').appendTo('body'),
+ testHandler = {
+ action: {
+ args: {
+ arg1: 'value1'
+ }
+ }
+ },
+ form = $(elementId).form({
+ handlersData: {
+ testHandler: testHandler
+ }
+ }),
+ beforeSubmitData = {
+ action: {
+ args: {
+ arg2: 'value2'
+ }
+ },
+ target: '_blank'
+ },
+ eventData = {
+ method: 'POST'
+ },
+ resultData = $.extend(true, {}, testHandler, beforeSubmitData, eventData);
+
+ form.data('form')._storeAttribute('action');
+ resultData = form.data('form')._processData(resultData);
+ testForm.prop(resultData);
+
+ form.on('beforeSubmit', function (e, data) {
+ $.extend(data, beforeSubmitData);
+ });
+
+ form.on('submit', function (e) {
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ });
+
+ form.data('form')._beforeSubmit('testHandler', eventData);
+ expect(testForm.prop('action')).toBe(form.prop('action'));
+ expect(testForm.prop('target')).toBe(form.prop('target'));
+ expect(testForm.prop('method')).toBe(form.prop('method'));
+ });
+
+ it('check submit', function () {
+ var formSubmitted = false,
+ form = $(elementId).form({
+ handlersData: {
+ save: {}
+ }
+ });
+
+ form.data('form')._storeAttribute('action');
+ form.data('form')._storeAttribute('target');
+ form.data('form')._storeAttribute('method');
+
+ form.on('submit', function (e) {
+ e.preventDefault();
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ formSubmitted = true;
+ }).prop({
+ action: 'new/action/url',
+ target: '_blank',
+ method: 'POST'
+ });
+
+ form.data('form')._submit({
+ type: 'save'
+ });
+
+ expect(form.attr('action')).toBe(form.data('form').oldAttributes.action);
+ expect(form.attr('target')).toBe(form.data('form').oldAttributes.target);
+ expect(form.attr('method')).toBe(form.data('form').oldAttributes.method);
+ expect(formSubmitted).toBeTruthy();
+
+ form.off('submit');
+ });
+
+ it('check build URL', function () {
+ var dataProvider = [
+ {
+ params: ['http://domain.com//', {
+ 'key[one]': 'value 1',
+ 'key2': '# value'
+ }],
+ expected: 'http://domain.com/key[one]/value%201/key2/%23%20value/'
+ },
+ {
+ params: ['http://domain.com', {
+ 'key[one]': 'value 1',
+ 'key2': '# value'
+ }],
+ expected: 'http://domain.com/key[one]/value%201/key2/%23%20value/'
+ },
+ {
+ params: ['http://domain.com?some=param', {
+ 'key[one]': 'value 1',
+ 'key2': '# value'
+ }],
+ expected: 'http://domain.com?some=param&key[one]=value%201&key2=%23%20value'
+ },
+ {
+ params: ['http://domain.com?some=param&', {
+ 'key[one]': 'value 1',
+ 'key2': '# value'
+ }],
+ expected: 'http://domain.com?some=param&key[one]=value%201&key2=%23%20value'
+ }
+ ],
+ method = $.mage.form._proto._buildURL,
+ quantity = dataProvider.length,
+ i = 0;
+
+ expect(quantity).toBeTruthy();
+
+ for (i; i < quantity; i++) {
+ expect(dataProvider[i].expected).toBe(method.apply(null, dataProvider[i].params));
+ }
+ });
+ });
+ }
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/loader.test.js b/dev/tests/js/jasmine/tests/lib/mage/loader.test.js
new file mode 100644
index 0000000000000..93dd2ee91902c
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/loader.test.js
@@ -0,0 +1,79 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'mage/loader'
+], function ($) {
+ 'use strict';
+
+ describe('mage/loader', function () {
+ describe('Check loader', function () {
+ var loaderSelector = '#loader';
+
+ beforeEach(function () {
+ var $loader = $('
');
+
+ $('body').append($loader);
+ });
+
+ afterEach(function () {
+ $(loaderSelector).remove();
+ $(loaderSelector).loader('destroy');
+ });
+
+ it('Check that loader inited', function () {
+ var $loader = $(loaderSelector).loader({
+ icon: 'icon.gif'
+ });
+
+ $loader.loader('show');
+
+ expect($loader.is(':mage-loader')).toBe(true);
+ expect($loader.find('p').text()).toBe('Please wait...');
+ expect($loader.find('img').prop('src').split('/').pop()).toBe('icon.gif');
+ expect($loader.find('img').prop('alt')).toBe('Loading...');
+ });
+
+ it('Body init', function () {
+ var $loader = $('body').loader();
+
+ $loader.loader('show');
+
+ expect($loader.is(':mage-loader')).toBe(true);
+ $loader.loader('destroy');
+ });
+
+ it('Check show/hide', function () {
+ var $loader = $(loaderSelector).loader(),
+ $loadingMask;
+
+ $loader.loader('show');
+ $loadingMask = $('.loading-mask');
+ expect($loadingMask.is(':visible')).toBe(true);
+
+ $loader.loader('hide');
+ expect($loadingMask.is(':hidden')).toBe(true);
+
+ $loader.loader('show');
+ $loader.trigger('processStop');
+ expect($loadingMask.is(':hidden')).toBe(true);
+ });
+
+ it('Check destroy', function () {
+ var $loader = $(loaderSelector).loader(),
+ $loadingMask;
+
+ $loader.loader('show');
+ $loadingMask = $('.loading-mask');
+ expect($loadingMask.is(':visible')).toBe(true);
+
+ $loader.loader('destroy');
+ expect($loadingMask.is(':visible')).toBe(false);
+ });
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/menu.test.js b/dev/tests/js/jasmine/tests/lib/mage/menu.test.js
new file mode 100644
index 0000000000000..69d8af4ff3dba
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/menu.test.js
@@ -0,0 +1,110 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'mage/menu',
+ 'text!tests/assets/lib/web/mage/menu.html'
+], function ($, menu, menuTmpl) {
+ 'use strict';
+
+ describe('mage/menu', function () {
+ describe('Menu expanded', function () {
+ var menuSelector = '#menu';
+
+ beforeEach(function () {
+ var $menu = $(menuTmpl);
+
+ $('body').append($menu);
+ });
+
+ afterEach(function () {
+ $(menuSelector).remove();
+ });
+
+ it('Check that menu expanded', function () {
+ var $menu = $(menuSelector),
+ $menuItems = $menu.find('li'),
+ $submenu = $menuItems.find('ul');
+
+ menu.menu({
+ expanded: true
+ }, $menu);
+ expect($submenu.hasClass('expanded')).toBe(true);
+ });
+ });
+
+ describe('Menu hover event', function () {
+ var menuSelector = '#menu',
+ $menu;
+
+ beforeEach(function () {
+ var $menuObject = $(menuTmpl);
+
+ $('body').append($menuObject);
+ $menu = $(menuSelector).menu({
+ delay: 0,
+ showDelay: 0,
+ hideDelay: 0
+ });
+ });
+
+ afterEach(function () {
+ $(menuSelector).remove();
+ });
+
+ it('Check that menu expanded', function (done) {
+ var $menuItem = $menu.find('li.test-menu-item'),
+ $submenu = $menuItem.find('ul');
+
+ $menuItem.trigger('mouseover');
+ setTimeout(function () {
+ expect($submenu.attr('aria-expanded')).toBe('true');
+ $menuItem.trigger('mouseout');
+ setTimeout(function () {
+ expect($submenu.attr('aria-expanded')).toBe('false');
+ done();
+ }, 300);
+ }, 300);
+ });
+ });
+
+ describe('Menu navigation', function () {
+ var menuSelector = '#menu',
+ $menu;
+
+ beforeEach(function () {
+ var $menuObject = $(menuTmpl);
+
+ $('body').append($menuObject);
+ $menu = $(menuSelector).menu();
+ });
+
+ afterEach(function () {
+ $(menuSelector).remove();
+ });
+
+ it('Check max item limit', function () {
+ var $menuItems;
+
+ $menu.navigation({
+ maxItems: 3
+ });
+ $menuItems = $menu.find('li:visible');
+
+ expect($menuItems.length).toBe(4);
+ });
+
+ it('Check that More Menu item will be added', function () {
+ $menu.navigation({
+ responsive: 'onResize'
+ });
+
+ expect($('body').find('.ui-menu-more').length).toBeGreaterThan(0);
+ });
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js b/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js
new file mode 100644
index 0000000000000..a6138df073434
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js
@@ -0,0 +1,93 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'jquery/ui',
+ 'mage/tabs',
+ 'text!tests/assets/lib/web/mage/tabs.html'
+], function ($, ui, tabs, tabsTmpl) {
+ 'use strict';
+
+ describe('mage/tabs', function () {
+ var tabsSelector = '#tabs';
+
+ beforeEach(function () {
+ var $tabs = $(tabsTmpl);
+
+ $('body').append($tabs);
+ });
+
+ afterEach(function () {
+ $(tabsSelector).remove();
+ $(tabsSelector).tabs('destroy');
+ });
+
+ it('Check tabs inited', function () {
+ var $tabs = $(tabsSelector).tabs();
+
+ expect($tabs.is(':mage-tabs')).toBe(true);
+ });
+
+ it('Check tabs collapsible inited', function () {
+ var $title1 = $('#title1'),
+ $title2 = $('#title2');
+
+ $(tabsSelector).tabs();
+
+ expect($title1.is(':mage-collapsible')).toBe(true);
+ expect($title2.is(':mage-collapsible')).toBe(true);
+ });
+
+ it('Check tabs active', function () {
+ var $content1 = $('#content1'),
+ $content2 = $('#content2');
+
+ $(tabsSelector).tabs({
+ active: 1
+ });
+
+ expect($content1.is(':hidden')).toBe(true);
+ expect($content2.is(':visible')).toBe(true);
+ });
+
+ it('Check tabs closing others tabs when one gets activated', function () {
+ var $title2 = $('#title2'),
+ $content1 = $('#content1'),
+ $content2 = $('#content2');
+
+ $(tabsSelector).tabs();
+
+ expect($content1.is(':visible')).toBe(true);
+ expect($content2.is(':hidden')).toBe(true);
+
+ $title2.trigger('click');
+
+ expect($content1.is(':hidden')).toBe(true);
+ expect($content2.is(':visible')).toBe(true);
+ });
+
+ it('Check tabs enable,disable,activate,deactivate options', function () {
+ var $title1 = $('#title1'),
+ $content1 = $('#content1'),
+ $tabs = $(tabsSelector).tabs();
+
+ expect($content1.is(':visible')).toBe(true);
+ $tabs.tabs('deactivate', 0);
+ expect($content1.is(':hidden')).toBe(true);
+ $tabs.tabs('activate', 0);
+ expect($content1.is(':visible')).toBe(true);
+ $tabs.tabs('disable', 0);
+ expect($content1.is(':hidden')).toBe(true);
+ $title1.trigger('click');
+ expect($content1.is(':hidden')).toBe(true);
+ $tabs.tabs('enable', 0);
+ expect($content1.is(':visible')).toBe(true);
+ $title1.trigger('click');
+ expect($content1.is(':visible')).toBe(true);
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/translate-inline.test.js b/dev/tests/js/jasmine/tests/lib/mage/translate-inline.test.js
new file mode 100644
index 0000000000000..bcdfc4cc59705
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/translate-inline.test.js
@@ -0,0 +1,111 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'mage/translate-inline',
+ 'text!tests/assets/lib/web/mage/translate-inline.html'
+], function ($, TranslateInline, translateTmpl) {
+ 'use strict';
+
+ describe('mage/translate-inline', function () {
+ describe('Check translate', function () {
+ var translateSelector = '[data-role="translate-dialog"]',
+ translateTemplateSelector = '#translate-form-template';
+
+ beforeEach(function () {
+ var translateBlock = $(translateTmpl);
+
+ $('body').append(translateBlock);
+ });
+
+ afterEach(function () {
+ $(translateSelector).remove();
+ $(translateSelector).translateInline('destroy');
+ $(translateTemplateSelector).remove();
+ });
+
+ it('Check that translate inited', function () {
+ var translateInline = $(translateSelector).translateInline();
+
+ expect(translateInline.is(':mage-translateInline')).toBe(true);
+ });
+
+ it('Check that translate hidden on init and visible on trigger', function () {
+ var translateInline = $(translateSelector).translateInline({
+ id: 'dialog-id'
+ }),
+ isDialogHiddenOnInit = translateInline.is(':hidden'),
+ dialogVisibleAfterTriggerEdit;
+
+ translateInline.trigger('edit.editTrigger');
+ dialogVisibleAfterTriggerEdit = translateInline.is(':visible');
+ expect(isDialogHiddenOnInit).toBe(true);
+ expect(dialogVisibleAfterTriggerEdit).toBe(true);
+ });
+
+ it('Check translation form template', function () {
+ var translateFormId = 'translate-form-id',
+ translateFormContent = 'New Template Variable',
+ translateInline = $(translateSelector).translateInline({
+ translateForm: {
+ data: {
+ id: translateFormId,
+ newTemplateVariable: translateFormContent
+ }
+ }
+ }),
+ $translateForm;
+
+ translateInline.trigger('edit.editTrigger');
+ $translateForm = $('#' + translateFormId);
+
+ expect($translateForm.length).toBeGreaterThan(0);
+ expect($translateForm.text()).toBe(translateFormContent);
+ });
+
+ it('Check translation submit', function () {
+ var options = {
+ ajaxUrl: 'www.test.com',
+ area: 'test',
+ translateForm: {
+ template: '
',
+ data: {
+ id: 'translate-form-id'
+ }
+ }
+ },
+ expectedEequestData = 'area=test&test=test',
+ translateInline = $(translateSelector).translateInline(options),
+ $submitButton = $('body').find('.action-primary'),
+ originalAjax = $.ajax;
+
+ $.ajax = jasmine.createSpy().and.callFake(function (request) {
+ expect(request.url).toBe(options.ajaxUrl);
+ expect(request.type).toBe('POST');
+ expect(request.data).toBe(expectedEequestData);
+
+ return {
+ complete: jasmine.createSpy()
+ };
+ });
+
+ translateInline.trigger('edit.editTrigger');
+ $submitButton.trigger('click');
+ $.ajax = originalAjax;
+ });
+
+ it('Check translation destroy', function () {
+ var translateInline = $(translateSelector).translateInline();
+
+ translateInline.trigger('edit.editTrigger');
+ expect(translateInline.is(':mage-translateInline')).toBe(true);
+ translateInline.translateInline('destroy');
+ expect(translateInline.is(':mage-translateInline')).toBe(false);
+ });
+ });
+ });
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/translate.test.js b/dev/tests/js/jasmine/tests/lib/mage/translate.test.js
new file mode 100644
index 0000000000000..c87cfa227c1aa
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/lib/mage/translate.test.js
@@ -0,0 +1,49 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+/* eslint-disable max-nested-callbacks */
+define([
+ 'jquery',
+ 'mage/translate'
+], function ($) {
+ 'use strict';
+
+ describe('Test for mage/translate jQuery plugin', function () {
+ it('works with one string as parameter', function () {
+ $.mage.translate.add('Hello World!');
+ expect('Hello World!').toEqual($.mage.translate.translate('Hello World!'));
+ });
+ it('works with one array as parameter', function () {
+ $.mage.translate.add(['Hello World!', 'Bonjour tout le monde!']);
+ expect('Hello World!').toEqual($.mage.translate.translate('Hello World!'));
+ });
+ it('works with one object as parameter', function () {
+ var translation = {
+ 'Hello World!': 'Bonjour tout le monde!'
+ };
+
+ $.mage.translate.add(translation);
+ expect(translation['Hello World!']).toEqual($.mage.translate.translate('Hello World!'));
+
+ translation = {
+ 'Hello World!': 'Hallo Welt!',
+ 'Some text with symbols!-+"%#*': 'Ein Text mit Symbolen!-+"%#*'
+ };
+
+ $.mage.translate.add(translation);
+ $.each(translation, function (key) {
+ expect(translation[key]).toEqual($.mage.translate.translate(key));
+ });
+ });
+ it('works with two string as parameter', function () {
+ $.mage.translate.add('Hello World!', 'Bonjour tout le monde!');
+ expect('Bonjour tout le monde!').toEqual($.mage.translate.translate('Hello World!'));
+ });
+ it('works with translation alias __', function () {
+ $.mage.translate.add('Hello World!');
+ expect('Hello World!').toEqual($.mage.__('Hello World!'));
+ });
+ });
+
+});
diff --git a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js
index 12138e5939a7b..ccf3591be0dfe 100644
--- a/dev/tests/js/jasmine/tests/lib/mage/validation.test.js
+++ b/dev/tests/js/jasmine/tests/lib/mage/validation.test.js
@@ -255,4 +255,891 @@ define([
});
});
+ describe('Testing validate-no-html-tags', function () {
+ it('validate-no-html-tags', function () {
+ expect($.validator.methods['validate-no-html-tags']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-no-html-tags']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-no-html-tags']
+ .call($.validator.prototype, 'abc')).toEqual(true);
+ expect($.validator.methods['validate-no-html-tags']
+ .call($.validator.prototype, '
abc
')).toEqual(false);
+ });
+ });
+
+ describe('Testing allow-container-className', function () {
+ it('allow-container-className', function () {
+ var radio = $('
'),
+ checkbox = $('
'),
+ radio2 = $('
'),
+ checkbox2 = $('
');
+
+ expect($.validator.methods['allow-container-className']
+ .call($.validator.prototype, radio[0])).toEqual(true);
+ expect($.validator.methods['allow-container-className']
+ .call($.validator.prototype, checkbox[0])).toEqual(true);
+ expect($.validator.methods['allow-container-className']
+ .call($.validator.prototype, radio2[0])).toEqual(false);
+ expect($.validator.methods['allow-container-className']
+ .call($.validator.prototype, checkbox2[0])).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-select', function () {
+ it('validate-select', function () {
+ expect($.validator.methods['validate-select']
+ .call($.validator.prototype, '')).toEqual(false);
+ expect($.validator.methods['validate-select']
+ .call($.validator.prototype, 'none')).toEqual(false);
+ expect($.validator.methods['validate-select']
+ .call($.validator.prototype, null)).toEqual(false);
+ expect($.validator.methods['validate-select']
+ .call($.validator.prototype, undefined)).toEqual(false);
+ expect($.validator.methods['validate-select']
+ .call($.validator.prototype, 'abc')).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-no-empty', function () {
+ it('validate-no-empty', function () {
+ expect($.validator.methods['validate-no-empty']
+ .call($.validator.prototype, '')).toEqual(false);
+ expect($.validator.methods['validate-no-empty']
+ .call($.validator.prototype, null)).toEqual(false);
+ expect($.validator.methods['validate-no-empty']
+ .call($.validator.prototype, undefined)).toEqual(false);
+ expect($.validator.methods['validate-no-empty']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-no-empty']
+ .call($.validator.prototype, 'test')).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-alphanum-with-spaces', function () {
+ it('validate-alphanum-with-spaces', function () {
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, ' ')).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, 'abc ')).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, ' 123 ')).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, ' abc123 ')).toEqual(true);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, ' !@# ')).toEqual(false);
+ expect($.validator.methods['validate-alphanum-with-spaces']
+ .call($.validator.prototype, ' abc.123 ')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-phoneStrict', function () {
+ it('validate-phoneStrict', function () {
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, '5121231234')).toEqual(false);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, '512.123.1234')).toEqual(false);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, '512-123-1234')).toEqual(true);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, '(512)123-1234')).toEqual(true);
+ expect($.validator.methods['validate-phoneStrict']
+ .call($.validator.prototype, '(512) 123-1234')).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-phoneLax', function () {
+ it('validate-phoneLax', function () {
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '5121231234')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '512.123.1234')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '512-123-1234')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '(512)123-1234')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '(512) 123-1234')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '(512)1231234')).toEqual(true);
+ expect($.validator.methods['validate-phoneLax']
+ .call($.validator.prototype, '(512)_123_1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-fax', function () {
+ it('validate-fax', function () {
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, '5121231234')).toEqual(false);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, '512.123.1234')).toEqual(false);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, '512-123-1234')).toEqual(true);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, '(512)123-1234')).toEqual(true);
+ expect($.validator.methods['validate-fax']
+ .call($.validator.prototype, '(512) 123-1234')).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-email', function () {
+ it('validate-email', function () {
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, '123@123.com')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, 'abc@124.en')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, 'abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, 'abc.abc.abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, 'abc.abc-abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, 'abc.abc_abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-email']
+ .call($.validator.prototype, 'abc.abc_abc@abc')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-emailSender', function () {
+ it('validate-emailSender', function () {
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, ' ')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, '123@123.com')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, 'abc@124.en')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, 'abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, 'abc.abc.abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, 'abc.abc-abc@abc.commmmm')).toEqual(true);
+ expect($.validator.methods['validate-emailSender']
+ .call($.validator.prototype, 'abc.abc_abc@abc.commmmm')).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-password', function () {
+ it('validate-password', function () {
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, null)).toEqual(false);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, undefined)).toEqual(false);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, ' ')).toEqual(true);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, '123@123.com')).toEqual(true);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, 'abc')).toEqual(false);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, 'abc ')).toEqual(false);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, ' abc ')).toEqual(false);
+ expect($.validator.methods['validate-password']
+ .call($.validator.prototype, 'dddd')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-admin-password', function () {
+ it('validate-admin-password', function () {
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, null)).toEqual(false);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, undefined)).toEqual(false);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, ' ')).toEqual(true);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, '123@123.com')).toEqual(true);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, 'abc')).toEqual(false);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, 'abc ')).toEqual(false);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, ' abc ')).toEqual(false);
+ expect($.validator.methods['validate-admin-password']
+ .call($.validator.prototype, 'dddd')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-url', function () {
+ it('validate-url', function () {
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, 'http://www.google.com')).toEqual(true);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, 'http://127.0.0.1:8080/index.php')).toEqual(true);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, 'http://app-spot.com/index.php')).toEqual(true);
+ expect($.validator.methods['validate-url']
+ .call($.validator.prototype, 'http://app-spot_space.com/index.php')).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-clean-url', function () {
+ it('validate-clean-url', function () {
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, 'http://www.google.com')).toEqual(true);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, 'http://127.0.0.1:8080/index.php')).toEqual(false);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, 'http://127.0.0.1:8080')).toEqual(false);
+ expect($.validator.methods['validate-clean-url']
+ .call($.validator.prototype, 'http://127.0.0.1')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-xml-identifier', function () {
+ it('validate-xml-identifier', function () {
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, 'abc')).toEqual(true);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, 'abc_123')).toEqual(true);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, 'abc-123')).toEqual(true);
+ expect($.validator.methods['validate-xml-identifier']
+ .call($.validator.prototype, '123-abc')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-ssn', function () {
+ it('validate-ssn', function () {
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, 'abc')).toEqual(false);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, '123-13-1234')).toEqual(true);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, '012-12-1234')).toEqual(true);
+ expect($.validator.methods['validate-ssn']
+ .call($.validator.prototype, '23-12-1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-zip-us', function () {
+ it('validate-zip-us', function () {
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, '12345-1234')).toEqual(true);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, '02345')).toEqual(true);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, '1234')).toEqual(false);
+ expect($.validator.methods['validate-zip-us']
+ .call($.validator.prototype, '1234-1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-date-au', function () {
+ it('validate-date-au', function () {
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, '01/01/2012')).toEqual(true);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, '30/01/2012')).toEqual(true);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, '01/30/2012')).toEqual(false);
+ expect($.validator.methods['validate-date-au']
+ .call($.validator.prototype, '1/1/2012')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-currency-dollar', function () {
+ it('validate-currency-dollar', function () {
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, '$123')).toEqual(true);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, '$1,123.00')).toEqual(true);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, '$1234')).toEqual(true);
+ expect($.validator.methods['validate-currency-dollar']
+ .call($.validator.prototype, '$1234.1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-not-negative-number', function () {
+ it('validate-not-negative-number', function () {
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '0')).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '1')).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '1234')).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '1,234.1234')).toEqual(true);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '-1')).toEqual(false);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '-1e')).toEqual(false);
+ expect($.validator.methods['validate-not-negative-number']
+ .call($.validator.prototype, '-1,234.1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-greater-than-zero', function () {
+ it('validate-greater-than-zero', function () {
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '0')).toEqual(false);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '1')).toEqual(true);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '1234')).toEqual(true);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '1,234.1234')).toEqual(true);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '-1')).toEqual(false);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '-1e')).toEqual(false);
+ expect($.validator.methods['validate-greater-than-zero']
+ .call($.validator.prototype, '-1,234.1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-css-length', function () {
+ it('validate-css-length', function () {
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, null)).toEqual(false);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, undefined)).toEqual(false);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '0')).toEqual(true);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '1')).toEqual(true);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '1234')).toEqual(true);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '1,234.1234')).toEqual(false);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '-1')).toEqual(false);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '-1e')).toEqual(false);
+ expect($.validator.methods['validate-css-length']
+ .call($.validator.prototype, '-1,234.1234')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-data', function () {
+ it('validate-data', function () {
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, '')).toEqual(true);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, null)).toEqual(true);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, undefined)).toEqual(true);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, ' ')).toEqual(false);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, '123abc')).toEqual(false);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, 'abc')).toEqual(true);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, ' abc')).toEqual(false);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, 'abc123')).toEqual(true);
+ expect($.validator.methods['validate-data']
+ .call($.validator.prototype, 'abc-123')).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-one-required-by-name', function () {
+ it('validate-one-required-by-name', function () {
+ var radio = $('
'),
+ radio2 = $('
'),
+ checkbox = $('
'),
+ checkbox2 = $('
'),
+ $test = $('
'),
+ prevForm = $.validator.prototype.currentForm;
+
+ $.validator.prototype.currentForm = $test[0];
+
+ $test.append(radio);
+ expect($.validator.methods['validate-one-required-by-name']
+ .call($.validator.prototype, null, radio[0], true)).toEqual(false);
+ $test.append(radio2);
+ expect($.validator.methods['validate-one-required-by-name']
+ .call($.validator.prototype, null, radio2[0], true)).toEqual(true);
+ $test.append(checkbox);
+ expect($.validator.methods['validate-one-required-by-name']
+ .call($.validator.prototype, null, checkbox[0], true)).toEqual(false);
+ $test.append(checkbox2);
+ expect($.validator.methods['validate-one-required-by-name']
+ .call($.validator.prototype, null, checkbox2[0], true)).toEqual(true);
+
+ $.validator.prototype.currentForm = prevForm;
+ });
+ });
+
+ describe('Testing less-than-equals-to', function () {
+ it('less-than-equals-to', function () {
+ var elm1 = $('
'),
+ elm2 = $('
'),
+ elm3 = $('
'),
+ elm4 = $('
'),
+ elm5 = $('
'),
+ elm6 = $('
'),
+ elm7 = $('
'),
+ elm8 = $('
');
+
+ expect($.validator.methods['less-than-equals-to']
+ .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(false);
+ elm1[0].value = 4;
+ expect($.validator.methods['less-than-equals-to']
+ .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(true);
+ expect($.validator.methods['less-than-equals-to']
+ .call($.validator.prototype, elm3[0].value, elm3, elm4)).toEqual(true);
+ expect($.validator.methods['less-than-equals-to']
+ .call($.validator.prototype, elm5[0].value, elm5, elm6)).toEqual(true);
+ expect($.validator.methods['less-than-equals-to']
+ .call($.validator.prototype, elm7[0].value, elm7, elm8)).toEqual(true);
+ });
+ });
+
+ describe('Testing greater-than-equals-to', function () {
+ it('greater-than-equals-to', function () {
+ var elm1 = $('
'),
+ elm2 = $('
'),
+ elm3 = $('
'),
+ elm4 = $('
'),
+ elm5 = $('
'),
+ elm6 = $('
'),
+ elm7 = $('
'),
+ elm8 = $('
');
+
+ expect($.validator.methods['greater-than-equals-to']
+ .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(false);
+ elm1[0].value = 9;
+ expect($.validator.methods['greater-than-equals-to']
+ .call($.validator.prototype, elm1[0].value, elm1, elm2)).toEqual(true);
+ expect($.validator.methods['greater-than-equals-to']
+ .call($.validator.prototype, elm3[0].value, elm3, elm4)).toEqual(true);
+ expect($.validator.methods['greater-than-equals-to']
+ .call($.validator.prototype, elm5[0].value, elm5, elm6)).toEqual(true);
+ expect($.validator.methods['greater-than-equals-to']
+ .call($.validator.prototype, elm7[0].value, elm7, elm8)).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-cc-type-select', function () {
+ it('validate-cc-type-select', function () {
+ var visaValid = $('
'),
+ visaInvalid = $('
'),
+ mcValid = $('
'),
+ mcInvalid = $('
'),
+ aeValid = $('
'),
+ aeInvalid = $('
'),
+ diValid = $('
'),
+ diInvalid = $('
'),
+ dnValid = $('
'),
+ dnInvalid = $('
'),
+ jcbValid = $('
'),
+ jcbInvalid = $('
');
+
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'VI', null, visaValid)).toEqual(true);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'VI', null, visaInvalid)).toEqual(false);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'MC', null, mcValid)).toEqual(true);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'MC', null, mcInvalid)).toEqual(false);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'AE', null, aeValid)).toEqual(true);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'AE', null, aeInvalid)).toEqual(false);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'DI', null, diValid)).toEqual(true);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'DI', null, diInvalid)).toEqual(false);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'DN', null, dnValid)).toEqual(true);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'DN', null, dnInvalid)).toEqual(false);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'JCB', null, jcbValid)).toEqual(true);
+ expect($.validator.methods['validate-cc-type-select']
+ .call($.validator.prototype, 'JCB', null, jcbInvalid)).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-cc-number', function () {
+ it('validate-cc-number', function () {
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '4916835098995909', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '5265071363284878', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6011120623356953', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '371293266574617', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '4916835098995901', null, null)).toEqual(false);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '5265071363284870', null, null)).toEqual(false);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6011120623356951', null, null)).toEqual(false);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '371293266574619', null, null)).toEqual(false);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '2221220000000003', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '2721220000000008', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '601109020000000003', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6011111144444444', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6011222233334444', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6011522233334447', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '601174455555553', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6011745555555550', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '601177455555556', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '601182455555556', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '601187999555558', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '601287999555556', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6444444444444443', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6644444444444441', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3044444444444444', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3064444444444449', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3095444444444442', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3096444444444441', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3696444444444445', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3796444444444444', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3896444444444443', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3528444444444449', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '3529444444444448', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6221262244444440', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6229981111111111', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6249981111111117', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6279981111111110', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6282981111111115', null, null)).toEqual(true);
+ expect($.validator.methods['validate-cc-number']
+ .call($.validator.prototype, '6289981111111118', null, null)).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-cc-type', function () {
+ it('validate-cc-type', function () {
+ var select = $('
' +
+ '' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ');
+
+ select.val('VI');
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '4916835098995909', null, select)).toEqual(true);
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '5265071363284878', null, select)).toEqual(false);
+
+ select.val('MC');
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '5265071363284878', null, select)).toEqual(true);
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '4916835098995909', null, select)).toEqual(false);
+
+ select.val('AE');
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '371293266574617', null, select)).toEqual(true);
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '5265071363284878', null, select)).toEqual(false);
+
+ select.val('DI');
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '6011050000000009', null, select)).toEqual(true);
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '371293266574617', null, select)).toEqual(false);
+
+ select.val('DN');
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '3095434000000001', null, select)).toEqual(true);
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '6011050000000009', null, select)).toEqual(false);
+
+ select.val('JCB');
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '3528000000000007', null, select)).toEqual(true);
+ expect($.validator.methods['validate-cc-type']
+ .call($.validator.prototype, '3095434000000001', null, select)).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-cc-exp', function () {
+ it('validate-cc-exp', function () {
+ var year = $('
'),
+ currentTime = new Date(),
+ currentMonth = currentTime.getMonth() + 1,
+ currentYear = currentTime.getFullYear();
+
+ year.val(currentYear);
+
+ if (currentMonth > 1) {
+ expect($.validator.methods['validate-cc-exp']
+ .call($.validator.prototype, currentMonth - 1, null, year)).toEqual(false);
+ }
+ expect($.validator.methods['validate-cc-exp']
+ .call($.validator.prototype, currentMonth, null, year)).toEqual(true);
+ year.val(currentYear + 1);
+ expect($.validator.methods['validate-cc-exp']
+ .call($.validator.prototype, currentMonth, null, year)).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-cc-cvn', function () {
+ it('validate-cc-cvn', function () {
+ var ccType = $('
' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ');
+
+ ccType.val('VI');
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '123', null, ccType)).toEqual(true);
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '1234', null, ccType)).toEqual(false);
+
+ ccType.val('MC');
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '123', null, ccType)).toEqual(true);
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '1234', null, ccType)).toEqual(false);
+
+ ccType.val('AE');
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '1234', null, ccType)).toEqual(true);
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '123', null, ccType)).toEqual(false);
+
+ ccType.val('DI');
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '123', null, ccType)).toEqual(true);
+ expect($.validator.methods['validate-cc-cvn']
+ .call($.validator.prototype, '1234', null, ccType)).toEqual(false);
+ });
+ });
+
+ describe('Testing validate-number-range', function () {
+ it('validate-number-range', function () {
+ var el1 = $('
').get(0);
+
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '-1', null, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '1', null, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '', null, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, null, null, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '0', null, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, 'asds', null, null)).toEqual(false);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '10', null, '10-20.06')).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '15', null, '10-20.06')).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '1', null, '10-20.06')).toEqual(false);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '30', null, '10-20.06')).toEqual(false);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '10', el1, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '15', el1, null)).toEqual(true);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '1', el1, null)).toEqual(false);
+ expect($.validator.methods['validate-number-range']
+ .call($.validator.prototype, '30', el1, null)).toEqual(true);
+ });
+ });
+
+ describe('Testing validate-digits-range', function () {
+ it('validate-digits-range', function () {
+ var el1 = $('
').get(0);
+
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '-1', null, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '1', null, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '', null, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, null, null, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '0', null, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, 'asds', null, null)).toEqual(false);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '10', null, '10-20')).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '15', null, '10-20')).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '1', null, '10-20')).toEqual(false);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '30', null, '10-20')).toEqual(false);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '30', null, '10-20.06')).toEqual(false);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '10', el1, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '15', el1, null)).toEqual(true);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '1', el1, null)).toEqual(false);
+ expect($.validator.methods['validate-digits-range']
+ .call($.validator.prototype, '30', el1, null)).toEqual(false);
+ });
+ });
});
diff --git a/lib/internal/Magento/Framework/App/Response/Http.php b/lib/internal/Magento/Framework/App/Response/Http.php
index 099b1500cb14b..62ff94e7043f5 100644
--- a/lib/internal/Magento/Framework/App/Response/Http.php
+++ b/lib/internal/Magento/Framework/App/Response/Http.php
@@ -9,10 +9,12 @@
use Magento\Framework\App\Http\Context;
use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Stdlib\Cookie\CookieMetadata;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
use Magento\Framework\Stdlib\CookieManagerInterface;
use Magento\Framework\Stdlib\DateTime;
use Magento\Framework\App\Request\Http as HttpRequest;
+use Magento\Framework\Session\Config\ConfigInterface;
class Http extends \Magento\Framework\HTTP\PhpEnvironment\Response
{
@@ -50,25 +52,33 @@ class Http extends \Magento\Framework\HTTP\PhpEnvironment\Response
*/
protected $dateTime;
+ /**
+ * @var \Magento\Framework\Session\Config\ConfigInterface
+ */
+ private $sessionConfig;
+
/**
* @param HttpRequest $request
* @param CookieManagerInterface $cookieManager
* @param CookieMetadataFactory $cookieMetadataFactory
* @param Context $context
* @param DateTime $dateTime
+ * @param ConfigInterface|null $sessionConfig
*/
public function __construct(
HttpRequest $request,
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
Context $context,
- DateTime $dateTime
+ DateTime $dateTime,
+ ConfigInterface $sessionConfig = null
) {
$this->request = $request;
$this->cookieManager = $cookieManager;
$this->cookieMetadataFactory = $cookieMetadataFactory;
$this->context = $context;
$this->dateTime = $dateTime;
+ $this->sessionConfig = $sessionConfig ?: ObjectManager::getInstance()->get(ConfigInterface::class);
}
/**
@@ -91,7 +101,10 @@ public function sendVary()
{
$varyString = $this->context->getVaryString();
if ($varyString) {
- $sensitiveCookMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata()->setPath('/');
+ $cookieLifeTime = $this->sessionConfig->getCookieLifetime();
+ $sensitiveCookMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata(
+ [CookieMetadata::KEY_DURATION => $cookieLifeTime]
+ )->setPath('/');
$this->cookieManager->setSensitiveCookie(self::COOKIE_VARY_STRING, $varyString, $sensitiveCookMetadata);
} elseif ($this->request->get(self::COOKIE_VARY_STRING)) {
$cookieMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata()->setPath('/');
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
index 3215a82ffad5f..f9aed16ec6a44 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php
@@ -8,6 +8,8 @@
use \Magento\Framework\App\Response\Http;
use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\Session\Config\ConfigInterface;
+use Magento\Framework\Stdlib\Cookie\CookieMetadata;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -40,6 +42,12 @@ class HttpTest extends \PHPUnit\Framework\TestCase
/** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */
protected $objectManager;
+ /** @var ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */
+ private $sessionConfigMock;
+
+ /** @var int */
+ private $cookieLifeTime = 3600;
+
protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -59,6 +67,10 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
+ $this->sessionConfigMock = $this->getMockBuilder(ConfigInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
$this->model = $this->objectManager->getObject(
\Magento\Framework\App\Response\Http::class,
[
@@ -66,7 +78,8 @@ protected function setUp()
'cookieManager' => $this->cookieManagerMock,
'cookieMetadataFactory' => $this->cookieMetadataFactoryMock,
'context' => $this->contextMock,
- 'dateTime' => $this->dateTimeMock
+ 'dateTime' => $this->dateTimeMock,
+ 'sessionConfig' => $this->sessionConfigMock
]
);
$this->model->headersSentThrowsException = false;
@@ -99,9 +112,14 @@ public function testSendVary()
->method('getVaryString')
->will($this->returnValue($expectedCookieValue));
+ $this->sessionConfigMock->expects($this->once())
+ ->method('getCookieLifetime')
+ ->willReturn($this->cookieLifeTime);
+
$this->cookieMetadataFactoryMock->expects($this->once())
->method('createSensitiveCookieMetadata')
- ->will($this->returnValue($sensitiveCookieMetadataMock));
+ ->with([CookieMetadata::KEY_DURATION => $this->cookieLifeTime])
+ ->willReturn($sensitiveCookieMetadataMock);
$this->cookieManagerMock->expects($this->once())
->method('setSensitiveCookie')
diff --git a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php
index f9272683005ce..bcedf16e3f5be 100644
--- a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php
+++ b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php
@@ -235,6 +235,7 @@ protected function load()
if (is_array($data)) {
foreach ($data as $row) {
$item = $this->createDataObject(['data' => $row]);
+ $item->setOrigData();
$this->addItem($item);
}
}
diff --git a/lib/internal/Magento/Framework/Data/Form/Filter/Trim.php b/lib/internal/Magento/Framework/Data/Form/Filter/Trim.php
new file mode 100644
index 0000000000000..0dbbcf6dbf8d0
--- /dev/null
+++ b/lib/internal/Magento/Framework/Data/Form/Filter/Trim.php
@@ -0,0 +1,37 @@
+
+ */
+namespace Magento\Framework\Data\Form\Filter;
+
+class Trim implements \Magento\Framework\Data\Form\Filter\FilterInterface
+{
+ /**
+ * Returns the result of filtering $value
+ *
+ * @param string $value
+ * @return string
+ */
+ public function inputFilter($value)
+ {
+ return trim($value, ' ');
+ }
+
+ /**
+ * Returns the result of filtering $value
+ *
+ * @param string $value
+ * @return string
+ */
+ public function outputFilter($value)
+ {
+ return $value;
+ }
+}
diff --git a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php
index 444ab7113d429..a36e41a526466 100644
--- a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php
+++ b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php
@@ -5,6 +5,9 @@
*/
namespace Magento\Framework\Image\Adapter;
+/**
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
+ */
class Gd2 extends \Magento\Framework\Image\Adapter\AbstractAdapter
{
/**
@@ -404,7 +407,7 @@ public function rotate($angle)
*/
public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity = 30, $tile = false)
{
- list($watermarkSrcWidth, $watermarkSrcHeight, $watermarkFileType, ) = $this->_getImageOptions($imagePath);
+ list($watermarkSrcWidth, $watermarkSrcHeight, $watermarkFileType,) = $this->_getImageOptions($imagePath);
$this->_getFileAttributes();
$watermark = call_user_func(
$this->_getCallback('create', $watermarkFileType, 'Unsupported watermark image format.'),
@@ -465,7 +468,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
} elseif ($this->getWatermarkPosition() == self::POSITION_CENTER) {
$positionX = $this->_imageSrcWidth / 2 - imagesx($watermark) / 2;
$positionY = $this->_imageSrcHeight / 2 - imagesy($watermark) / 2;
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$positionX,
@@ -478,7 +481,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
);
} elseif ($this->getWatermarkPosition() == self::POSITION_TOP_RIGHT) {
$positionX = $this->_imageSrcWidth - imagesx($watermark);
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$positionX,
@@ -490,7 +493,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
$this->getWatermarkImageOpacity()
);
} elseif ($this->getWatermarkPosition() == self::POSITION_TOP_LEFT) {
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$positionX,
@@ -504,7 +507,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
} elseif ($this->getWatermarkPosition() == self::POSITION_BOTTOM_RIGHT) {
$positionX = $this->_imageSrcWidth - imagesx($watermark);
$positionY = $this->_imageSrcHeight - imagesy($watermark);
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$positionX,
@@ -517,7 +520,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
);
} elseif ($this->getWatermarkPosition() == self::POSITION_BOTTOM_LEFT) {
$positionY = $this->_imageSrcHeight - imagesy($watermark);
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$positionX,
@@ -531,7 +534,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
}
if ($tile === false && $merged === false) {
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$positionX,
@@ -547,7 +550,7 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
$offsetY = $positionY;
while ($offsetY <= $this->_imageSrcHeight + imagesy($watermark)) {
while ($offsetX <= $this->_imageSrcWidth + imagesx($watermark)) {
- imagecopymerge(
+ $this->copyImageWithAlphaPercentage(
$this->_imageHandler,
$watermark,
$offsetX,
@@ -778,4 +781,106 @@ protected function _createEmptyImage($width, $height)
$this->imageDestroy();
$this->_imageHandler = $image;
}
+
+ /**
+ * Copy source image onto destination image with given alpha percentage
+ *
+ * @internal The arguments and functionality is the same as imagecopymerge
+ * but with proper handling of alpha transparency
+ *
+ * @param resource $destinationImage
+ * @param resource $sourceImage
+ * @param int $destinationX
+ * @param int $destinationY
+ * @param int $sourceX
+ * @param int $sourceY
+ * @param int $sourceWidth
+ * @param int $sourceHeight
+ * @param int $alphaPercentage
+ *
+ * @return bool
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ * @SuppressWarnings(PHPMD.NPathComplexity)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ private function copyImageWithAlphaPercentage(
+ $destinationImage,
+ $sourceImage,
+ $destinationX,
+ $destinationY,
+ $sourceX,
+ $sourceY,
+ $sourceWidth,
+ $sourceHeight,
+ $alphaPercentage
+ ) {
+ if (imageistruecolor($destinationImage) === false || imageistruecolor($sourceImage) === false) {
+ return imagecopymerge(
+ $destinationImage,
+ $sourceImage,
+ $destinationX,
+ $destinationY,
+ $sourceX,
+ $sourceY,
+ $sourceWidth,
+ $sourceHeight,
+ $alphaPercentage
+ );
+ }
+
+ if ($alphaPercentage >= 100) {
+ return imagecopy(
+ $destinationImage,
+ $sourceImage,
+ $destinationX,
+ $destinationY,
+ $sourceX,
+ $sourceY,
+ $sourceWidth,
+ $sourceHeight
+ );
+ }
+
+ if ($alphaPercentage < 0) {
+ return false;
+ }
+
+ $sizeX = imagesx($sourceImage);
+ $sizeY = imagesy($sourceImage);
+ if ($sizeX === false || $sizeY === false || $sizeX === 0 || $sizeY === 0) {
+ return false;
+ }
+
+ $tmpImg = imagecreatetruecolor($sourceWidth, $sourceHeight);
+ if ($tmpImg === false) {
+ return false;
+ }
+
+ if (imagealphablending($tmpImg, false) === false) {
+ return false;
+ }
+
+ if (imagecopy($tmpImg, $sourceImage, 0, 0, 0, 0, $sizeX, $sizeY) === false) {
+ return false;
+ }
+
+ $transparency = 127 - (($alphaPercentage*127)/100);
+ if (imagefilter($tmpImg, IMG_FILTER_COLORIZE, 0, 0, 0, $transparency) === false) {
+ return false;
+ }
+
+ $result = imagecopy(
+ $destinationImage,
+ $tmpImg,
+ $destinationX,
+ $destinationY,
+ $sourceX,
+ $sourceY,
+ $sourceWidth,
+ $sourceHeight
+ );
+ imagedestroy($tmpImg);
+
+ return $result;
+ }
}
diff --git a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php
index 50b9a5a013273..5d9ef49c7d285 100644
--- a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php
+++ b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php
@@ -269,15 +269,17 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
);
}
- if (method_exists($watermark, 'setImageOpacity')) {
- // available from imagick 6.3.1
- $watermark->setImageOpacity($opacity);
- } else {
- // go to each pixel and make it transparent
- $watermark->paintTransparentImage($watermark->getImagePixelColor(0, 0), 1, 65530);
- $watermark->evaluateImage(\Imagick::EVALUATE_SUBTRACT, 1 - $opacity, \Imagick::CHANNEL_ALPHA);
+ if (method_exists($watermark, 'getImageAlphaChannel')) {
+ // available from imagick 6.4.0
+ if ($watermark->getImageAlphaChannel() == 0) {
+ $watermark->setImageAlphaChannel(\Imagick::ALPHACHANNEL_OPAQUE);
+ }
}
+ $compositeChannels = \Imagick::CHANNEL_ALL;
+ $watermark->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $opacity, \Imagick::CHANNEL_OPACITY);
+ $compositeChannels &= ~(\Imagick::CHANNEL_OPACITY);
+
switch ($this->getWatermarkPosition()) {
case self::POSITION_STRETCH:
$watermark->sampleImage($this->_imageSrcWidth, $this->_imageSrcHeight);
@@ -309,14 +311,26 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
$offsetY = $positionY;
while ($offsetY <= $this->_imageSrcHeight + $watermark->getImageHeight()) {
while ($offsetX <= $this->_imageSrcWidth + $watermark->getImageWidth()) {
- $this->_imageHandler->compositeImage($watermark, \Imagick::COMPOSITE_OVER, $offsetX, $offsetY);
+ $this->_imageHandler->compositeImage(
+ $watermark,
+ \Imagick::COMPOSITE_OVER,
+ $offsetX,
+ $offsetY,
+ $compositeChannels
+ );
$offsetX += $watermark->getImageWidth();
}
$offsetX = $positionX;
$offsetY += $watermark->getImageHeight();
}
} else {
- $this->_imageHandler->compositeImage($watermark, \Imagick::COMPOSITE_OVER, $positionX, $positionY);
+ $this->_imageHandler->compositeImage(
+ $watermark,
+ \Imagick::COMPOSITE_OVER,
+ $positionX,
+ $positionY,
+ $compositeChannels
+ );
}
} catch (\ImagickException $e) {
throw new \Exception('Unable to create watermark.', $e->getCode(), $e);
diff --git a/lib/internal/Magento/Framework/Indexer/Handler/AttributeHandler.php b/lib/internal/Magento/Framework/Indexer/Handler/AttributeHandler.php
index 94f34ec7ba3b2..4b74ce50c9ed6 100644
--- a/lib/internal/Magento/Framework/Indexer/Handler/AttributeHandler.php
+++ b/lib/internal/Magento/Framework/Indexer/Handler/AttributeHandler.php
@@ -35,7 +35,7 @@ public function prepareSql(SourceProviderInterface $source, $alias, $fieldInfo)
'left'
);
} else {
- $source->addAttributeToSelect($fieldInfo['origin'], 'left');
+ $source->addFieldToSelect($fieldInfo['origin'], 'left');
}
}
}
diff --git a/lib/internal/Magento/Framework/Indexer/Test/Unit/Handler/AttributeHandlerTest.php b/lib/internal/Magento/Framework/Indexer/Test/Unit/Handler/AttributeHandlerTest.php
new file mode 100644
index 0000000000000..82b178e0ff487
--- /dev/null
+++ b/lib/internal/Magento/Framework/Indexer/Test/Unit/Handler/AttributeHandlerTest.php
@@ -0,0 +1,57 @@
+source = $this->getMockBuilder(SourceProviderInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+
+ $objectManager = new ObjectManager($this);
+
+ $this->subject = $objectManager->getObject(
+ AttributeHandler::class,
+ []
+ );
+ }
+
+ public function testPrepareSql()
+ {
+ $alias = 'e';
+ $fieldInfo = [
+ 'name' => 'is_approved',
+ 'origin' => 'is_approved',
+ 'type' => 'searchable',
+ 'dataType' => 'varchar',
+ 'entity' => 'customer',
+ 'bind' => null
+ ];
+ $this->source->expects($this->once())
+ ->method('addFieldToSelect')
+ ->with('is_approved', 'left')
+ ->willReturnSelf();
+
+ $this->subject->prepareSql($this->source, $alias, $fieldInfo);
+ }
+}
diff --git a/lib/internal/Magento/Framework/Locale/Config.php b/lib/internal/Magento/Framework/Locale/Config.php
index 2a623deca082f..4db842acedb7e 100644
--- a/lib/internal/Magento/Framework/Locale/Config.php
+++ b/lib/internal/Magento/Framework/Locale/Config.php
@@ -89,6 +89,7 @@ class Config implements \Magento\Framework\Locale\ConfigInterface
'sq_AL', /*Albanian (Albania)*/
'sr_Cyrl_RS', /*Serbian (Serbia)*/
'sv_SE', /*Swedish (Sweden)*/
+ 'sv_FI', /*Swedish (Finland)*/
'sw_KE', /*Swahili (Kenya)*/
'th_TH', /*Thai (Thailand)*/
'tr_TR', /*Turkish (Turkey)*/
diff --git a/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php b/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php
index f9b6e47c19a86..d5b9443788dd2 100644
--- a/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php
+++ b/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php
@@ -13,7 +13,7 @@ class InlineTest extends \PHPUnit\Framework\TestCase
protected $translator;
/**
- * @var \Magento\Framework\Phrase\Renderer\Translate
+ * @var \Magento\Framework\Phrase\Renderer\Inline
*/
protected $renderer;
diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json
index 49265774814d9..61e36c908eeff 100644
--- a/lib/internal/Magento/Framework/composer.json
+++ b/lib/internal/Magento/Framework/composer.json
@@ -34,7 +34,8 @@
"zendframework/zend-uri": "^2.5.1",
"zendframework/zend-validator": "^2.6.0",
"zendframework/zend-stdlib": "^2.7.7",
- "zendframework/zend-http": "^2.6.0"
+ "zendframework/zend-http": "^2.6.0",
+ "magento/zendframework1": "~1.13.0"
},
"suggest": {
"ext-imagick": "Use Image Magick >=3.0.0 as an optional alternative image processing library"
diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js
index 0947164e5b0f2..e388ec0a23038 100644
--- a/lib/web/fotorama/fotorama.js
+++ b/lib/web/fotorama/fotorama.js
@@ -1218,6 +1218,14 @@ fotoramaVersion = '4.6.4';
}
function stubEvent($el, eventType) {
+ var isIOS = /ip(ad|hone|od)/i.test(window.navigator.userAgent);
+
+ if (isIOS && eventType === 'touchend') {
+ $el.on('touchend', function(e){
+ $DOCUMENT.trigger('mouseup', e);
+ })
+ }
+
$el.on(eventType, function (e) {
stopEvent(e, true);
diff --git a/lib/web/fotorama/fotorama.min.js b/lib/web/fotorama/fotorama.min.js
index 0139babea4bfe..808ae6a60db9b 100644
--- a/lib/web/fotorama/fotorama.min.js
+++ b/lib/web/fotorama/fotorama.min.js
@@ -1,5 +1,4 @@
/*!
* Fotorama 4.6.4 | http://fotorama.io/license/
*/
-fotoramaVersion="4.6.4",function(a,b,c,d,e){"use strict";function Ba(a){var b="bez_"+d.makeArray(arguments).join("_").replace(".","p");if("function"!=typeof d.easing[b]){var c=function(a,b){var c=[null,null],d=[null,null],e=[null,null],f=function(f,g){return e[g]=3*a[g],d[g]=3*(b[g]-a[g])-e[g],c[g]=1-e[g]-d[g],f*(e[g]+f*(d[g]+f*c[g]))},g=function(a){return e[0]+a*(2*d[0]+3*c[0]*a)},h=function(a){for(var d,b=a,c=0;++c<14&&(d=f(b,0)-a,!(Math.abs(d)<.001));)b-=d/g(b);return b};return function(a){return f(h(a),1)}};d.easing[b]=function(b,d,e,f,g){return f*c([a[0],a[1]],[a[2],a[3]])(d/g)+e}}return b}function eb(){}function fb(a,b,c){return Math.max(isNaN(b)?-(1/0):b,Math.min(isNaN(c)?1/0:c,a))}function gb(a,b){return a.match(/ma/)&&a.match(/-?\d+(?!d)/g)[a.match(/3d/)?"vertical"===b?13:12:"vertical"===b?5:4]}function hb(a,b){return Ia?+gb(a.css("transform"),b):+a.css("vertical"===b?"top":"left").replace("px","")}function ib(a,b){var c={};if(Ia)switch(b){case"vertical":c.transform="translate3d(0, "+a+"px,0)";break;case"list":break;default:c.transform="translate3d("+a+"px,0,0)"}else"vertical"===b?c.top=a:c.left=a;return c}function jb(a){return{"transition-duration":a+"ms"}}function kb(a,b){return isNaN(a)?b:a}function lb(a,b){return kb(+String(a).replace(b||"px",""))}function mb(a){return/%$/.test(a)?lb(a,"%"):e}function nb(a,b){return kb(mb(a)/100*b,lb(a))}function ob(a){return(!isNaN(lb(a))||!isNaN(lb(a,"%")))&&a}function pb(a,b,c,d){return(a-(d||0))*(b+(c||0))}function qb(a,b,c,d){return-Math.round(a/(b+(c||0))-(d||0))}function rb(a){var b=a.data();if(!b.tEnd){var c=a[0],d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",msTransition:"MSTransitionEnd",transition:"transitionend"};Rb(c,d[wa.prefixed("transition")],function(a){b.tProp&&a.propertyName.match(b.tProp)&&b.onEndFn()}),b.tEnd=!0}}function sb(a,b,c,d){var e,f=a.data();f&&(f.onEndFn=function(){e||(e=!0,clearTimeout(f.tT),c())},f.tProp=b,clearTimeout(f.tT),f.tT=setTimeout(function(){f.onEndFn()},1.5*d),rb(a))}function tb(a,b){var c=a.navdir||"horizontal";if(a.length){var d=a.data();Ia?(a.css(jb(0)),d.onEndFn=eb,clearTimeout(d.tT)):a.stop();var e=ub(b,function(){return hb(a,c)});return a.css(ib(e,c)),e}}function ub(){for(var a,b=0,c=arguments.length;b
=c?"bottom":"top bottom":a<=b?"left":a>=c?"right":"left right")}function Ib(a,b,c){c=c||{},a.each(function(){var f,a=d(this),e=a.data();e.clickOn||(e.clickOn=!0,d.extend(hc(a,{onStart:function(a){f=a,(c.onStart||eb).call(this,a)},onMove:c.onMove||eb,onTouchEnd:c.onTouchEnd||eb,onEnd:function(a){a.moved||b.call(this,f)}}),{noMove:!0}))})}function Jb(a,b){return''+(b||"")+"
"}function Kb(a){return"."+a}function Lb(a){var b='';return b}function Mb(a){for(var b=a.length;b;){var c=Math.floor(Math.random()*b--),d=a[b];a[b]=a[c],a[c]=d}return a}function Nb(a){return"[object Array]"==Object.prototype.toString.call(a)&&d.map(a,function(a){return d.extend({},a)})}function Ob(a,b,c){a.scrollLeft(b||0).scrollTop(c||0)}function Pb(a){if(a){var b={};return d.each(a,function(a,c){b[a.toLowerCase()]=c}),b}}function Qb(a){if(a){var b=+a;return isNaN(b)?(b=a.split("/"),+b[0]/+b[1]||e):b}}function Rb(a,b,c,d){b&&(a.addEventListener?a.addEventListener(b,c,!!d):a.attachEvent("on"+b,c))}function Sb(a,b){return a>b.max?a=b.max:a=j-d?"horizontal"===g?-e.position().left:-e.position().top:(i+a.margin)*c<=Math.abs(d)?"horizontal"===g?-e.position().left+j-(i+a.margin):-e.position().top+j-(i+a.margin):d,h=Sb(h,b),h||0}function Ub(a){return!!a.getAttribute("disabled")}function Vb(a,b){return b?{disabled:a}:{tabindex:a*-1+"",disabled:a}}function Wb(a,b){Rb(a,"keyup",function(c){Ub(a)||13==c.keyCode&&b.call(a,c)})}function Xb(a,b){Rb(a,"focus",a.onfocusin=function(c){b.call(a,c)},!0)}function Yb(a,b){a.preventDefault?a.preventDefault():a.returnValue=!1,b&&a.stopPropagation&&a.stopPropagation()}function Zb(a){return a?">":"<"}function _b(a,b){var c=a.data(),e=Math.round(b.pos),f=function(){c&&c.sliding&&(c.sliding=!1),(b.onEnd||eb)()};"undefined"!=typeof b.overPos&&b.overPos!==b.pos&&(e=b.overPos);var g=d.extend(ib(e,b.direction),b.width&&{width:b.width},b.height&&{height:b.height});c&&c.sliding&&(c.sliding=!0),Ia?(a.css(d.extend(jb(b.time),g)),b.time>10?sb(a,"transform",f,b.time):f()):a.stop().animate(g,b.time,_a,f)}function ac(a,b,c,e,f,g){var h="undefined"!=typeof g;if(h||(f.push(arguments),Array.prototype.push.call(arguments,f.length),!(f.length>1))){a=a||d(a),b=b||d(b);var i=a[0],j=b[0],k="crossfade"===e.method,l=function(){if(!l.done){l.done=!0;var a=(h||f.shift())&&f.shift();a&&ac.apply(this,a),(e.onEnd||eb)(!!a)}},m=e.time/(g||1);c.removeClass(P+" "+O),a.stop().addClass(P),b.stop().addClass(O),k&&j&&a.fadeTo(0,0),a.fadeTo(k?m:0,1,k&&l),b.fadeTo(m,0,l),i&&k||j||l()}}function gc(a){var b=(a.touches||[])[0]||a;a._x=b.pageX||b.originalEvent.pageX,a._y=b.clientY||b.originalEvent.clientY,a._now=d.now()}function hc(a,c){function p(a){return i=d(a.target),f.checked=l=m=o=!1,g||f.flow||a.touches&&a.touches.length>1||a.which>1||bc&&bc.type!==a.type&&dc||(l=c.select&&i.is(c.select,e))?l:(k="touchstart"===a.type,m=i.is("a, a *",e),j=f.control,n=f.noMove||f.noSwipe||j?16:f.snap?0:4,gc(a),h=bc=a,cc=a.type.replace(/down|start/,"move").replace(/Down/,"Move"),(c.onStart||eb).call(e,a,{control:j,$target:i}),g=f.flow=!0,void(k&&!f.go||Yb(a)))}function q(a){if(a.touches&&a.touches.length>1||Na&&!a.isPrimary||cc!==a.type||!g)return g&&r(),void(c.onTouchEnd||eb)();gc(a);var b=Math.abs(a._x-h._x),d=Math.abs(a._y-h._y),i=b-d,j=(f.go||f.x||i>=0)&&!f.noSwipe,l=i<0;k&&!f.checked?(g=j)&&Yb(a):(Yb(a),(c.onMove||eb).call(e,a,{touch:k})),!o&&Math.sqrt(Math.pow(b,2)+Math.pow(d,2))>n&&(o=!0),f.checked=f.checked||j||l}function r(a){(c.onTouchEnd||eb)();var b=g;f.control=g=!1,b&&(f.flow=!1),!b||m&&!f.checked||(a&&Yb(a),dc=!0,clearTimeout(ec),ec=setTimeout(function(){dc=!1},1e3),(c.onEnd||eb).call(e,{moved:o,$target:i,control:j,touch:k,startEvent:h,aborted:!a||"MSPointerCancel"===a.type}))}function s(){f.flow||(f.flow=!0)}function t(){f.flow&&(f.flow=!1)}var g,h,i,j,k,l,m,n,o,e=a[0],f={};return Na?(Rb(e,"MSPointerDown",p),Rb(b,"MSPointerMove",q),Rb(b,"MSPointerCancel",r),Rb(b,"MSPointerUp",r)):(Rb(e,"touchstart",p),Rb(e,"touchmove",q),Rb(e,"touchend",r),Rb(b,"touchstart",s),Rb(b,"touchend",t),Rb(b,"touchcancel",t),Ca.on("scroll",t),a.on("mousedown pointerdown",p),Da.on("mousemove pointermove",q).on("mouseup pointerup",r)),fc=wa.touch?"a":"div",a.on("click",fc,function(a){f.checked&&Yb(a)}),f}function ic(a,b){function w(d,e){v=!0,g=h="vertical"===r?d._y:d._x,m=d._now,l=[[m,g]],i=j=f.noMove||e?0:tb(a,(b.getPos||eb)()),(b.onStart||eb).call(c,d)}function x(b,c){o=f.min,p=f.max,q=f.snap,r=f.direction||"horizontal",a.navdir=r,s=b.altKey,v=u=!1,t=c.control,t||e.sliding||w(b)}function y(d,e){f.noSwipe||(v||w(d),h="vertical"===r?d._y:d._x,l.push([d._now,h]),j=i-(g-h),k=Hb(j,o,p,r),j<=o?j=vb(j,o):j>=p&&(j=vb(j,p)),f.noMove||(a.css(ib(j,r)),u||(u=!0,e.touch||Na||a.addClass(ea)),(b.onMove||eb).call(c,d,{pos:j,edge:k})))}function z(e){if(!f.noSwipe||!e.moved){v||w(e.startEvent,!0),e.touch||Na||a.removeClass(ea),n=d.now();for(var k,m,t,x,y,z,A,B,D,g=n-Pa,u=null,C=Qa,E=b.friction,F=l.length-1;F>=0;F--){if(k=l[F][0],m=Math.abs(k-g),null===u||mt)break;t=m}A=fb(j,o,p);var G=x-h,H=G>=0,I=n-u,J=I>Pa,K=!J&&j!==i&&A===j;q&&(A=fb(Math[K?H?"floor":"ceil":"round"](j/q)*q,o,p),o=p=A),K&&(q||A===j)&&(D=-(G/I),C*=fb(Math.abs(D),b.timeLow,b.timeHigh),y=Math.round(j+D*C/E),q||(A=y),(!H&&y>p||H&&y',a,""].join(""),l.id=g,(m?l:n).innerHTML+=h,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=f.style.overflow,f.style.overflow="hidden",f.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),f.style.overflow=k),!!i},w={}.hasOwnProperty;x=A(w,"undefined")||A(w.call,"undefined")?function(a,b){return b in a&&A(a.constructor.prototype[b],"undefined")}:function(a,b){return w.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if("function"!=typeof c)throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:v(["@media (",l.join("touch-enabled),("),g,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=9===a.offsetTop}),c},p.csstransforms3d=function(){var a=!!E("perspective");return a&&"webkitPerspective"in f.style&&v("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=9===b.offsetLeft&&3===b.offsetHeight}),a},p.csstransitions=function(){return E("transition")};for(var F in p)x(p,F)&&(u=F.toLowerCase(),e[u]=p[F](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if("object"==typeof a)for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{if(a=a.toLowerCase(),e[a]!==c)return e;b="function"==typeof b?b():b,"undefined"!=typeof enableClasses&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},y(""),h=j=null,e._version=d,e._prefixes=l,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return C([a])},e.testAllProps=E,e.testStyles=v,e.prefixed=function(a,b,c){return b?E(a,b,c):E(a,"pfx")},e}(a,b),xa={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},ya="webkit moz o ms khtml".split(" ");if("undefined"!=typeof b.cancelFullScreen)xa.ok=!0;else for(var za=0,Aa=ya.length;za"):36===a.keyCode&&Zc("home")?(N.longPress.progress(),c="<<"):35===a.keyCode&&Zc("end")&&(N.longPress.progress(),c=">>")),(b||c)&&Yb(a),j={index:c,slow:a.altKey,user:!0},c&&(N.longPress.inProgress?N.showWhileLongPress(j):N.show(j))}),a&&Da.on(h,function(a){N.longPress.inProgress&&N.showEndLongPress({user:!0}),N.longPress.reset()}),N.index||Da.off(b).on(b,"textarea, input, select",function(a){!Fa.hasClass(g)&&a.stopPropagation()}),Ca.on(i,N.resize)):(Da.off(e),Ca.off(i))}function ad(a){a!==ad.f&&(a?(c.addClass(f+" "+P).before(va).before(ua),lc(N)):(va.detach(),ua.detach(),c.html(qa.urtext).removeClass(P),mc(N)),_c(a),ad.f=a)}function bd(){ea=N.data=ea||Nb(r.data)||Bb(c),ra=N.size=ea.length,ee.ok&&r.shuffle&&Mb(ea),Yc(),cc=id(cc),ra&&ad(!0)}function cd(){var a=ra<2||bc;Hc.noMove=a||wc,Hc.noSwipe=a||!r.swipe,!Ac&&Aa.toggleClass(y,!r.click&&!Hc.noMove&&!Hc.noSwipe),Na&&wa.toggleClass(p,!Hc.noSwipe)}function dd(a){a===!0&&(a=""),r.autoplay=Math.max(+a||Sa,1.5*zc)}function ed(a){a.navarrows&&"thumbs"===a.nav?(rb.show(),sb.show()):(rb.hide(),sb.hide())}function fd(a,b){return Math.floor(wa.width()/(b.thumbwidth+b.thumbmargin))}function gd(){function b(b,c){a[b?"add":"remove"].push(c)}r.nav&&"dots"!==r.nav||(r.navdir="horizontal"),N.options=r=Pb(r),bb=fd(wa,r),wc="crossfade"===r.transition||"dissolve"===r.transition,qc=r.loop&&(ra>2||wc&&(!Ac||"slide"!==Ac)),zc=+r.transitionduration||Qa,Cc="rtl"===r.direction,Dc=d.extend({},r.keyboard&&db,r.keyboard),ed(r);var a={add:[],remove:[]};ra>1?(rc=r.nav,tc="top"===r.navposition,a.remove.push(X),La.toggle(r.arrows)):(rc=!1,La.hide()),Ad(),Cd(),Bd(),r.autoplay&&dd(r.autoplay),xc=lb(r.thumbwidth)||Ua,yc=lb(r.thumbheight)||Ua,Ic.ok=Kc.ok=r.trackpad&&!Ma,cd(),Kd(r,[Fc]),sc="thumbs"===rc,Oa.filter(":hidden")&&rc&&Oa.show(),sc?(td(ra,"navThumb"),_a=eb,Vc=Za,Gb(ua,d.Fotorama.jst.style({w:xc,h:yc,b:r.thumbborderwidth,m:r.thumbmargin,s:O,q:!Ja})),Ra.addClass(L).removeClass(K)):"dots"===rc?(td(ra,"navDot"),_a=cb,Vc=Ya,Ra.addClass(K).removeClass(L)):(Oa.hide(),rc=!1,Ra.removeClass(L+" "+K)),rc&&(tc?Oa.insertBefore(ya):Oa.insertAfter(ya),xd.nav=!1,xd(_a,Ta,"nav")),uc=r.allowfullscreen,uc?(vb.prependTo(ya),vc=Ka&&"native"===uc):(vb.detach(),vc=!1),b(wc,l),b(!wc,m),b(!r.captions,s),b(Cc,q),b(r.arrows,t),Bc=r.shadows&&!Ma,b(!Bc,o),wa.addClass(a.add.join(" ")).removeClass(a.remove.join(" ")),Ec=d.extend({},r),$c()}function hd(a){return a<0?(ra+a%ra)%ra:a>=ra?a%ra:a}function id(a){return fb(a,0,ra-1)}function jd(a){return qc?hd(a):id(a)}function kd(a){return!!(a>0||qc)&&a-1}function ld(a){return!!(a1&&ea[f]===g)||g.html||g.deleted||g.video||k||(g.deleted=!0,N.splice(f,1))):(g[o]=p=q,j.$full=null,qd([f],b,c,!0))}function u(){d.Fotorama.measures[p]=n.measures=d.Fotorama.measures[p]||{width:l.width,height:l.height,ratio:l.width/l.height},pd(n.measures.width,n.measures.height,n.measures.ratio,f),m.off("load error").addClass(""+(k?ga:fa)).attr("aria-hidden","false").prependTo(h),h.hasClass(v)&&!h.hasClass(ma)&&h.attr("href",m.attr("src")),Fb(m,(d.isFunction(c)?c():c)||Fc),d.Fotorama.cache[p]=j.state="loaded",setTimeout(function(){h.trigger("f:load").removeClass(aa+" "+_).addClass(ba+" "+(k?ca:da)),"stage"===b?s("load"):(g.thumbratio===$a||!g.thumbratio&&r.thumbratio===$a)&&(g.thumbratio=n.measures.ratio,ce())},0)}function w(){var a=10;Eb(function(){return!Tc||!a--&&!Ma},function(){u()})}if(h){var k=N.fullScreen&&!j.$full&&"stage"===b;if(!j.$img||e||k){var l=new Image,m=d(l),n=m.data();j[k?"$full":"$img"]=m;var o="stage"===b?k?"full":"img":"thumb",p=g[o],q=k?g.img:g["stage"===b?"thumb":"img"];if("navThumb"===b&&(h=j.$wrap),!p)return void t();d.Fotorama.cache[p]?!function a(){"error"===d.Fotorama.cache[p]?t():"loaded"===d.Fotorama.cache[p]?setTimeout(w,0):setTimeout(a,100)}():(d.Fotorama.cache[p]="*",m.on("load",w).on("error",t)),j.state="",l.src=p,j.data.caption&&(l.alt=j.data.caption||""),j.data.full&&d(l).data("original",j.data.full),$b.isExpectedCaption(g,r.showcaption)&&d(l).attr("aria-labelledby",g.labelledby)}}})}function rd(){var a=dc[Xa];a&&!a.data().state&&(Ub.addClass(ta),a.on("f:load f:error",function(){a.off("f:load f:error"),Ub.removeClass(ta)}))}function sd(a){Wb(a,_d),Xb(a,function(){setTimeout(function(){Ob(Ra)},0),Fd({time:zc,guessIndex:d(this).data().eq,minMax:Jc})})}function td(a,b){od(a,b,function(a,c,e,f,g,h){if(!f){f=e[g]=wa[g].clone(),h=f.data(),h.data=e;var i=f[0],j="labelledby"+d.now();"stage"===b?(e.html&&d('
').append(e._html?d(e.html).removeAttr("id").html(e._html):e.html).appendTo(f),e.id&&(j=e.id||j),e.labelledby=j,$b.isExpectedCaption(e,r.showcaption)&&d(d.Fotorama.jst.frameCaption({caption:e.caption,labelledby:j})).appendTo(f),e.video&&f.addClass(w).append(xb.clone()),Xb(i,function(){setTimeout(function(){Ob(ya)},0),Yd({index:h.eq,user:!0})}),Ba=Ba.add(f)):"navDot"===b?(sd(i),cb=cb.add(f)):"navThumb"===b&&(sd(i),h.$wrap=f.children(":first"),eb=eb.add(f),e.video&&h.$wrap.append(xb.clone()))}})}function ud(a,b){return a&&a.length&&Fb(a,b)}function vd(a){od(a,"stage",function(a,b,c,e,f,g){if(e){var h=hd(b);g.eq=h,Rc[Xa][h]=e.css(d.extend({left:wc?0:pb(b,Fc.w,r.margin,fc)},wc&&jb(0))),Db(e[0])&&(e.appendTo(Aa),Vd(c.$video)),ud(g.$img,Fc),ud(g.$full,Fc),!e.hasClass(v)||"false"===e.attr("aria-hidden")&&e.hasClass(W)||e.attr("aria-hidden","true")}})}function wd(a,b){var c,e;"thumbs"!==rc||isNaN(a)||(c=-a,e=-a+Fc.nw,"vertical"===r.navdir&&(a-=r.thumbheight,e=-a+Fc.h),eb.each(function(){var a=d(this),f=a.data(),g=f.eq,h=function(){return{h:yc,w:f.w}},i=h(),j="vertical"===r.navdir?f.t>e:f.l>e;i.w=f.w,f.l+f.wFc.w/3}function zd(a){return!(qc||cc+a&&cc-ra+a||bc)}function Ad(){var a=zd(0),b=zd(1);Ga.toggleClass(B,a).attr(Vb(a,!1)),Ha.toggleClass(B,b).attr(Vb(b,!1))}function Bd(){var a=!1,b=!1;if("thumbs"!==r.navtype||r.loop||(a=0==cc,b=cc==r.data.length-1),"slides"===r.navtype){var c=hb(Ta,r.navdir);a=c>=Jc.max,b=c<=Jc.min}rb.toggleClass(B,a).attr(Vb(a,!0)),sb.toggleClass(B,b).attr(Vb(b,!0))}function Cd(){Ic.ok&&(Ic.prevent={"<":zd(0),">":zd(1)})}function Dd(a){var c,d,e,f,b=a.data();sc?(c=b.l,d=b.t,e=b.w,f=b.h):(c=a.position().left,e=a.width());var g={c:c+e/2,min:-c+10*r.thumbmargin,max:-c+Fc.w-e-10*r.thumbmargin},h={c:d+f/2,min:-d+10*r.thumbmargin,max:-d+Fc.h-f-10*r.thumbmargin};return"vertical"===r.navdir?h:g}function Ed(a){var b=dc[Vc].data();_b(mb,{time:1.2*a,pos:"vertical"===r.navdir?b.t:b.l,width:b.w,height:b.h,direction:r.navdir})}function Fd(a){var d,e,f,g,h,i,j,k,b=ea[a.guessIndex][Vc],c=r.navtype;b&&("thumbs"===c?(d=Jc.min!==Jc.max,f=a.minMax||d&&Dd(dc[Vc]),g=d&&(a.keep&&Fd.t?Fd.l:fb((a.coo||Fc.nw/2)-Dd(b).c,f.min,f.max)),h=d&&(a.keep&&Fd.l?Fd.l:fb((a.coo||Fc.nw/2)-Dd(b).c,f.min,f.max)),i="vertical"===r.navdir?g:h,j=d&&fb(i,Jc.min,Jc.max)||0,e=1.1*a.time,_b(Ta,{time:e,pos:j,direction:r.navdir,onEnd:function(){wd(j,!0),Bd()}}),Ud(Ra,Hb(j,Jc.min,Jc.max,r.navdir)),Fd.l=i):(k=hb(Ta,r.navdir),e=1.11*a.time,j=Tb(r,Jc,a.guessIndex,k,b,Oa,r.navdir),_b(Ta,{time:e,pos:j,direction:r.navdir,onEnd:function(){wd(j,!0),Bd()}}),Ud(Ra,Hb(j,Jc.min,Jc.max,r.navdir))))}function Gd(){Hd(Vc),Qc[Vc].push(dc[Vc].addClass(W).attr("data-active",!0))}function Hd(a){for(var b=Qc[a];b.length;)b.shift().removeClass(W).attr("data-active",!1)}function Id(a){var b=Rc[a];d.each(ec,function(a,c){delete b[hd(c)]}),d.each(b,function(a,c){delete b[a],c.detach()})}function Jd(a){fc=gc=cc;var b=dc[Xa];b&&(Hd(Xa),Qc[Xa].push(b.addClass(W).attr("data-active",!0)),b.hasClass(v)&&b.attr("aria-hidden","false"),a||N.showStage.onEnd(!0),tb(Aa,0,!0),Id(Xa),vd(ec),md(),nd(),Wb(Aa[0],function(){c.hasClass(Z)||(N.requestFullScreen(),vb.focus())}))}function Kd(a,b){a&&d.each(b,function(b,c){c&&d.extend(c,{width:a.width||c.width,height:a.height,minwidth:a.minwidth,maxwidth:a.maxwidth,minheight:a.minheight,maxheight:a.maxheight,ratio:Qb(a.ratio)})})}function Ld(a,b){c.trigger(f+":"+a,[N,b])}function Md(){clearTimeout(Nd.t),Tc=1,r.stopautoplayontouch?N.stopAutoplay():Oc=!0}function Nd(){Tc&&(r.stopautoplayontouch||(Od(),Pd()),Nd.t=setTimeout(function(){Tc=0},Qa+Pa))}function Od(){Oc=!(!bc&&!Pc)}function Pd(){if(clearTimeout(Pd.t),Eb.stop(Pd.w),!r.autoplay||Oc)return void(N.autoplay&&(N.autoplay=!1,Ld("stopautoplay")));N.autoplay||(N.autoplay=!0,Ld("startautoplay"));var a=cc,b=dc[Xa].data();Pd.w=Eb(function(){return b.state||a!==cc},function(){Pd.t=setTimeout(function(){if(!Oc&&a===cc){var b=oc,c=ea[b][Xa].data();Pd.w=Eb(function(){return c.state||b!==oc},function(){Oc||b!==oc||N.show(qc?Zb(!Cc):oc)})}},r.autoplay)})}function Qd(a){var b;return"object"!=typeof a?(b=a,a={}):b=a.index,b=">"===b?gc+1:"<"===b?gc-1:"<<"===b?0:">>"===b?ra-1:b,b=isNaN(b)?e:b,b="undefined"==typeof b?cc||0:b}function Rd(a){N.activeIndex=cc=jd(a),kc=kd(cc),nc=ld(cc),oc=hd(cc+(Cc?-1:1)),ec=[cc,kc,nc],gc=qc?a:cc}function Sd(a){var b=Math.abs(hc-gc),c=ub(a.time,function(){return Math.min(zc*(1+(b-1)/12),2*zc)});return a.slow&&(c*=10),c}function Td(){N.fullScreen&&(N.fullScreen=!1,Ka&&xa.cancel(Q),Fa.removeClass(g),Ea.removeClass(g),c.removeClass(Z).insertAfter(va),Fc=d.extend({},Sc),Vd(bc,!0,!0),$d("x",!1),N.resize(),qd(ec,"stage"),Ob(Ca,Mc,Lc),Ld("fullscreenexit"))}function Ud(a,b){Bc&&(a.removeClass(S+" "+T),a.removeClass(U+" "+V),b&&!bc&&a.addClass(b.replace(/^|\s/g," "+R+"--")))}function Vd(a,b,c){b&&(wa.removeClass(k),bc=!1,cd()),a&&a!==bc&&(a.remove(),Ld("unloadvideo")),c&&(Od(),Pd())}function Wd(a){wa.toggleClass(n,a)}function Xd(a){if(!Hc.flow){var b=a?a.pageX:Xd.x,c=b&&!zd(yd(b))&&r.click;Xd.p!==c&&ya.toggleClass(z,c)&&(Xd.p=c,Xd.x=b)}}function Yd(a){clearTimeout(Yd.t),r.clicktransition&&r.clicktransition!==r.transition?setTimeout(function(){var b=r.transition;N.setOptions({transition:r.clicktransition}),Ac=b,Yd.t=setTimeout(function(){N.show(a)},10)},0):N.show(a)}function Zd(a,b){var e=a.target,f=d(e);f.hasClass(oa)?N.playVideo():e===wb?N.toggleFullScreen():bc?e===Rb&&Vd(bc,!0,!0):c.hasClass(Z)||N.requestFullScreen()}function $d(a,b){Hc[a]=Jc[a]=b}function _d(a){var b=d(this).data().eq;Yd("thumbs"===r.navtype?{index:b,slow:a.altKey,user:!0,coo:a._x-Ra.offset().left}:{index:b,slow:a.altKey,user:!0})}function ae(a){Yd({index:La.index(this)?">":"<",slow:a.altKey,user:!0})}function be(a){Xb(a,function(){setTimeout(function(){Ob(ya)},0),Wd(!1)})}function ce(){if(bd(),gd(),!ce.i){ce.i=!0;var a=r.startindex;cc=fc=gc=hc=pc=jd(a)||0}if(ra){if(de())return;bc&&Vd(bc,!0),ec=[],Id(Xa),ce.ok=!0,N.show({index:cc,time:0}),N.resize()}else N.destroy()}function de(){if(!de.f===Cc)return de.f=Cc,cc=ra-1-cc,N.reverse(),!0}function ee(){ee.ok&&(ee.ok=!1,Ld("ready"))}Ea=d("html"),Fa=d("body");var ea,ra,_a,bc,dc,ec,fc,gc,hc,kc,nc,oc,pc,qc,rc,sc,tc,uc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Dc,Gc,Lc,Mc,Nc,Oc,Pc,Sc,Tc,Uc,Vc,N=this,O=d.now(),P=f+O,Q=c[0],ha=1,qa=c.data(),ua=d(""),va=d(Jb(Y)),wa=c.find(Kb(h)),ya=wa.find(Kb(u)),Aa=(ya[0],c.find(Kb(x))),Ba=d(),Ga=c.find(Kb(C)),Ha=c.find(Kb(D)),La=c.find(Kb(A)),Oa=c.find(Kb(F)),Ra=Oa.find(Kb(E)),Ta=Ra.find(Kb(G)),cb=d(),eb=d(),mb=(Aa.data(),Ta.data(),c.find(Kb(ka))),rb=c.find(Kb(ia)),sb=c.find(Kb(ja)),vb=c.find(Kb($)),wb=vb[0],xb=d(Jb(oa)),Cb=c.find(Kb(pa)),Rb=Cb[0],Ub=c.find(Kb(sa)),cc=!1,Ec={},Fc={},Hc={},Ic={},Jc={},Kc={},Qc={},Rc={},Wc=0,Xc=[];wa[Xa]=d('
'),wa[Za]=d(d.Fotorama.jst.thumb()),wa[Ya]=d(d.Fotorama.jst.dots()),
- Qc[Xa]=[],Qc[Za]=[],Qc[Ya]=[],Rc[Xa]={},wa.addClass(Ia?j:i),qa.fotorama=this,N.startAutoplay=function(a){return N.autoplay?this:(Oc=Pc=!1,dd(a||r.autoplay),Pd(),this)},N.stopAutoplay=function(){return N.autoplay&&(Oc=Pc=!0,Pd()),this},N.showSlide=function(a){var c,b=hb(Ta,r.navdir),d=550,e="horizontal"===r.navdir?r.thumbwidth:r.thumbheight,f=function(){Bd()};"next"===a&&(c=b-(e+r.margin)*bb),"prev"===a&&(c=b+(e+r.margin)*bb),c=Sb(c,Jc),wd(c,!0),_b(Ta,{time:d,pos:c,direction:r.navdir,onEnd:f})},N.showWhileLongPress=function(a){if(!N.longPress.singlePressInProgress){var b=Qd(a);Rd(b);var c=Sd(a)/50,d=dc;N.activeFrame=dc=ea[cc];var e=d===dc&&!a.user;return N.showNav(e,a,c),this}},N.showEndLongPress=function(a){if(!N.longPress.singlePressInProgress){var b=Qd(a);Rd(b);var c=Sd(a)/50,d=dc;N.activeFrame=dc=ea[cc];var e=d===dc&&!a.user;return N.showStage(e,a,c),Nc="undefined"!=typeof hc&&hc!==cc,hc=cc,this}},N.showStage=function(a,b,c){Vd(bc,dc.i!==ea[hd(fc)].i),td(ec,"stage"),vd(Ma?[gc]:[gc,kd(gc),ld(gc)]),$d("go",!0),a||Ld("show",{user:b.user,time:c}),Oc=!0;var d=b.overPos,e=N.showStage.onEnd=function(c){if(!e.ok){if(e.ok=!0,c||Jd(!0),a||Ld("showend",{user:b.user}),!c&&Ac&&Ac!==r.transition)return N.setOptions({transition:Ac}),void(Ac=!1);rd(),qd(ec,"stage"),$d("go",!1),Cd(),Xd(),Od(),Pd(),N.fullScreen?(dc[Xa].find("."+ga).attr("aria-hidden",!1),dc[Xa].find("."+fa).attr("aria-hidden",!0)):(dc[Xa].find("."+ga).attr("aria-hidden",!0),dc[Xa].find("."+fa).attr("aria-hidden",!1))}};if(wc){var f=dc[Xa],g=ea[hc]&&cc!==hc?ea[hc][Xa]:null;ac(f,g,Ba,{time:c,method:r.transition,onEnd:e},Xc)}else _b(Aa,{pos:-pb(gc,Fc.w,r.margin,fc),overPos:d,time:c,onEnd:e});Ad()},N.showNav=function(a,b,c){if(Bd(),rc){Gd();var d=id(cc+fb(gc-hc,-1,1));Fd({time:c,coo:d!==cc&&b.coo,guessIndex:"undefined"!=typeof b.coo?d:cc,keep:a}),sc&&Ed(c)}},N.show=function(a){N.longPress.singlePressInProgress=!0;var b=Qd(a);Rd(b);var c=Sd(a),d=dc;N.activeFrame=dc=ea[cc];var e=d===dc&&!a.user;return N.showStage(e,a,c),N.showNav(e,a,c),Nc="undefined"!=typeof hc&&hc!==cc,hc=cc,N.longPress.singlePressInProgress=!1,this},N.requestFullScreen=function(){if(uc&&!N.fullScreen){var b=d((N.activeFrame||{}).$stageFrame||{}).hasClass("fotorama-video-container");if(b)return;Lc=Ca.scrollTop(),Mc=Ca.scrollLeft(),Ob(Ca),$d("x",!0),Sc=d.extend({},Fc),c.addClass(Z).appendTo(Fa.addClass(g)),Ea.addClass(g),Vd(bc,!0,!0),N.fullScreen=!0,vc&&xa.request(Q),N.resize(),qd(ec,"stage"),rd(),Ld("fullscreenenter"),"ontouchstart"in a||vb.focus()}return this},N.cancelFullScreen=function(){return vc&&xa.is()?xa.cancel(b):Td(),this},N.toggleFullScreen=function(){return N[(N.fullScreen?"cancel":"request")+"FullScreen"]()},N.resize=function(b){if(!ea)return this;var c=arguments[1]||0,e=arguments[2];bb=fd(wa,r),Kd(N.fullScreen?{width:d(a).width(),maxwidth:null,minwidth:null,height:d(a).height(),maxheight:null,minheight:null}:Pb(b),[Fc,e||N.fullScreen||r]);var f=Fc.width,g=Fc.height,h=Fc.ratio,i=Ca.height()-(rc?Ra.height():0);if(ob(f)&&(wa.css({width:""}),wa.css({height:""}),ya.css({width:""}),ya.css({height:""}),Aa.css({width:""}),Aa.css({height:""}),Ra.css({width:""}),Ra.css({height:""}),wa.css({minWidth:Fc.minwidth||0,maxWidth:Fc.maxwidth||ab}),"dots"===rc&&Oa.hide(),f=Fc.W=Fc.w=wa.width(),Fc.nw=rc&&nb(r.navwidth,f)||f,Aa.css({width:Fc.w,marginLeft:(Fc.W-Fc.w)/2}),g=nb(g,i),g=g||h&&f/h)){if(f=Math.round(f),g=Fc.h=Math.round(fb(g,nb(Fc.minheight,i),nb(Fc.maxheight,i))),ya.css({width:f,height:g}),"vertical"!==r.navdir||N.fullscreen||Ra.width(r.thumbwidth+2*r.thumbmargin),"horizontal"!==r.navdir||N.fullscreen||Ra.height(r.thumbheight+2*r.thumbmargin),"dots"===rc&&(Ra.width(f).height("auto"),Oa.show()),"vertical"===r.navdir&&N.fullScreen&&ya.css("height",Ca.height()),"horizontal"===r.navdir&&N.fullScreen&&ya.css("height",Ca.height()-Ra.height()),rc){switch(r.navdir){case"vertical":Oa.removeClass(J),Oa.removeClass(I),Oa.addClass(H),Ra.stop().animate({height:Fc.h,width:r.thumbwidth},c);break;case"list":Oa.removeClass(H),Oa.removeClass(J),Oa.addClass(I);break;default:Oa.removeClass(H),Oa.removeClass(I),Oa.addClass(J),Ra.stop().animate({width:Fc.nw},c)}Jd(),Fd({guessIndex:cc,time:c,keep:!0}),sc&&xd.nav&&Ed(c)}Gc=e||!0,ee.ok=!0,ee()}return Wc=ya.offset().left,$c(),this},N.setOptions=function(a){return d.extend(r,a),ce(),this},N.shuffle=function(){return ea&&Mb(ea)&&ce(),this},N.longPress={threshold:1,count:0,thumbSlideTime:20,progress:function(){this.inProgress||(this.count++,this.inProgress=this.count>this.threshold)},end:function(){this.inProgress&&(this.isEnded=!0)},reset:function(){this.count=0,this.inProgress=!1,this.isEnded=!1}},N.destroy=function(){return N.cancelFullScreen(),N.stopAutoplay(),ea=N.data=null,ad(),ec=[],Id(Xa),ce.ok=!1,this},N.playVideo=function(){var a=dc,b=a.video,c=cc;return"object"==typeof b&&a.videoReady&&(vc&&N.fullScreen&&N.cancelFullScreen(),Eb(function(){return!xa.is()||c!==cc},function(){c===cc&&(a.$video=a.$video||d(Jb(na)).append(Lb(b)),a.$video.appendTo(a[Xa]),wa.addClass(k),bc=a.$video,cd(),La.blur(),vb.blur(),Ld("loadvideo"))})),this},N.stopVideo=function(){return Vd(bc,!0,!0),this},N.spliceByIndex=function(a,b){b.i=a+1,b.img&&d.ajax({url:b.img,type:"HEAD",success:function(){ea.splice(a,1,b),ce()}})},ya.on("mousemove",Xd),Hc=ic(Aa,{onStart:Md,onMove:function(a,b){Ud(ya,b.edge)},onTouchEnd:Nd,onEnd:function(a){var b;if(Ud(ya),b=(Na&&!Uc||a.touch)&&r.arrows,(a.moved||b&&a.pos!==a.newPos&&!a.control)&&a.$target[0]!==vb[0]){var c=qb(a.newPos,Fc.w,r.margin,fc);N.show({index:c,time:wc?zc:a.time,overPos:a.overPos,user:!0})}else a.aborted||a.control||Zd(a.startEvent,b)},timeLow:1,timeHigh:1,friction:2,select:"."+X+", ."+X+" *",$wrap:ya,direction:"horizontal"}),Jc=ic(Ta,{onStart:Md,onMove:function(a,b){Ud(Ra,b.edge)},onTouchEnd:Nd,onEnd:function(a){function b(){Fd.l=a.newPos,Od(),Pd(),wd(a.newPos,!0),Bd()}if(a.moved)a.pos!==a.newPos?(Oc=!0,_b(Ta,{time:a.time,pos:a.newPos,overPos:a.overPos,direction:r.navdir,onEnd:b}),wd(a.newPos),Bc&&Ud(Ra,Hb(a.newPos,Jc.min,Jc.max,a.dir))):b();else{var c=a.$target.closest("."+M,Ta)[0];c&&_d.call(c,a.startEvent)}},timeLow:.5,timeHigh:2,friction:5,$wrap:Ra,direction:r.navdir}),Ic=jc(ya,{shift:!0,onEnd:function(a,b){Md(),Nd(),N.show({index:b,slow:a.altKey})}}),Kc=jc(Ra,{onEnd:function(a,b){Md(),Nd();var c=tb(Ta)+.25*b;Ta.css(ib(fb(c,Jc.min,Jc.max),r.navdir)),Bc&&Ud(Ra,Hb(c,Jc.min,Jc.max,r.navdir)),Kc.prevent={"<":c>=Jc.max,">":c<=Jc.min},clearTimeout(Kc.t),Kc.t=setTimeout(function(){Fd.l=c,wd(c,!0)},Pa),wd(c)}}),wa.hover(function(){setTimeout(function(){Tc||Wd(!(Uc=!0))},0)},function(){Uc&&Wd(!(Uc=!1))}),Ib(La,function(a){Yb(a),ae.call(this,a)},{onStart:function(){Md(),Hc.control=!0},onTouchEnd:Nd}),Ib(rb,function(a){Yb(a),"thumbs"===r.navtype?N.show("<"):N.showSlide("prev")}),Ib(sb,function(a){Yb(a),"thumbs"===r.navtype?N.show(">"):N.showSlide("next")}),La.each(function(){Wb(this,function(a){ae.call(this,a)}),be(this)}),Wb(wb,function(){c.hasClass(Z)?(N.cancelFullScreen(),Aa.focus()):(N.requestFullScreen(),vb.focus())}),be(wb),d.each("load push pop shift unshift reverse sort splice".split(" "),function(a,b){N[b]=function(){return ea=ea||[],"load"!==b?Array.prototype[b].apply(ea,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(ea=Nb(arguments[0])),ce(),N}}),ce()},d.fn.fotorama=function(b){return this.each(function(){var c=this,e=d(this),f=e.data(),g=f.fotorama;g?g.setOptions(b,!0):Eb(function(){return!Cb(c)},function(){f.urtext=e.html(),new d.Fotorama(e,d.extend({},cb,a.fotoramaDefaults,b,f))})})},d.Fotorama.instances=[],d.Fotorama.cache={},d.Fotorama.measures={},d=d||{},d.Fotorama=d.Fotorama||{},d.Fotorama.jst=d.Fotorama.jst||{},d.Fotorama.jst.dots=function(a){var c="";va.escape;return c+=''},d.Fotorama.jst.frameCaption=function(a){var b,c="";va.escape;return c+='\r\n
'+(null==(b=a.caption)?"":b)+"
\r\n
\r\n"},d.Fotorama.jst.style=function(a){var b,c="";va.escape;return c+=".fotorama"+(null==(b=a.s)?"":b)+" .fotorama__nav--thumbs .fotorama__nav__frame{\r\npadding:"+(null==(b=a.m)?"":b)+"px;\r\nheight:"+(null==(b=a.h)?"":b)+"px}\r\n.fotorama"+(null==(b=a.s)?"":b)+" .fotorama__thumb-border{\r\nheight:"+(null==(b=a.h)?"":b)+"px;\r\nborder-width:"+(null==(b=a.b)?"":b)+"px;\r\nmargin-top:"+(null==(b=a.m)?"":b)+"px}"},d.Fotorama.jst.thumb=function(a){var c="";va.escape;return c+=''}}(window,document,location,"undefined"!=typeof jQuery&&jQuery);
\ No newline at end of file
+fotoramaVersion="4.6.4";(function(bo,k,a3,bV,aP){var ag="fotorama",bH="fotorama__fullscreen",ae=ag+"__wrap",ah=ae+"--css2",aX=ae+"--css3",bt=ae+"--video",ar=ae+"--fade",aw=ae+"--slide",P=ae+"--no-controls",aM=ae+"--no-shadows",U=ae+"--pan-y",a0=ae+"--rtl",az=ae+"--only-active",bN=ae+"--no-captions",f=ae+"--toggle-arrows",a7=ag+"__stage",x=a7+"__frame",l=x+"--video",B=a7+"__shaft",aB=ag+"__grab",bC=ag+"__pointer",aK=ag+"__arr",F=aK+"--disabled",bc=aK+"--prev",r=aK+"--next",bO=ag+"__nav",bq=bO+"-wrap",aH=bO+"__shaft",b=bq+"--vertical",ax=bq+"--list",bZ=bq+"--horizontal",bW=bO+"--dots",ai=bO+"--thumbs",aG=bO+"__frame",br=ag+"__fade",al=br+"-front",n=br+"-rear",aW=ag+"__shadow",bz=aW+"s",S=bz+"--left",aL=bz+"--right",a2=bz+"--top",aR=bz+"--bottom",a4=ag+"__active",a9=ag+"__select",bs=ag+"--hidden",M=ag+"--fullscreen",aJ=ag+"__fullscreen-icon",bP=ag+"__error",bM=ag+"__loading",c=ag+"__loaded",b3=c+"--full",bg=c+"--img",bR=ag+"__grabbing",J=ag+"__img",Y=J+"--full",bS=ag+"__thumb",b0=bS+"__arr--left",H=bS+"__arr--right",cb=bS+"-border",bd=ag+"__html",af=ag+"-video-container",bJ=ag+"__video",T=bJ+"-play",w=bJ+"-close",au=ag+"_horizontal_ratio",aY=ag+"_vertical_ratio",ca=ag+"__spinner",Z=ca+"--show";var E=bV&&bV.fn.jquery.split(".");if(!E||E[0]<1||(E[0]==1&&E[1]<8)){throw"Fotorama requires jQuery 1.8 or later and will not run without it."}var bx={};var ap=(function(co,ct,cj){var cf="2.8.3",cm={},cD=ct.documentElement,cE="modernizr",cB=ct.createElement(cE),cp=cB.style,cg,cw={}.toString,cy=" -webkit- -moz- -o- -ms- ".split(" "),cd="Webkit Moz O ms",cG=cd.split(" "),cq=cd.toLowerCase().split(" "),ck={},ce={},cu={},cA=[],cv=cA.slice,cc,cz=function(cQ,cS,cK,cR){var cJ,cP,cM,cN,cI=ct.createElement("div"),cO=ct.body,cL=cO||ct.createElement("body");if(parseInt(cK,10)){while(cK--){cM=ct.createElement("div");cM.id=cR?cR[cK]:cE+(cK+1);cI.appendChild(cM)}}cJ=["",'"].join("");cI.id=cE;(cO?cI:cL).innerHTML+=cJ;cL.appendChild(cI);if(!cO){cL.style.background="";cL.style.overflow="hidden";cN=cD.style.overflow;cD.style.overflow="hidden";cD.appendChild(cL)}cP=cS(cI,cQ);if(!cO){cL.parentNode.removeChild(cL);cD.style.overflow=cN}else{cI.parentNode.removeChild(cI)}return !!cP},cs=({}).hasOwnProperty,cC;if(!cl(cs,"undefined")&&!cl(cs.call,"undefined")){cC=function(cI,cJ){return cs.call(cI,cJ)}}else{cC=function(cI,cJ){return((cJ in cI)&&cl(cI.constructor.prototype[cJ],"undefined"))}}if(!Function.prototype.bind){Function.prototype.bind=function cH(cK){var cL=this;if(typeof cL!="function"){throw new TypeError()}var cI=cv.call(arguments,1),cJ=function(){if(this instanceof cJ){var cO=function(){};cO.prototype=cL.prototype;var cN=new cO();var cM=cL.apply(cN,cI.concat(cv.call(arguments)));if(Object(cM)===cM){return cM}return cN}else{return cL.apply(cK,cI.concat(cv.call(arguments)))}};return cJ}}function cr(cI){cp.cssText=cI}function ci(cJ,cI){return cr(cy.join(cJ+";")+(cI||""))}function cl(cJ,cI){return typeof cJ===cI}function cn(cJ,cI){return !!~(""+cJ).indexOf(cI)}function cF(cK,cI){for(var cJ in cK){var cL=cK[cJ];if(!cn(cL,"-")&&cp[cL]!==cj){return cI=="pfx"?cL:true}}return false}function cx(cJ,cM,cL){for(var cI in cJ){var cK=cM[cJ[cI]];if(cK!==cj){if(cL===false){return cJ[cI]}if(cl(cK,"function")){return cK.bind(cL||cM)}return cK}}return false}function i(cM,cI,cL){var cJ=cM.charAt(0).toUpperCase()+cM.slice(1),cK=(cM+" "+cG.join(cJ+" ")+cJ).split(" ");if(cl(cI,"string")||cl(cI,"undefined")){return cF(cK,cI)}else{cK=(cM+" "+(cq).join(cJ+" ")+cJ).split(" ");return cx(cK,cI,cL)}}ck.touch=function(){var cI;if(("ontouchstart" in co)||co.DocumentTouch&&ct instanceof DocumentTouch){cI=true}else{cz(["@media (",cy.join("touch-enabled),("),cE,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(cJ){cI=cJ.offsetTop===9})}return cI};ck.csstransforms3d=function(){var cI=!!i("perspective");if(cI&&"webkitPerspective" in cD.style){cz("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(cJ,cK){cI=cJ.offsetLeft===9&&cJ.offsetHeight===3})}return cI};ck.csstransitions=function(){return i("transition")};for(var ch in ck){if(cC(ck,ch)){cc=ch.toLowerCase();cm[cc]=ck[ch]();cA.push((cm[cc]?"":"no-")+cc)}}cm.addTest=function(cJ,cK){if(typeof cJ=="object"){for(var cI in cJ){if(cC(cJ,cI)){cm.addTest(cI,cJ[cI])}}}else{cJ=cJ.toLowerCase();if(cm[cJ]!==cj){return cm}cK=typeof cK=="function"?cK():cK;if(typeof enableClasses!=="undefined"&&enableClasses){cD.className+=" "+(cK?"":"no-")+cJ}cm[cJ]=cK}return cm};cr("");cB=cg=null;cm._version=cf;cm._prefixes=cy;cm._domPrefixes=cq;cm._cssomPrefixes=cG;cm.testProp=function(cI){return cF([cI])};cm.testAllProps=i;cm.testStyles=cz;cm.prefixed=function(cK,cJ,cI){if(!cJ){return i(cK,"pfx")}else{return i(cK,cJ,cI)}};return cm})(bo,k);var bB={ok:false,is:function(){return false},request:function(){},cancel:function(){},event:"",prefix:""},h="webkit moz o ms khtml".split(" ");if(typeof k.cancelFullScreen!="undefined"){bB.ok=true}else{for(var bv=0,N=h.length;bv=i?"bottom":"top bottom"):(ce<=cd?"left":ce>=i?"right":"left right")}function z(cc,cd,i){i=i||{};cc.each(function(){var cg=bV(this),cf=cg.data(),ce;if(cf.clickOn){return}cf.clickOn=true;bV.extend(aI(cg,{onStart:function(ch){ce=ch;(i.onStart||g).call(this,ch)},onMove:i.onMove||g,onTouchEnd:i.onTouchEnd||g,onEnd:function(ch){if(ch.moved){return}cd.call(this,ce)}}),{noMove:true})})}function ab(i,cc){return''+(cc||"")+"
"}function aT(i){return"."+i}function q(i){var cc='';return cc}function aC(cf){var cc=cf.length;while(cc){var ce=Math.floor(Math.random()*cc--);var cd=cf[cc];cf[cc]=cf[ce];cf[ce]=cd}return cf}function bG(i){return Object.prototype.toString.call(i)=="[object Array]"&&bV.map(i,function(cc){return bV.extend({},cc)})}function bU(i,cd,cc){i.scrollLeft(cd||0).scrollTop(cc||0)}function bA(i){if(i){var cc={};bV.each(i,function(cd,ce){cc[cd.toLowerCase()]=ce});return cc}}function bm(i){if(!i){return}var cc=+i;if(!isNaN(cc)){return cc}else{cc=i.split("/");return +cc[0]/+cc[1]||aP}}function D(cd,ce,cc,i){if(!ce){return}cd.addEventListener?cd.addEventListener(ce,cc,!!i):cd.attachEvent("on"+ce,cc)}function a5(i,cc){if(i>cc.max){i=cc.max}else{if(i=(ci-cf)){if(cc==="horizontal"){cg=-ce.position().left}else{cg=-ce.position().top}}else{if((cj+i.margin)*(ch)<=Math.abs(cf)){if(cc==="horizontal"){cg=-ce.position().left+ci-(cj+i.margin)}else{cg=-ce.position().top+ci-(cj+i.margin)}}else{cg=cf}}cg=a5(cg,ck);return cg||0}function aj(i){return !!i.getAttribute("disabled")}function ad(cc,i){if(i){return{disabled:cc}}else{return{tabindex:cc*-1+"",disabled:cc}}}function a(cc,i){D(cc,"keyup",function(cd){aj(cc)||cd.keyCode==13&&i.call(cc,cd)})}function bL(cc,i){D(cc,"focus",cc.onfocusin=function(cd){i.call(cc,cd)},true)}function O(cc,i){cc.preventDefault?cc.preventDefault():(cc.returnValue=false);i&&cc.stopPropagation&&cc.stopPropagation()}function aE(cd,cc){var i=/iP(ad|hone|od)/i.test(bo.navigator.userAgent);if(i&&cc==="touchend"){cd.on("touchend",function(ce){bw.trigger("mouseup",ce)})}cd.on(cc,function(ce){O(ce,true);return false})}function ay(i){return i?">":"<"}var aS=(function(){function cd(ch,ce,cg){var cf=ce/cg;if(cf<=1){ch.parent().removeClass(au);ch.parent().addClass(aY)}else{ch.parent().removeClass(aY);ch.parent().addClass(au)}}function i(cf,cg,ch){var ce=ch;if(!cf.attr(ce)&&cf.attr(ce)!==aP){cf.attr(ce,cg)}if(cf.find("["+ce+"]").length){cf.find("["+ce+"]").each(function(){bV(this).attr(ce,cg)})}}function cc(cf,ce,ci){var cg=false,ch;cf.showCaption===ci||cf.showCaption===true?ch=true:ch=false;if(!ce){return false}if(cf.caption&&ch){cg=true}return cg}return{setRatio:cd,setThumbAttr:i,isExpectedCaption:cc}}(aS||{},jQuery));function A(ce,cd){var cc=ce.data(),i=Math.round(cd.pos),cf=function(){if(cc&&cc.sliding){cc.sliding=false}(cd.onEnd||g)()};if(typeof cd.overPos!=="undefined"&&cd.overPos!==cd.pos){i=cd.overPos}var cg=bV.extend(b2(i,cd.direction),cd.width&&{width:cd.width},cd.height&&{height:cd.height});if(cc&&cc.sliding){cc.sliding=true}if(aA){ce.css(bV.extend(b6(cd.time),cg));if(cd.time>10){X(ce,"transform",cf,cd.time)}else{cf()}}else{ce.stop().animate(cg,cd.time,u,cf)}}function aq(ck,cj,cc,cm,ce,i){var ch=typeof i!=="undefined";if(!ch){ce.push(arguments);Array.prototype.push.call(arguments,ce.length);if(ce.length>1){return}}ck=ck||bV(ck);cj=cj||bV(cj);var ci=ck[0],cg=cj[0],cf=cm.method==="crossfade",cl=function(){if(!cl.done){cl.done=true;var cn=(ch||ce.shift())&&ce.shift();cn&&aq.apply(this,cn);(cm.onEnd||g)(!!cn)}},cd=cm.time/(i||1);cc.removeClass(n+" "+al);ck.stop().addClass(n);cj.stop().addClass(al);cf&&cg&&ck.fadeTo(0,0);ck.fadeTo(cf?cd:0,1,cf&&cl);cj.fadeTo(cd,0,cl);(ci&&cf)||cg||cl()}var G,b5,e,j,bD;function bn(i){var cc=(i.touches||[])[0]||i;i._x=cc.pageX||cc.originalEvent.pageX;i._y=cc.clientY||cc.originalEvent.clientY;i._now=bV.now()}function aI(cr,cg){var cc=cr[0],cj={},i,cl,cf,cn,cs,cd,ce,co,ch;function cq(ct){cf=bV(ct.target);cj.checked=cd=ce=ch=false;if(i||cj.flow||(ct.touches&&ct.touches.length>1)||ct.which>1||(G&&G.type!==ct.type&&e)||(cd=cg.select&&cf.is(cg.select,cc))){return cd}cs=ct.type==="touchstart";ce=cf.is("a, a *",cc);cn=cj.control;co=(cj.noMove||cj.noSwipe||cn)?16:!cj.snap?4:0;bn(ct);cl=G=ct;b5=ct.type.replace(/down|start/,"move").replace(/Down/,"Move");(cg.onStart||g).call(cc,ct,{control:cn,$target:cf});i=cj.flow=true;if(!cs||cj.go){O(ct)}}function ck(cx){if((cx.touches&&cx.touches.length>1)||(aZ&&!cx.isPrimary)||b5!==cx.type||!i){i&&ci();(cg.onTouchEnd||g)();return}bn(cx);var cy=Math.abs(cx._x-cl._x),cu=Math.abs(cx._y-cl._y),cw=cy-cu,cv=(cj.go||cj.x||cw>=0)&&!cj.noSwipe,ct=cw<0;if(cs&&!cj.checked){if(i=cv){O(cx)}}else{O(cx);(cg.onMove||g).call(cc,cx,{touch:cs})}if(!ch&&Math.sqrt(Math.pow(cy,2)+Math.pow(cu,2))>co){ch=true}cj.checked=cj.checked||cv||ct}function ci(cu){(cg.onTouchEnd||g)();var ct=i;cj.control=i=false;if(ct){cj.flow=false}if(!ct||(ce&&!cj.checked)){return}cu&&O(cu);e=true;clearTimeout(j);j=setTimeout(function(){e=false},1000);(cg.onEnd||g).call(cc,{moved:ch,$target:cf,control:cn,touch:cs,startEvent:cl,aborted:!cu||cu.type==="MSPointerCancel"})}function cm(){if(cj.flow){return}cj.flow=true}function cp(){if(!cj.flow){return}cj.flow=false}if(aZ){D(cc,"MSPointerDown",cq);D(k,"MSPointerMove",ck);D(k,"MSPointerCancel",ci);D(k,"MSPointerUp",ci)}else{D(cc,"touchstart",cq);D(cc,"touchmove",ck);D(cc,"touchend",ci);D(k,"touchstart",cm);D(k,"touchend",cp);D(k,"touchcancel",cp);bf.on("scroll",cp);cr.on("mousedown pointerdown",cq);bw.on("mousemove pointermove",ck).on("mouseup pointerup",ci)}if(ap.touch){bD="a"}else{bD="div"}cr.on("click",bD,function(ct){cj.checked&&O(ct)});return cj}function ao(cz,cd){var cc=cz[0],ce=cz.data(),cm={},cw,cf,cx,cj,ch,cy,co,cg,cr,ct,cp,cq,i,cv,ci,cn;function cs(cA,cB){cn=true;cw=cf=(cq==="vertical")?cA._y:cA._x;co=cA._now;cy=[[co,cw]];cx=cj=cm.noMove||cB?0:a1(cz,(cd.getPos||g)());(cd.onStart||g).call(cc,cA)}function cu(cB,cA){cr=cm.min;ct=cm.max;cp=cm.snap,cq=cm.direction||"horizontal",cz.navdir=cq;i=cB.altKey;cn=ci=false;cv=cA.control;if(!cv&&!ce.sliding){cs(cB)}}function cl(cB,cA){if(!cm.noSwipe){if(!cn){cs(cB)}cf=(cq==="vertical")?cB._y:cB._x;cy.push([cB._now,cf]);cj=cx-(cw-cf);ch=bp(cj,cr,ct,cq);if(cj<=cr){cj=aF(cj,cr)}else{if(cj>=ct){cj=aF(cj,ct)}}if(!cm.noMove){cz.css(b2(cj,cq));if(!ci){ci=true;cA.touch||aZ||cz.addClass(bR)}(cd.onMove||g).call(cc,cB,{pos:cj,edge:ch})}}}function ck(cJ){if(cm.noSwipe&&cJ.moved){return}if(!cn){cs(cJ.startEvent,true)}cJ.touch||aZ||cz.removeClass(bR);cg=bV.now();var cG=cg-b8,cK,cP,cQ,cS=null,cA,cE,cN,cD,cF,cI=ba,cO,cH=cd.friction;for(var cC=cy.length-1;cC>=0;cC--){cK=cy[cC][0];cP=Math.abs(cK-cG);if(cS===null||cPcQ){break}}cQ=cP}cD=bb(cj,cr,ct);var cT=cA-cf,cR=cT>=0,cL=cg-cS,cB=cL>b8,cM=!cB&&cj!==cx&&cD===cj;if(cp){cD=bb(Math[cM?(cR?"floor":"ceil"):"round"](cj/cp)*cp,cr,ct);cr=ct=cD}if(cM&&(cp||cD===cj)){cO=-(cT/cL);cI*=bb(Math.abs(cO),cd.timeLow,cd.timeHigh);cE=Math.round(cj+cO*cI/cH);if(!cp){cD=cE}if(!cR&&cE>ct||cR&&cE"),c9=bV(ab(bs)),dk=d6.find(aT(ae)),cf=dk.find(aT(a7)),dY=cf[0],cl=d6.find(aT(B)),c8=bV(),dW=d6.find(aT(bc)),da=d6.find(aT(r)),cU=d6.find(aT(aK)),dU=d6.find(aT(bq)),dO=dU.find(aT(bO)),cF=dO.find(aT(aH)),dA,cB=bV(),cW=bV(),dS=cl.data(),cX=cF.data(),c7=d6.find(aT(cb)),eg=d6.find(aT(b0)),dX=d6.find(aT(H)),dM=d6.find(aT(aJ)),dD=dM[0],cH=bV(ab(T)),dt=d6.find(aT(w)),d1=dt[0],eb=d6.find(aT(ca)),dg,eo=false,dF,ea,c2,ed,dw,d4,cN,cK,dx,dj,cq,c0,d8,c4,d2,cv,ch,ej,ds,cu,ec,dH,dE,d0={},en={},dG,d5={},cG={},dy={},ef={},cs,cT,ee,cj,el,cd={},er={},dZ,c6,dz,dr,d3=0,cI=[];dk[bu]=bV('
');dk[bl]=bV(bV.Fotorama.jst.thumb());dk[b7]=bV(bV.Fotorama.jst.dots());cd[bu]=[];cd[bl]=[];cd[b7]=[];er[bu]={};dk.addClass(aA?aX:ah);cR.fotorama=this;function ep(){bV.each(dP,function(ey,eA){if(!eA.i){eA.i=cY++;var ez=at(eA.video,true);if(ez){var ex={};eA.video=ez;if(!eA.img&&!eA.thumb){ex=aQ(eA,dP,cg)}else{eA.thumbsReady=true}v(dP,{img:ex.img,thumb:ex.thumb},eA.i,cg)}}})}function df(ex){return dE[ex]}function i(){if(cf!==aP){if(c3.navdir=="vertical"){var ex=c3.thumbwidth+c3.thumbmargin;cf.css("left",ex);da.css("right",ex);dM.css("right",ex);dk.css("width",dk.css("width")+ex);cl.css("max-width",dk.width()-ex)}else{cf.css("left","");da.css("right","");dM.css("right","");dk.css("width",dk.css("width")+ex);cl.css("max-width","")}}}function ek(eB){var eC="keydown."+ag,eD=ag+cC,ex="keydown."+eD,eA="keyup."+eD,ey="resize."+eD+" orientationchange."+eD,ez;if(eB){bw.on(ex,function(eG){var eF,eE;if(dg&&eG.keyCode===27){eF=true;cO(dg,true,true)}else{if(cg.fullScreen||(c3.keyboard&&!cg.index)){if(eG.keyCode===27){eF=true;cg.cancelFullScreen()}else{if((eG.shiftKey&&eG.keyCode===32&&df("space"))||(eG.keyCode===37&&df("left"))||(eG.keyCode===38&&df("up")&&bV(":focus").attr("data-gallery-role"))){cg.longPress.progress();eE="<"}else{if((eG.keyCode===32&&df("space"))||(eG.keyCode===39&&df("right"))||(eG.keyCode===40&&df("down")&&bV(":focus").attr("data-gallery-role"))){cg.longPress.progress();eE=">"}else{if(eG.keyCode===36&&df("home")){cg.longPress.progress();eE="<<"}else{if(eG.keyCode===35&&df("end")){cg.longPress.progress();eE=">>"}}}}}}}(eF||eE)&&O(eG);ez={index:eE,slow:eG.altKey,user:true};eE&&(cg.longPress.inProgress?cg.showWhileLongPress(ez):cg.show(ez))});if(eB){bw.on(eA,function(eE){if(cg.longPress.inProgress){cg.showEndLongPress({user:true})}cg.longPress.reset()})}if(!cg.index){bw.off(eC).on(eC,"textarea, input, select",function(eE){!I.hasClass(bH)&&eE.stopPropagation()})}bf.on(ey,cg.resize)}else{bw.off(ex);bf.off(ey)}}function dd(ex){if(ex===dd.f){return}if(ex){d6.addClass(ag+" "+cQ).before(c9).before(de);C(cg)}else{c9.detach();de.detach();d6.html(cR.urtext).removeClass(cQ);av(cg)}ek(ex);dd.f=ex}function dn(){dP=cg.data=dP||bG(c3.data)||bI(d6);c1=cg.size=dP.length;eq.ok&&c3.shuffle&&aC(dP);ep();eo=cn(eo);c1&&dd(true)}function em(){var ex=c1<2||dg;d5.noMove=ex||cv;d5.noSwipe=ex||!c3.swipe;!cu&&cl.toggleClass(aB,!c3.click&&!d5.noMove&&!d5.noSwipe);aZ&&dk.toggleClass(U,!d5.noSwipe)}function dq(ex){if(ex===true){ex=""}c3.autoplay=Math.max(+ex||bQ,ds*1.5)}function db(ex){if(ex.navarrows&&ex.nav==="thumbs"){eg.show();dX.show()}else{eg.hide();dX.hide()}}function ck(ex,ey){return Math.floor(dk.width()/(ey.thumbwidth+ey.thumbmargin))}function dQ(){if(!c3.nav||c3.nav==="dots"){c3.navdir="horizontal"}cg.options=c3=bA(c3);b4=ck(dk,c3);cv=(c3.transition==="crossfade"||c3.transition==="dissolve");dj=c3.loop&&(c1>2||(cv&&(!cu||cu!=="slide")));ds=+c3.transitionduration||ba;dH=c3.direction==="rtl";dE=bV.extend({},c3.keyboard&&p,c3.keyboard);db(c3);var ey={add:[],remove:[]};function ex(ez,eA){ey[ez?"add":"remove"].push(eA)}if(c1>1){cq=c3.nav;d8=c3.navposition==="top";ey.remove.push(a9);cU.toggle(c3.arrows)}else{cq=false;cU.hide()}dh();cJ();ev();if(c3.autoplay){dq(c3.autoplay)}ch=m(c3.thumbwidth)||L;ej=m(c3.thumbheight)||L;cG.ok=ef.ok=c3.trackpad&&!bh;em();dL(c3,[en]);c0=cq==="thumbs";if(dU.filter(":hidden")&&!!cq){dU.show()}if(c0){dl(c1,"navThumb");dA=cW;dr=bl;an(de,bV.Fotorama.jst.style({w:ch,h:ej,b:c3.thumbborderwidth,m:c3.thumbmargin,s:cC,q:!aN}));dO.addClass(ai).removeClass(bW)}else{if(cq==="dots"){dl(c1,"navDot");dA=cB;dr=b7;dO.addClass(bW).removeClass(ai)}else{dU.hide();cq=false;dO.removeClass(ai+" "+bW)}}if(cq){if(d8){dU.insertBefore(cf)}else{dU.insertAfter(cf)}cz.nav=false;cz(dA,cF,"nav")}c4=c3.allowfullscreen;if(c4){dM.prependTo(cf);d2=s&&c4==="native";aE(dM,"touchend")}else{dM.detach();d2=false}ex(cv,ar);ex(!cv,aw);ex(!c3.captions,bN);ex(dH,a0);ex(c3.arrows,f);ec=c3.shadows&&!bh;ex(!ec,aM);dk.addClass(ey.add.join(" ")).removeClass(ey.remove.join(" "));d0=bV.extend({},c3);i()}function cZ(ex){return ex<0?(c1+(ex%c1))%c1:ex>=c1?ex%c1:ex}function cn(ex){return bb(ex,0,c1-1)}function du(ex){return dj?cZ(ex):cn(ex)}function dB(ex){return ex>0||dj?ex-1:false}function ci(ex){return ex1&&dP[eE]===eD&&!eD.html&&!eD.deleted&&!eD.video&&!eN){eD.deleted=true;cg.splice(eE,1)}}}function eL(){bV.Fotorama.measures[eF]=eO.measures=bV.Fotorama.measures[eF]||{width:eS.width,height:eS.height,ratio:eS.width/eS.height};cc(eO.measures.width,eO.measures.height,eO.measures.ratio,eE);eG.off("load error").addClass(""+(eN?Y:J)).attr("aria-hidden","false").prependTo(eC);if(eC.hasClass(x)&&!eC.hasClass(af)){eC.attr("href",eG.attr("src"))}V(eG,(bV.isFunction(eA)?eA():eA)||en);bV.Fotorama.cache[eF]=eB.state="loaded";setTimeout(function(){eC.trigger("f:load").removeClass(bM+" "+bP).addClass(c+" "+(eN?b3:bg));if(ey==="stage"){eH("load")}else{if(eD.thumbratio===bF||!eD.thumbratio&&c3.thumbratio===bF){eD.thumbratio=eO.measures.ratio;dV()}}},0)}if(!eF){eK();return}function eI(){var eT=10;bX(function(){return !c6||!eT--&&!bh},function(){eL()})}if(!bV.Fotorama.cache[eF]){bV.Fotorama.cache[eF]="*";eG.on("load",eI).on("error",eK)}else{(function eQ(){if(bV.Fotorama.cache[eF]==="error"){eK()}else{if(bV.Fotorama.cache[eF]==="loaded"){setTimeout(eI,0)}else{setTimeout(eQ,100)}}})()}eB.state="";eS.src=eF;if(eB.data.caption){eS.alt=eB.data.caption||""}if(eB.data.full){bV(eS).data("original",eB.data.full)}if(aS.isExpectedCaption(eD,c3.showcaption)){bV(eS).attr("aria-labelledby",eD.labelledby)}})}function cy(){var ex=dF[bu];if(ex&&!ex.data().state){eb.addClass(Z);ex.on("f:load f:error",function(){ex.off("f:load f:error");eb.removeClass(Z)})}}function cL(ex){a(ex,dJ);bL(ex,function(){setTimeout(function(){bU(dO)},0);dT({time:ds,guessIndex:bV(this).data().eq,minMax:dy})})}function dl(ex,ey){dm(ex,ey,function(eB,ez,eG,eD,eA,eC){if(eD){return}eD=eG[eA]=dk[eA].clone();eC=eD.data();eC.data=eG;var eF=eD[0],eE="labelledby"+bV.now();if(ey==="stage"){if(eG.html){bV('
').append(eG._html?bV(eG.html).removeAttr("id").html(eG._html):eG.html).appendTo(eD)}if(eG.id){eE=eG.id||eE}eG.labelledby=eE;if(aS.isExpectedCaption(eG,c3.showcaption)){bV(bV.Fotorama.jst.frameCaption({caption:eG.caption,labelledby:eE})).appendTo(eD)}eG.video&&eD.addClass(l).append(cH.clone());bL(eF,function(){setTimeout(function(){bU(cf)},0);cm({index:eC.eq,user:true})});c8=c8.add(eD)}else{if(ey==="navDot"){cL(eF);cB=cB.add(eD)}else{if(ey==="navThumb"){cL(eF);eC.$wrap=eD.children(":first");cW=cW.add(eD);if(eG.video){eC.$wrap.append(cH.clone())}}}}})}function cM(ey,ex){return ey&&ey.length&&V(ey,ex)}function di(ex){dm(ex,"stage",function(eB,ez,eE,eD,eA,eC){if(!eD){return}var ey=cZ(ez);eC.eq=ey;er[bu][ey]=eD.css(bV.extend({left:cv?0:a8(ez,en.w,c3.margin,c2)},cv&&b6(0)));if(be(eD[0])){eD.appendTo(cl);cO(eE.$video)}cM(eC.$img,en);cM(eC.$full,en);if(eD.hasClass(x)&&!(eD.attr("aria-hidden")==="false"&&eD.hasClass(a4))){eD.attr("aria-hidden","true")}})}function dp(eB,ex){var ey,ez,eA;if(cq!=="thumbs"||isNaN(eB)){return}ey=-eB;ez=-eB+en.nw;if(c3.navdir==="vertical"){eB=eB-c3.thumbheight;ez=-eB+en.h}cW.each(function(){var eH=bV(this),eD=eH.data(),eC=eD.eq,eG=function(){return{h:ej,w:eD.w}},eF=eG(),eE=c3.navdir==="vertical"?eD.t>ez:eD.l>ez;eF.w=eD.w;if(eD.l+eD.wen.w/3}function cE(ex){return !dj&&(!(eo+ex)||!(eo-c1+ex))&&!dg}function dh(){var ey=cE(0),ex=cE(1);dW.toggleClass(F,ey).attr(ad(ey,false));da.toggleClass(F,ex).attr(ad(ex,false))}function ev(){var ex=false,ey=false;if(c3.navtype==="thumbs"&&!c3.loop){(eo==0)?ex=true:ex=false;(eo==c3.data.length-1)?ey=true:ey=false}if(c3.navtype==="slides"){var ez=aa(cF,c3.navdir);ez>=dy.max?ex=true:ex=false;ez<=dy.min?ey=true:ey=false}eg.toggleClass(F,ex).attr(ad(ex,true));dX.toggleClass(F,ey).attr(ad(ey,true))}function cJ(){if(cG.ok){cG.prevent={"<":cE(0),">":cE(1)}}}function dI(eD){var eA=eD.data(),eC,eB,ez,ex;if(c0){eC=eA.l;eB=eA.t;ez=eA.w;ex=eA.h}else{eC=eD.position().left;ez=eD.width()}var ey={c:eC+ez/2,min:-eC+c3.thumbmargin*10,max:-eC+en.w-ez-c3.thumbmargin*10};var eE={c:eB+ex/2,min:-eB+c3.thumbmargin*10,max:-eB+en.h-ex-c3.thumbmargin*10};return c3.navdir==="vertical"?eE:ey}function d7(ey){var ex=dF[dr].data();A(c7,{time:ey*1.2,pos:(c3.navdir==="vertical"?ex.t:ex.l),width:ex.w,height:ex.h,direction:c3.navdir})}function dT(eH){var eB=dP[eH.guessIndex][dr],ez=c3.navtype;var eD,ex,eA,eG,eC,ey,eE,eF;if(eB){if(ez==="thumbs"){eD=dy.min!==dy.max;eA=eH.minMax||eD&&dI(dF[dr]);eG=eD&&(eH.keep&&dT.t?dT.l:bb((eH.coo||en.nw/2)-dI(eB).c,eA.min,eA.max));eC=eD&&(eH.keep&&dT.l?dT.l:bb((eH.coo||en.nw/2)-dI(eB).c,eA.min,eA.max));ey=(c3.navdir==="vertical"?eG:eC);eE=eD&&bb(ey,dy.min,dy.max)||0;ex=eH.time*1.1;A(cF,{time:ex,pos:eE,direction:c3.navdir,onEnd:function(){dp(eE,true);ev()}});co(dO,bp(eE,dy.min,dy.max,c3.navdir));dT.l=ey}else{eF=aa(cF,c3.navdir);ex=eH.time*1.11;eE=aD(c3,dy,eH.guessIndex,eF,eB,dU,c3.navdir);A(cF,{time:ex,pos:eE,direction:c3.navdir,onEnd:function(){dp(eE,true);ev()}});co(dO,bp(eE,dy.min,dy.max,c3.navdir))}}}function cS(){dN(dr);cd[dr].push(dF[dr].addClass(a4).attr("data-active",true))}function dN(ey){var ex=cd[ey];while(ex.length){ex.shift().removeClass(a4).attr("data-active",false)}}function ce(ey){var ex=er[ey];bV.each(ea,function(eA,ez){delete ex[cZ(ez)]});bV.each(ex,function(ez,eA){delete ex[ez];eA.detach()})}function dC(ey){c2=ed=eo;var ex=dF[bu];if(ex){dN(bu);cd[bu].push(ex.addClass(a4).attr("data-active",true));if(ex.hasClass(x)){ex.attr("aria-hidden","false")}ey||cg.showStage.onEnd(true);a1(cl,0,true);ce(bu);di(ea);d9();c5();a(cl[0],function(){if(!d6.hasClass(M)){cg.requestFullScreen();dM.focus()}})}}function dL(ey,ex){if(!ey){return}bV.each(ex,function(ez,eA){if(!eA){return}bV.extend(eA,{width:ey.width||eA.width,height:ey.height,minwidth:ey.minwidth,maxwidth:ey.maxwidth,minheight:ey.minheight,maxheight:ey.maxheight,ratio:bm(ey.ratio)})})}function dc(ey,ex){d6.trigger(ag+":"+ey,[cg,ex])}function dR(){clearTimeout(cr.t);c6=1;if(c3.stopautoplayontouch){cg.stopAutoplay()}else{cj=true}}function cr(){if(!c6){return}if(!c3.stopautoplayontouch){cw();es()}cr.t=setTimeout(function(){c6=0},ba+b8)}function cw(){cj=!!(dg||el)}function es(){clearTimeout(es.t);bX.stop(es.w);if(!c3.autoplay||cj){if(cg.autoplay){cg.autoplay=false;dc("stopautoplay")}return}if(!cg.autoplay){cg.autoplay=true;dc("startautoplay")}var ey=eo;var ex=dF[bu].data();es.w=bX(function(){return ex.state||ey!==eo},function(){es.t=setTimeout(function(){if(cj||ey!==eo){return}var ez=cK,eA=dP[ez][bu].data();es.w=bX(function(){return eA.state||ez!==cK},function(){if(cj||ez!==cK){return}cg.show(dj?ay(!dH):cK)})},c3.autoplay)})}cg.startAutoplay=function(ex){if(cg.autoplay){return this}cj=el=false;dq(ex||c3.autoplay);es();return this};cg.stopAutoplay=function(){if(cg.autoplay){cj=el=true;es()}return this};cg.showSlide=function(ez){var eA=aa(cF,c3.navdir),eC,eB=500*1.1,ey=c3.navdir==="horizontal"?c3.thumbwidth:c3.thumbheight,ex=function(){ev()};if(ez==="next"){eC=eA-(ey+c3.margin)*b4}if(ez==="prev"){eC=eA+(ey+c3.margin)*b4}eC=a5(eC,dy);dp(eC,true);A(cF,{time:eB,pos:eC,direction:c3.navdir,onEnd:ex})};cg.showWhileLongPress=function(eA){if(cg.longPress.singlePressInProgress){return}var ez=dK(eA);ew(ez);var eB=cA(eA)/50;var ey=dF;cg.activeFrame=dF=dP[eo];var ex=ey===dF&&!eA.user;cg.showNav(ex,eA,eB);return this};cg.showEndLongPress=function(eA){if(cg.longPress.singlePressInProgress){return}var ez=dK(eA);ew(ez);var eB=cA(eA)/50;var ey=dF;cg.activeFrame=dF=dP[eo];var ex=ey===dF&&!eA.user;cg.showStage(ex,eA,eB);ee=typeof dw!=="undefined"&&dw!==eo;dw=eo;return this};function dK(ey){var ex;if(typeof ey!=="object"){ex=ey;ey={}}else{ex=ey.index}ex=ex===">"?ed+1:ex==="<"?ed-1:ex==="<<"?0:ex===">>"?c1-1:ex;ex=isNaN(ex)?aP:ex;ex=typeof ex==="undefined"?eo||0:ex;return ex}function ew(ex){cg.activeIndex=eo=du(ex);d4=dB(eo);cN=ci(eo);cK=cZ(eo+(dH?-1:1));ea=[eo,d4,cN];ed=dj?ex:eo}function cA(ey){var ex=Math.abs(dw-ed),ez=bj(ey.time,function(){return Math.min(ds*(1+(ex-1)/12),ds*2)});if(ey.slow){ez*=10}return ez}cg.showStage=function(ey,eA,eD){cO(dg,dF.i!==dP[cZ(c2)].i);dl(ea,"stage");di(bh?[ed]:[ed,dB(ed),ci(ed)]);cD("go",true);ey||dc("show",{user:eA.user,time:eD});cj=true;var eC=eA.overPos;var ez=cg.showStage.onEnd=function(eE){if(ez.ok){return}ez.ok=true;eE||dC(true);if(!ey){dc("showend",{user:eA.user})}if(!eE&&cu&&cu!==c3.transition){cg.setOptions({transition:cu});cu=false;return}cy();cx(ea,"stage");cD("go",false);cJ();ei();cw();es();if(cg.fullScreen){dF[bu].find("."+Y).attr("aria-hidden",false);dF[bu].find("."+J).attr("aria-hidden",true)}else{dF[bu].find("."+Y).attr("aria-hidden",true);dF[bu].find("."+J).attr("aria-hidden",false)}};if(!cv){A(cl,{pos:-a8(ed,en.w,c3.margin,c2),overPos:eC,time:eD,onEnd:ez})}else{var ex=dF[bu],eB=dP[dw]&&eo!==dw?dP[dw][bu]:null;aq(ex,eB,c8,{time:eD,method:c3.transition,onEnd:ez},cI)}dh()};cg.showNav=function(ey,ez,eA){ev();if(cq){cS();var ex=cn(eo+bb(ed-dw,-1,1));dT({time:eA,coo:ex!==eo&&ez.coo,guessIndex:typeof ez.coo!=="undefined"?ex:eo,keep:ey});if(c0){d7(eA)}}};cg.show=function(eA){cg.longPress.singlePressInProgress=true;var ez=dK(eA);ew(ez);var eB=cA(eA);var ey=dF;cg.activeFrame=dF=dP[eo];var ex=ey===dF&&!eA.user;cg.showStage(ex,eA,eB);cg.showNav(ex,eA,eB);ee=typeof dw!=="undefined"&&dw!==eo;dw=eo;cg.longPress.singlePressInProgress=false;return this};cg.requestFullScreen=function(){if(c4&&!cg.fullScreen){var ex=bV((cg.activeFrame||{}).$stageFrame||{}).hasClass("fotorama-video-container");if(ex){return}cs=bf.scrollTop();cT=bf.scrollLeft();bU(bf);cD("x",true);dZ=bV.extend({},en);d6.addClass(M).appendTo(I.addClass(bH));R.addClass(bH);cO(dg,true,true);cg.fullScreen=true;if(d2){bB.request(eu)}cg.resize();cx(ea,"stage");cy();dc("fullscreenenter");if(!("ontouchstart" in bo)){dM.focus()}}return this};function cP(){if(cg.fullScreen){cg.fullScreen=false;if(s){bB.cancel(eu)}I.removeClass(bH);R.removeClass(bH);d6.removeClass(M).insertAfter(c9);en=bV.extend({},dZ);cO(dg,true,true);cD("x",false);cg.resize();cx(ea,"stage");bU(bf,cT,cs);dc("fullscreenexit")}}cg.cancelFullScreen=function(){if(d2&&bB.is()){bB.cancel(k)}else{cP()}return this};cg.toggleFullScreen=function(){return cg[(cg.fullScreen?"cancel":"request")+"FullScreen"]()};cg.resize=function(ez){if(!dP){return this}var eC=arguments[1]||0,ey=arguments[2];b4=ck(dk,c3);dL(!cg.fullScreen?bA(ez):{width:bV(bo).width(),maxwidth:null,minwidth:null,height:bV(bo).height(),maxheight:null,minheight:null},[en,ey||cg.fullScreen||c3]);var eB=en.width,ex=en.height,eA=en.ratio,eD=bf.height()-(cq?dO.height():0);if(t(eB)){dk.css({width:""});dk.css({height:""});cf.css({width:""});cf.css({height:""});cl.css({width:""});cl.css({height:""});dO.css({width:""});dO.css({height:""});dk.css({minWidth:en.minwidth||0,maxWidth:en.maxwidth||bK});if(cq==="dots"){dU.hide()}eB=en.W=en.w=dk.width();en.nw=cq&&d(c3.navwidth,eB)||eB;cl.css({width:en.w,marginLeft:(en.W-en.w)/2});ex=d(ex,eD);ex=ex||(eA&&eB/eA);if(ex){eB=Math.round(eB);ex=en.h=Math.round(bb(ex,d(en.minheight,eD),d(en.maxheight,eD)));cf.css({width:eB,height:ex});if(c3.navdir==="vertical"&&!cg.fullscreen){dO.width(c3.thumbwidth+c3.thumbmargin*2)}if(c3.navdir==="horizontal"&&!cg.fullscreen){dO.height(c3.thumbheight+c3.thumbmargin*2)}if(cq==="dots"){dO.width(eB).height("auto");dU.show()}if(c3.navdir==="vertical"&&cg.fullScreen){cf.css("height",bf.height())}if(c3.navdir==="horizontal"&&cg.fullScreen){cf.css("height",bf.height()-dO.height())}if(cq){switch(c3.navdir){case"vertical":dU.removeClass(bZ);dU.removeClass(ax);dU.addClass(b);dO.stop().animate({height:en.h,width:c3.thumbwidth},eC);break;case"list":dU.removeClass(b);dU.removeClass(bZ);dU.addClass(ax);break;default:dU.removeClass(b);dU.removeClass(ax);dU.addClass(bZ);dO.stop().animate({width:en.nw},eC);break}dC();dT({guessIndex:eo,time:eC,keep:true});if(c0&&cz.nav){d7(eC)}}dG=ey||true;eq.ok=true;eq()}}d3=cf.offset().left;i();return this};cg.setOptions=function(ex){bV.extend(c3,ex);dV();return this};cg.shuffle=function(){dP&&aC(dP)&&dV();return this};function co(ex,ey){if(ec){ex.removeClass(S+" "+aL);ex.removeClass(a2+" "+aR);ey&&!dg&&ex.addClass(ey.replace(/^|\s/g," "+bz+"--"))}}cg.longPress={threshold:1,count:0,thumbSlideTime:20,progress:function(){if(!this.inProgress){this.count++;this.inProgress=this.count>this.threshold}},end:function(){if(this.inProgress){this.isEnded=true}},reset:function(){this.count=0;this.inProgress=false;this.isEnded=false}};cg.destroy=function(){cg.cancelFullScreen();cg.stopAutoplay();dP=cg.data=null;dd();ea=[];ce(bu);dV.ok=false;return this};cg.playVideo=function(){var ez=dF,ex=ez.video,ey=eo;if(typeof ex==="object"&&ez.videoReady){d2&&cg.fullScreen&&cg.cancelFullScreen();bX(function(){return !bB.is()||ey!==eo},function(){if(ey===eo){ez.$video=ez.$video||bV(ab(bJ)).append(q(ex));ez.$video.appendTo(ez[bu]);dk.addClass(bt);dg=ez.$video;em();cU.blur();dM.blur();dc("loadvideo")}})}return this};cg.stopVideo=function(){cO(dg,true,true);return this};cg.spliceByIndex=function(ex,ey){ey.i=ex+1;ey.img&&bV.ajax({url:ey.img,type:"HEAD",success:function(){dP.splice(ex,1,ey);dV()}})};function cO(ex,ez,ey){if(ez){dk.removeClass(bt);dg=false;em()}if(ex&&ex!==dg){ex.remove();dc("unloadvideo")}if(ey){cw();es()}}function cp(ex){dk.toggleClass(P,ex)}function ei(ez){if(d5.flow){return}var ex=ez?ez.pageX:ei.x,ey=ex&&!cE(eh(ex))&&c3.click;if(ei.p!==ey&&cf.toggleClass(bC,ey)){ei.p=ey;ei.x=ex}}cf.on("mousemove",ei);function cm(ex){clearTimeout(cm.t);if(c3.clicktransition&&c3.clicktransition!==c3.transition){setTimeout(function(){var ey=c3.transition;cg.setOptions({transition:c3.clicktransition});cu=ey;cm.t=setTimeout(function(){cg.show(ex)},10)},0)}else{cg.show(ex)}}function ct(eA,ey){var ez=eA.target,ex=bV(ez);if(ex.hasClass(T)){cg.playVideo()}else{if(ez===dD){cg.toggleFullScreen()}else{if(dg){ez===d1&&cO(dg,true,true)}else{if(!d6.hasClass(M)){cg.requestFullScreen()}}}}O(eA,true)}function cD(ex,ey){d5[ex]=dy[ex]=ey}d5=ao(cl,{onStart:dR,onMove:function(ey,ex){co(cf,ex.edge)},onTouchEnd:cr,onEnd:function(ex){var ez;co(cf);ez=(aZ&&!dz||ex.touch)&&c3.arrows;if((ex.moved||(ez&&ex.pos!==ex.newPos&&!ex.control))&&ex.$target[0]!==dM[0]){var ey=by(ex.newPos,en.w,c3.margin,c2);cg.show({index:ey,time:cv?ds:ex.time,overPos:ex.overPos,user:true})}else{if(!ex.aborted&&!ex.control){ct(ex.startEvent,ez)}}},timeLow:1,timeHigh:1,friction:2,select:"."+a9+", ."+a9+" *",$wrap:cf,direction:"horizontal"});dy=ao(cF,{onStart:dR,onMove:function(ey,ex){co(dO,ex.edge)},onTouchEnd:cr,onEnd:function(ex){function ey(){dT.l=ex.newPos;cw();es();dp(ex.newPos,true);ev()}if(!ex.moved){var ez=ex.$target.closest("."+aG,cF)[0];ez&&dJ.call(ez,ex.startEvent)}else{if(ex.pos!==ex.newPos){cj=true;A(cF,{time:ex.time,pos:ex.newPos,overPos:ex.overPos,direction:c3.navdir,onEnd:ey});dp(ex.newPos);ec&&co(dO,bp(ex.newPos,dy.min,dy.max,ex.dir))}else{ey()}}},timeLow:0.5,timeHigh:2,friction:5,$wrap:dO,direction:c3.navdir});cG=o(cf,{shift:true,onEnd:function(ey,ex){dR();cr();cg.show({index:ex,slow:ey.altKey})}});ef=o(dO,{onEnd:function(ez,ey){dR();cr();var ex=a1(cF)+ey*0.25;cF.css(b2(bb(ex,dy.min,dy.max),c3.navdir));ec&&co(dO,bp(ex,dy.min,dy.max,c3.navdir));ef.prevent={"<":ex>=dy.max,">":ex<=dy.min};clearTimeout(ef.t);ef.t=setTimeout(function(){dT.l=ex;dp(ex,true)},b8);dp(ex)}});dk.hover(function(){setTimeout(function(){if(c6){return}cp(!(dz=true))},0)},function(){if(!dz){return}cp(!(dz=false))});function dJ(ey){var ex=bV(this).data().eq;if(c3.navtype==="thumbs"){cm({index:ex,slow:ey.altKey,user:true,coo:ey._x-dO.offset().left})}else{cm({index:ex,slow:ey.altKey,user:true})}}function et(ex){cm({index:cU.index(this)?">":"<",slow:ex.altKey,user:true})}z(cU,function(ex){O(ex);et.call(this,ex)},{onStart:function(){dR();d5.control=true},onTouchEnd:cr});z(eg,function(ex){O(ex);if(c3.navtype==="thumbs"){cg.show("<")}else{cg.showSlide("prev")}});z(dX,function(ex){O(ex);if(c3.navtype==="thumbs"){cg.show(">")}else{cg.showSlide("next")}});function dv(ex){bL(ex,function(){setTimeout(function(){bU(cf)},0);cp(false)})}cU.each(function(){a(this,function(ex){et.call(this,ex)});dv(this)});a(dD,function(){if(d6.hasClass(M)){cg.cancelFullScreen();cl.focus()}else{cg.requestFullScreen();dM.focus()}});dv(dD);function dV(){dn();dQ();if(!dV.i){dV.i=true;var ex=c3.startindex;eo=c2=ed=dw=dx=du(ex)||0}if(c1){if(cV()){return}if(dg){cO(dg,true)}ea=[];ce(bu);dV.ok=true;cg.show({index:eo,time:0});cg.resize()}else{cg.destroy()}}function cV(){if(!cV.f===dH){cV.f=dH;eo=c1-1-eo;cg.reverse();return true}}bV.each("load push pop shift unshift reverse sort splice".split(" "),function(ex,ey){cg[ey]=function(){dP=dP||[];if(ey!=="load"){Array.prototype[ey].apply(dP,arguments)}else{if(arguments[0]&&typeof arguments[0]==="object"&&arguments[0].length){dP=bG(arguments[0])}}dV();return cg}});function eq(){if(eq.ok){eq.ok=false;dc("ready")}}dV()};bV.fn.fotorama=function(i){return this.each(function(){var ce=this,cd=bV(this),cc=cd.data(),cf=cc.fotorama;if(!cf){bX(function(){return !W(ce)},function(){cc.urtext=cd.html();new bV.Fotorama(cd,bV.extend({},Q,bo.fotoramaDefaults,i,cc))})}else{cf.setOptions(i,true)}})};bV.Fotorama.instances=[];function b1(){bV.each(bV.Fotorama.instances,function(cc,i){i.index=cc})}function C(i){bV.Fotorama.instances.push(i);b1()}function av(i){bV.Fotorama.instances.splice(i.index,1);b1()}bV.Fotorama.cache={};bV.Fotorama.measures={};bV=bV||{};bV.Fotorama=bV.Fotorama||{};bV.Fotorama.jst=bV.Fotorama.jst||{};bV.Fotorama.jst.dots=function(cc){var i,ce="",cd=bx.escape;ce+='';return ce};bV.Fotorama.jst.frameCaption=function(cc){var i,ce="",cd=bx.escape;ce+='\r\n
'+((i=(cc.caption))==null?"":i)+"
\r\n
\r\n";return ce};bV.Fotorama.jst.style=function(cc){var i,ce="",cd=bx.escape;ce+=".fotorama"+((i=(cc.s))==null?"":i)+" .fotorama__nav--thumbs .fotorama__nav__frame{\r\npadding:"+((i=(cc.m))==null?"":i)+"px;\r\nheight:"+((i=(cc.h))==null?"":i)+"px}\r\n.fotorama"+((i=(cc.s))==null?"":i)+" .fotorama__thumb-border{\r\nheight:"+((i=(cc.h))==null?"":i)+"px;\r\nborder-width:"+((i=(cc.b))==null?"":i)+"px;\r\nmargin-top:"+((i=(cc.m))==null?"":i)+"px}";return ce};bV.Fotorama.jst.thumb=function(cc){var i,ce="",cd=bx.escape;ce+='';return ce}})(window,document,location,typeof jQuery!=="undefined"&&jQuery);
\ No newline at end of file
diff --git a/lib/web/i18n/en_US.csv b/lib/web/i18n/en_US.csv
index 5c63a191420a4..4acc62aa6dc81 100644
--- a/lib/web/i18n/en_US.csv
+++ b/lib/web/i18n/en_US.csv
@@ -95,7 +95,7 @@ Submit,Submit
"Please enter valid SKU key.","Please enter valid SKU key."
"Please enter a valid number.","Please enter a valid number."
"This is required field","This is required field"
-"Admin is a required field in the each row.","Admin is a required field in the each row."
+"Admin is a required field in each row.","Admin is a required field in each row."
"Password cannot be the same as email address.","Password cannot be the same as email address."
"Please fix this field.","Please fix this field."
"Please enter a valid email address.","Please enter a valid email address."
diff --git a/lib/web/jquery/jstree/jquery.jstree.js b/lib/web/jquery/jstree/jquery.jstree.js
index e2f6330ba45eb..4671256b4207b 100644
--- a/lib/web/jquery/jstree/jquery.jstree.js
+++ b/lib/web/jquery/jstree/jquery.jstree.js
@@ -28,7 +28,7 @@
"use strict";
// top wrapper to prevent multiple inclusion (is this OK?)
-(function () { if(jQuery && jQuery.jstree) { return; }
+(function () {
var is_ie6 = false, is_ie7 = false, is_ff2 = false;
/*
diff --git a/lib/web/mage/apply/main.js b/lib/web/mage/apply/main.js
index 60b737e59e110..489e467f9b110 100644
--- a/lib/web/mage/apply/main.js
+++ b/lib/web/mage/apply/main.js
@@ -32,6 +32,12 @@ define([
} else if ($(el)[component]) {
$(el)[component](config);
}
+ }, function (error) {
+ if ('console' in window && typeof window.console.error === 'function') {
+ console.error(error);
+ }
+
+ return true;
});
}
diff --git a/lib/web/mage/collapsible.js b/lib/web/mage/collapsible.js
index 0d8cf836c198e..267734605f141 100644
--- a/lib/web/mage/collapsible.js
+++ b/lib/web/mage/collapsible.js
@@ -243,7 +243,7 @@ define([
});
// For collapsible widget only (not tabs or accordion)
- if (this.header.parent().attr('role') != 'presentation') { //eslint-disable-line eqeqeq
+ if (this.header.parent().attr('role') !== 'presentation') {
this.header
.parent()
.attr('role', 'tablist');
@@ -316,9 +316,9 @@ define([
* Disable.
*/
disable: function () {
+ this.options.disabled = true;
this._off(this.trigger);
this.forceDeactivate();
- this.options.disabled = true;
if (this.options.disabledState) {
this.element.addClass(this.options.disabledState);
@@ -330,12 +330,14 @@ define([
* Enable.
*/
enable: function () {
- this._on(this.trigger, this.events);
this.options.disabled = false;
+ this._on(this.trigger, this.events);
+ this.forceActivate();
if (this.options.disabledState) {
this.element.removeClass(this.options.disabledState);
}
+ this.trigger.attr('tabIndex', 0);
},
/**
@@ -517,7 +519,7 @@ define([
that = this;
if (url) {
- this.xhr = $.get({
+ that.xhr = $.get({
url: url,
dataType: 'html'
}, function () {
@@ -533,7 +535,8 @@ define([
setTimeout(function () {
that.content.html(response);
}, 1);
- }).complete(function (jqXHR, status) {
+ });
+ that.xhr.complete(function (jqXHR, status) {
setTimeout(function () {
if (status === 'abort') {
that.content.stop(false, true);
diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js
index 6ad60333d2e1b..41730aa036b08 100644
--- a/lib/web/mage/menu.js
+++ b/lib/web/mage/menu.js
@@ -626,6 +626,9 @@ define([
return;
}
+ // remove the active state class from the siblings
+ this.active.siblings().children('.ui-state-active').removeClass('ui-state-active');
+
this._open(newItem.parent());
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js
index fee88826be7eb..ac99b04ad1b7a 100644
--- a/lib/web/mage/validation.js
+++ b/lib/web/mage/validation.js
@@ -845,11 +845,13 @@
result = true;
range = param;
- if (typeof range === 'object') {
+ if (typeof range === 'string') {
m = dataAttrRange.exec(range);
if (m) {
result = result && $.mage.isBetween(numValue, m[1], m[2]);
+ } else {
+ result = false;
}
} else if (elm && elm.className) {
classes = elm.className.split(' ');
@@ -896,11 +898,13 @@
result = true;
range = param;
- if (typeof range === 'object') {
+ if (typeof range === 'string') {
m = dataAttrRange.exec(range);
if (m) {
result = result && $.mage.isBetween(numValue, m[1], m[2]);
+ } else {
+ result = false;
}
} else if (elm && elm.className) {
classes = elm.className.split(' ');
@@ -1550,15 +1554,15 @@
],
'required-text-swatch-entry': [
tableSingleValidation,
- $.mage.__('Admin is a required field in the each row.')
+ $.mage.__('Admin is a required field in each row.')
],
'required-visual-swatch-entry': [
tableSingleValidation,
- $.mage.__('Admin is a required field in the each row.')
+ $.mage.__('Admin is a required field in each row.')
],
'required-dropdown-attribute-entry': [
tableSingleValidation,
- $.mage.__('Admin is a required field in the each row.')
+ $.mage.__('Admin is a required field in each row.')
],
'validate-item-quantity': [
function (value, element, params) {
diff --git a/lib/web/magnifier/magnifier.js b/lib/web/magnifier/magnifier.js
index 958af0e96641b..c475364368922 100644
--- a/lib/web/magnifier/magnifier.js
+++ b/lib/web/magnifier/magnifier.js
@@ -588,7 +588,7 @@
_init($box, gOptions);
});
- $(document).on('mousemove', onMousemove);
+ $box.on('mousemove', onMousemove);
_init($box, gOptions);
}
diff --git a/nginx.conf.sample b/nginx.conf.sample
index 7257c329df24b..1e20a51a511d3 100644
--- a/nginx.conf.sample
+++ b/nginx.conf.sample
@@ -100,7 +100,7 @@ location /static/ {
# Remove signature of the static files that is used to overcome the browser cache
location ~ ^/static/version {
- rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
+ rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx
index 154915cd3a4fc..ef407b9206c0f 100644
--- a/setup/performance-toolkit/benchmark.jmx
+++ b/setup/performance-toolkit/benchmark.jmx
@@ -12976,6 +12976,9 @@ vars.put("admin_user", adminUser);
//Index of the current product from the cluster
Random random = new Random();
+ if (${seedForRandom} > 0) {
+ random.setSeed(${seedForRandom} + ${__threadNum});
+ }
int iterator = random.nextInt(clusterLength);
if (iterator == 0) {
iterator = 1;
@@ -32318,7 +32321,7 @@ vars.put("admin_user", adminUser);
actions":\{"edit":\{"href":"(?:http|https):\\/\\/(.*?)\\/customer\\/index\\/edit\\/id\\/(\d+)\\/",
/customer/index/edit/id/$2$/
- 0
+ 1
@@ -34535,6 +34538,9 @@ vars.put("admin_user", adminUser);
//Index of the current product from the cluster
Random random = new Random();
+ if (${seedForRandom} > 0) {
+ random.setSeed(${seedForRandom} + ${__threadNum});
+ }
int iterator = random.nextInt(clusterLength);
if (iterator == 0) {
iterator = 1;
diff --git a/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php b/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php
index c817d2e07660a..d4f192255c209 100644
--- a/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php
@@ -96,8 +96,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$indexerRegistry = $fixtureModel->getObjectManager()
->create(\Magento\Framework\Indexer\IndexerRegistry::class);
+ $indexersState = [];
foreach ($indexerListIds as $indexerId) {
$indexer = $indexerRegistry->get($indexerId['indexer_id']);
+ $indexersState[$indexerId['indexer_id']] = $indexer->isScheduled();
$indexer->setScheduled(true);
}
@@ -107,6 +109,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->clearChangelog();
+ foreach ($indexerListIds as $indexerId) {
+ /** @var $indexer \Magento\Indexer\Model\Indexer */
+ $indexer = $indexerRegistry->get($indexerId['indexer_id']);
+ $indexer->setScheduled($indexersState[$indexerId['indexer_id']]);
+ }
+
/** @var \Magento\Setup\Fixtures\IndexersStatesApplyFixture $indexerFixture */
$indexerFixture = $fixtureModel
->getFixtureByName(\Magento\Setup\Fixtures\IndexersStatesApplyFixture::class);