From: Marius Olbertz Date: Fri, 28 Apr 2017 05:37:03 +0000 (+0200) Subject: Added test for close with ESCAPE for DropdownMenu. X-Git-Tag: v6.4.0-rc1~50^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=555ceb85fa768c69fd5e4a792b1dda5d2130e752;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Added test for close with ESCAPE for DropdownMenu. --- diff --git a/test/javascript/components/dropdownMenu.js b/test/javascript/components/dropdownMenu.js index 897589262..8c35b8d4a 100644 --- a/test/javascript/components/dropdownMenu.js +++ b/test/javascript/components/dropdownMenu.js @@ -56,17 +56,19 @@ describe('Dropdown Menu', function () { }); describe('keyboard events', function () { - it.skip('closes current sub menu using ESC', function () { + it('closes current sub menu using ESCAPE', function () { $html = $(template).appendTo('body'); plugin = new Foundation.DropdownMenu($html, {}); // Open it first - plugin._show($html.find('> li:nth-child(1)')); + plugin._show($html.find('> li:nth-child(1) > ul')); - $html.find('> li:nth-child(1) > a > li:first-child > a').focus() + $html.find('> li:nth-child(1) > ul > li:nth-child(1) > a').focus() .trigger(window.mockKeyboardEvent('ESCAPE')); - $html.find('li a').first(); + $html.find('> li:nth-child(1)').should.not.have.class('is-active'); + $html.find('> li:nth-child(1) > ul').should.not.have.class('js-dropdown-active'); + document.activeElement.should.be.equal($html.find('> li:nth-child(1) > a')[0]); }); it('moves focus to next tab on ARROW_RIGHT', function () { $html = $(template).appendTo('body');