From: Eric Defore Date: Mon, 12 Oct 2020 20:43:28 +0000 (-0400) Subject: test: add tabindex test for findFocusable() X-Git-Tag: v6.7.1~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12165%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git test: add tabindex test for findFocusable() Added a test for the sorting element of Keyboard.findFocusable() to ensure tabindex sorting works properly --- diff --git a/test/javascript/util/keyboard.js b/test/javascript/util/keyboard.js index 836c69a0c..a9b4860e0 100644 --- a/test/javascript/util/keyboard.js +++ b/test/javascript/util/keyboard.js @@ -177,6 +177,20 @@ describe('Keyboard util', function() { $html.remove(); }); + + it('does sort by tabindex', function() { + let $html = $(`
+ Link1 + Link3 + Link2 +
`).appendTo('body'); + + let $focusable = Foundation.Keyboard.findFocusable($html); + + $focusable.eq(2)[0].should.be.equal($html.find('a').eq(1)[0]); + + $html.remove(); + }); }); describe('trapFocus()', function() {