| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 /* 2 * core unit tests 3 */ 4 (function($) { 5 6 module("selectors"); 7 8 test("tabbable - enabled elements", function() { 9 expect(10); 10 11 ok( $('#input1-1').is(':tabbable'), 'input, no type'); 12 ok( $('#input1-2').is(':tabbable'), 'input, type text'); 13 ok( $('#input1-3').is(':tabbable'), 'input, type checkbox'); 14 ok( $('#input1-4').is(':tabbable'), 'input, type radio'); 15 ok( $('#input1-5').is(':tabbable'), 'input, type button'); 16 ok(!$('#input1-6').is(':tabbable'), 'input, type hidden'); 17 ok( $('#input1-7').is(':tabbable'), 'select'); 18 ok( $('#input1-8').is(':tabbable'), 'textarea'); 19 ok( $('#anchor1-1').is(':tabbable'), 'anchor with href'); 20 ok(!$('#anchor1-2').is(':tabbable'), 'anchor without href'); 21 }); 22 23 test("tabbable - disabled elements", function() { 24 expect(8); 25 26 ok(!$('#input2-1').is(':tabbable'), 'input, no type'); 27 ok(!$('#input2-2').is(':tabbable'), 'input, type text'); 28 ok(!$('#input2-3').is(':tabbable'), 'input, type checkbox'); 29 ok(!$('#input2-4').is(':tabbable'), 'input, type radio'); 30 ok(!$('#input2-5').is(':tabbable'), 'input, type button'); 31 ok(!$('#input2-6').is(':tabbable'), 'input, type hidden'); 32 ok(!$('#input2-7').is(':tabbable'), 'select'); 33 ok(!$('#input2-8').is(':tabbable'), 'textarea'); 34 }); 35 36 test("tabbable - hidden styles", function() { 37 expect(6); 38 39 ok(!$('#input3-1').is(':tabbable'), 'input, hidden wrapper - display: none'); 40 ok(!$('#anchor3-1').is(':tabbable'), 'anchor, hidden wrapper - display: none'); 41 ok(!$('#input3-2').is(':tabbable'), 'input, hidden wrapper - visibility: hidden'); 42 ok(!$('#anchor3-2').is(':tabbable'), 'anchor, hidden wrapper - visibility: hidden'); 43 ok(!$('#input3-3').is(':tabbable'), 'input, display: none'); 44 ok(!$('#input3-4').is(':tabbable'), 'input, visibility: hidden'); 45 }); 46 47 test("tabbable - tabindex", function() { 48 expect(4); 49 50 ok( $('#input4-1').is(':tabbable'), 'input, tabindex 0'); 51 ok( $('#input4-2').is(':tabbable'), 'input, tabindex 10'); 52 ok(!$('#input4-3').is(':tabbable'), 'input, tabindex -1'); 53 ok(!$('#input4-4').is(':tabbable'), 'input, tabindex -50'); 54 }); 55 56 module('jQuery extensions'); 57 58 test("attr - aria", function() { 59 expect(6); 60 61 var el = $('#aria'); 62 63 ok(!el.attr('role'), 'role is empty via attr'); 64 equals(el.attr('role', 'tablist').attr('role'), 'tablist', 'role is tablist'); 65 66 equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined'); 67 68 el.attr('aria-expanded', true); 69 equals(el.attr('aria-expanded'), 'true', 'aria expanded is true'); 70 71 el.removeAttr('aria-expanded'); 72 equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined after removing'); 73 74 el.attr('aria-expanded', false); 75 equals(el.attr('aria-expanded'), 'false', 'aria expanded is false'); 76 }); 77 78 })(jQuery);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |