From: Nicolas Coden Date: Fri, 27 Apr 2018 21:59:38 +0000 (+0200) Subject: chore: clean component after DropdownMenu tests #11074 X-Git-Tag: v6.6.0~3^2~219^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7ccd984d;p=thirdparty%2Ffoundation%2Ffoundation-sites.git chore: clean component after DropdownMenu tests #11074 Closes https://github.com/zurb/foundation-sites/issues/11074 --- diff --git a/test/javascript/components/dropdownMenu.js b/test/javascript/components/dropdownMenu.js index 248fff807..bd91d8dd5 100644 --- a/test/javascript/components/dropdownMenu.js +++ b/test/javascript/components/dropdownMenu.js @@ -93,7 +93,7 @@ describe('Dropdown Menu', function () { $html.find('> li:nth-child(1)').should.have.class('is-active'); $html.find('> li:nth-child(1) > ul').should.have.class('js-dropdown-active'); - document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); + document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); }); it('moves focus to previous sub element on ARROW_UP', function () { // Open it first @@ -113,7 +113,7 @@ describe('Dropdown Menu', function () { $html.find('> li:nth-child(1) > ul > li:nth-child(2)').should.have.class('is-active'); $html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul').should.have.class('js-dropdown-active'); - document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]); + document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]); }); }); describe('vertical', function() { @@ -139,13 +139,9 @@ describe('Dropdown Menu', function () { $html.find('> li:nth-child(1)').should.have.class('is-active'); $html.find('> li:nth-child(1) > ul').should.have.class('js-dropdown-active'); - document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); + document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); }); it('moves focus to previous sub element on ARROW_UP', function () { - $html = $(template).appendTo('body'); - plugin = new Foundation.DropdownMenu($html, {}); - - // Open it first plugin._show($html.find('> li:nth-child(1) > ul')); $html.find('> li:nth-child(1) > ul > li:nth-child(2) > a').focus() @@ -154,10 +150,6 @@ describe('Dropdown Menu', function () { document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); }); it('opens child element of sub menu on ARROW_RIGHT', function() { - $html = $(template).appendTo('body'); - plugin = new Foundation.DropdownMenu($html, {}); - - // Open it first plugin._show($html.find('> li:nth-child(1) > ul')); $html.find('> li:nth-child(1) > ul > li:nth-child(2) > a').focus() @@ -165,8 +157,8 @@ describe('Dropdown Menu', function () { $html.find('> li:nth-child(1) > ul > li:nth-child(2)').should.have.class('is-active'); $html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul').should.have.class('js-dropdown-active'); - document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]); + document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]); }); }); }); -}); \ No newline at end of file +});