UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

16 lines (12 loc) 678 B
StartTest(function(t) { t.beforeEach(function (t) { document.body.innerHTML = ''; }); t.it('findClosestFocusableElement should find first focusable element', function(t) { document.body.innerHTML = '<div id="foo"></div><div tabindex="-1" id="focusable"></div>'; t.is(t.findClosestFocusableElement(document.getElementById('foo')), document.body); t.is(t.findClosestFocusableElement(document.getElementById('focusable')), document.getElementById('focusable')); t.is(t.findClosestFocusableElement(document.body), document.body); t.is(t.findClosestFocusableElement(document.documentElement), document.body); }); })