diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/accordion/accordion.js b/dev/tests/js/JsTestDriver/testsuite/mage/accordion/accordion.js deleted file mode 100644 index 562c5c096b654..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/accordion/accordion.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @category mage.js - * @package test - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -/* - - */ -test( "Initialization", function() { - expect(2); - var accordion = $("
"); - accordion.accordion(); - ok( accordion.is(':mage-accordion'), "widget instantiated" ); - accordion.accordion('destroy'); - ok( !accordion.is(':mage-accordion'), "widget destroyed" ); -}); - - - -test( "One-collapsible element", function() { - expect(4); - var accordion = $('
'); - var title1 = $('
').appendTo(accordion); - var content1 = $('
').appendTo(accordion); - var title2 = $('
').appendTo(accordion); - var content2 = $('
').appendTo(accordion); - accordion.appendTo("body"); - - accordion.accordion(); - ok( content1.is(':visible'), "content visible" ); - ok( content2.is(':hidden'), "content hidden" ); - title2.trigger('click'); - ok( content1.is(':hidden'), "content hidden" ); - ok( content2.is(':visible'), "content visible" ); - accordion.accordion('destroy'); - -}); - -test( "Multi-collapsible elements", function() { - expect(4); - var accordion = $('
'); - var title1 = $('
').appendTo(accordion); - var content1 = $('
').appendTo(accordion); - var title2 = $('
').appendTo(accordion); - var content2 = $('
').appendTo(accordion); - accordion.appendTo("body"); - - accordion.accordion({multipleCollapsible:true}); - ok( content1.is(':visible'), "content visible" ); - ok( content2.is(':hidden'), "content hidden" ); - title2.trigger('click'); - ok( content1.is(':visible'), "content visible" ); - ok( content2.is(':visible'), "content visible" ); - accordion.accordion('destroy'); -}); diff --git a/dev/tests/js/JsTestDriver/testsuite/mage/accordion/index.html b/dev/tests/js/JsTestDriver/testsuite/mage/accordion/index.html deleted file mode 100644 index 093284c6f4fa8..0000000000000 --- a/dev/tests/js/JsTestDriver/testsuite/mage/accordion/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Accordion Widget: QUnit Tests - - - - - - - - - - - - -
-
-
- - 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..a35367946349a --- /dev/null +++ b/dev/tests/js/jasmine/tests/lib/mage/accordion.test.js @@ -0,0 +1,81 @@ +/** + * 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 = $('
'); + + $('
').appendTo(accordion); + + var 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(); + + title2.trigger('click'); + + expect(content1.is(':visible')).toBeTruthy(); + expect(content2.is(':visible')).toBeTruthy(); + + accordion.accordion('destroy'); + + expect(accordion.is(':mage-accordion')).toBeFalsy(); + }); + }); +});