forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added accordion.test.js for Jasmine testing.
Removed accordion.js and index.html for jsTestDriver test.
- Loading branch information
Carlos Lizaga
committed
Nov 22, 2017
1 parent
3a907c2
commit 821bdaa
Showing
3 changed files
with
81 additions
and
88 deletions.
There are no files selected for viewing
57 changes: 0 additions & 57 deletions
57
dev/tests/js/JsTestDriver/testsuite/mage/accordion/accordion.js
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
dev/tests/js/JsTestDriver/testsuite/mage/accordion/index.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = $("<div/>"); | ||
|
||
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 = $('<div/>'), | ||
title1 = $('<div data-role="collapsible"></div>').appendTo(accordion), | ||
content1 = $('<div data-role="content"></div>').appendTo(accordion), | ||
title2 = $('<div data-role="collapsible"></div>').appendTo(accordion), | ||
content2 = $('<div data-role="content"></div>').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 = $('<div/>'); | ||
|
||
$('<div data-role="collapsible"></div>').appendTo(accordion); | ||
|
||
var content1 = $('<div data-role="content"></div>').appendTo(accordion), | ||
title2 = $('<div data-role="collapsible"></div>').appendTo(accordion), | ||
content2 = $('<div data-role="content"></div>').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(); | ||
}); | ||
}); | ||
}); |