From: Marius Olbertz Date: Wed, 19 Apr 2017 15:12:56 +0000 (+0200) Subject: Added tests for home and end keyboard events. X-Git-Tag: v6.4.0-rc1~64^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9963%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Added tests for home and end keyboard events. --- diff --git a/test/javascript/components/slider.js b/test/javascript/components/slider.js index 22c900357..ffca592fc 100644 --- a/test/javascript/components/slider.js +++ b/test/javascript/components/slider.js @@ -153,4 +153,24 @@ describe('Slider', function() { }); }); + describe('keyboard events', function() { + it('sets value to minimum using HOME', function() { + $html = $(template).appendTo('body'); + plugin = new Foundation.Slider($html, {}); + + plugin.$handle.focus() + .trigger(window.mockKeyboardEvent('HOME')); + + plugin.$handle.should.have.attr('aria-valuenow', plugin.$handle.attr('aria-valuemin')); + }); + it('sets value to maximum using END', function() { + $html = $(template).appendTo('body'); + plugin = new Foundation.Slider($html, {}); + + plugin.$handle.focus() + .trigger(window.mockKeyboardEvent('END')); + + plugin.$handle.should.have.attr('aria-valuenow', plugin.$handle.attr('aria-valuemax')); + }); + }); }); \ No newline at end of file