aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tabs/tabs_tickets.js
blob: fdc2295e9cb7e8a6a8f1bdad3deaea40ce11c0af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * tabs_tickets.js
 */
(function($) {

module("tabs: tickets");

test('#2715 - id containing colon', function() {
	// http://dev.jqueryui.com/ticket/2715
	expect(4);

	el = $('#tabs2').tabs();
	ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
	ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );

	el.tabs('select', 1).tabs('select', 0);
	ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
	ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );

});

test('#???? - panel containing inline style', function() {
	expect(3);

	var inlineStyle = function(property) {
		return $('#inline-style')[0].style[property];
	};
	var expected = inlineStyle('height');

	el = $('#tabs2').tabs();
	equals(inlineStyle('height'), expected, 'init should not remove inline style');

	el.tabs('select', 1);
	equals(inlineStyle('height'), expected, 'show tab should not remove inline style');

	el.tabs('select', 0);
	equals(inlineStyle('height'), expected, 'hide tab should not remove inline style');

});

test('#3627 - Ajax tab with url containing a fragment identifier fails to load', function() {
	// http://dev.jqueryui.com/ticket/3627
	expect(1);

	el = $('#tabs2').tabs();
	
	ok(/test.html$/.test( $('a:eq(2)', el).data('load.tabs') ), 'should ignore fragment identifier');

});

test('#4033 - IE expands hash to full url and misinterprets tab as ajax', function() {
	// http://dev.jqueryui.com/ticket/4033
	expect(1);
	
	el = $('<div><ul><li><a href="#tab">Tab</a></li></ul><div id="tab"></div></div>')
			.appendTo('#main').tabs();
    
	equals($('a', el).data('load.tabs'), undefined, 'should not create ajax tab');
	
});

test('#5069 - ui.tabs.add creates two tab panels when using a full URL', function() {
	// http://dev.jqueryui.com/ticket/5069
	expect(2);
	
	el = $('#tabs2').tabs();
	equals(el.children('div').length, el.find('> ul > li').length, 'After creation, number of panels should be equal to number of tabs');
	el.tabs('add', '/ajax_html_echo', 'Test');
	equals(el.children('div').length, el.find('> ul > li').length, 'After add, number of panels should be equal to number of tabs');
	
});

test('#5893 - Sublist in the tab list are considered as tab', function() {
	// http://dev.jqueryui.com/ticket/5893
	expect(1);

	el = $('#tabs6').tabs();
	equals(el.tabs( "length" ), 2, 'should contain 2 tab');

});

asyncTest( "#4581 - title attribute for remote tabs does not support foreign languages", function() {
	expect( 1 );
	
	$( "#tabs2" ).tabs({
		selected: 3,
		load: function( event, ui ) {
			equal( ui.panel.id, "∫ßáö_Սե", "proper title" );
			start();
		}
	});
});

})(jQuery);