1 | /*
|
---|
2 | * core unit tests
|
---|
3 | */
|
---|
4 | (function($) {
|
---|
5 |
|
---|
6 | module('core - jQuery extensions');
|
---|
7 |
|
---|
8 | test("attr - aria", function() {
|
---|
9 | expect(6);
|
---|
10 |
|
---|
11 | var el = $('#aria');
|
---|
12 |
|
---|
13 | ok(!el.attr('role'), 'role is empty via attr');
|
---|
14 | equals(el.attr('role', 'tablist').attr('role'), 'tablist', 'role is tablist');
|
---|
15 |
|
---|
16 | equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined');
|
---|
17 |
|
---|
18 | el.attr('aria-expanded', true);
|
---|
19 | equals(el.attr('aria-expanded'), 'true', 'aria expanded is true');
|
---|
20 |
|
---|
21 | el.removeAttr('aria-expanded');
|
---|
22 | equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined after removing');
|
---|
23 |
|
---|
24 | el.attr('aria-expanded', false);
|
---|
25 | equals(el.attr('aria-expanded'), 'false', 'aria expanded is false');
|
---|
26 | });
|
---|
27 |
|
---|
28 | test('focus', function() {
|
---|
29 | expect(3);
|
---|
30 |
|
---|
31 | var el = $('#inputTabindex0'),
|
---|
32 | // used to remove focus from the main element
|
---|
33 | other = $('#inputTabindex10');
|
---|
34 |
|
---|
35 | // test original functionality
|
---|
36 | el.focus(function() {
|
---|
37 | ok(true, 'event triggered');
|
---|
38 | });
|
---|
39 | el.focus();
|
---|
40 | other.focus();
|
---|
41 |
|
---|
42 | // trigger event handler + callback
|
---|
43 | stop();
|
---|
44 | el.focus(500, function() {
|
---|
45 | start();
|
---|
46 | ok(true, 'callback triggered');
|
---|
47 | });
|
---|
48 | other.focus();
|
---|
49 | });
|
---|
50 |
|
---|
51 | test('zIndex', function() {
|
---|
52 | var el = $('#zIndexAutoWithParent');
|
---|
53 | equals(el.zIndex(), 100, 'zIndex traverses up to find value');
|
---|
54 | equals(el.zIndex(200), el, 'zIndex setter is chainable');
|
---|
55 | equals(el.zIndex(), 200, 'zIndex setter changed zIndex');
|
---|
56 |
|
---|
57 | equals($('#zIndexAutoNoParent').zIndex(), 0, 'zIndex never explicitly set in hierarchy');
|
---|
58 | });
|
---|
59 |
|
---|
60 | })(jQuery);
|
---|