Skip to content

Commit aa7f819

Browse files
committed
Merge branch 'master' into widget-delegation
2 parents 391282a + fb210ae commit aa7f819

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2081
-1057
lines changed

demos/menubar/default.html

Lines changed: 11 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>jQuery UI Menubar - Default demo</title>
55
<link rel="stylesheet" href="../demos.css" type="text/css" />
6-
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
6+
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" />
77
<script src="../../jquery-1.5.1.js"></script>
88
<script src="../../ui/jquery.ui.core.js"></script>
99
<script src="../../ui/jquery.ui.widget.js"></script>
@@ -13,56 +13,29 @@
1313
<script src="../../ui/jquery.ui.menubar.js"></script>
1414
<script>
1515
$(function() {
16-
$("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
17-
18-
$("#bar1, .menubar").menubar({
16+
$("#bar1").menubar({
17+
position: {
18+
within: $("#demo-frame").add(window).first()
19+
},
1920
select: function(event, ui) {
2021
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
2122
}
2223
});
23-
24+
2425
$(".menubar-icons").menubar({
2526
menuIcon: true,
2627
buttons: true,
28+
position: {
29+
within: $("#demo-frame").add(window).first()
30+
},
2731
select: function(event, ui) {
2832
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
2933
}
3034
});
3135
});
3236
</script>
33-
<style type="text/css">
34-
#bar1, #bar2 { margin: 0 0 4em; } /* style for this page only */
35-
.ui-menu { width: 200px; position: absolute; outline: none; z-index: 9999; }
36-
.ui-menu .ui-icon { float: right; }
37-
.ui-menu li.ui-state-disabled {
38-
font-weight: bold;
39-
padding: .0em .4em;
40-
margin: .4em 0 .2em;
41-
line-height: 1.5;
42-
}
43-
44-
/* menubar styles */
45-
.ui-menubar .ui-button { float: left; font-weight: normal; border-top-width: 0 !important; border-bottom-width: 0 !important; margin: 0; outline: none; }
46-
.ui-menubar .ui-menubar-link { border-right: 1px dashed transparent; border-left: 1px dashed transparent; }
47-
48-
.ui-menubar {
49-
list-style: none;
50-
margin: 0;
51-
padding-left: 0;
52-
}
53-
54-
.ui-menubar-item {
55-
float: left;
56-
}
57-
/*
58-
table {
59-
border-collapse: collapse;
60-
}
61-
th, td {
62-
padding: 0.5em;
63-
border: 1px solid black;
64-
}
65-
*/
37+
<style>
38+
#bar1, #bar2 { margin: 0 0 4em; }
6639
</style>
6740
</head>
6841
<body>
@@ -160,63 +133,6 @@
160133
</li>
161134
</ul>
162135

163-
<!--
164-
<table id="movies" class="ui-widget">
165-
<thead>
166-
<tr>
167-
<th data-field="Name" class="ui-widget-header">Name</th>
168-
<th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
169-
<th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
170-
<th class="ui-widget-header"></th>
171-
</tr>
172-
</thead>
173-
<tbody>
174-
<tr>
175-
<td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
176-
<td class="ui-widget-content">1993</td>
177-
<td class="ui-widget-content">3.6</td>
178-
<td class="ui-widget-content">
179-
<ul class="menubar">
180-
<li>
181-
<a href="#Options">Options</a>
182-
<ul>
183-
<li><a href="#Order...">Order...</a></li>
184-
<li class="ui-state-disabled">Write a Review...</li>
185-
<li><a href="#Find Similar Movies...">Find Similar Movies...</a></li>
186-
<li>
187-
<a href="#Rate">Rate</a>
188-
<ul>
189-
<li><a href="#5 stars">5 stars</a></li>
190-
<li><a href="#4 stars">4 stars</a></li>
191-
<li><a href="#3 stars">3 stars</a></li>
192-
<li><a href="#2 stars">2 stars</a></li>
193-
<li><a href="#1 stars">1 stars</a></li>
194-
</ul>
195-
</li>
196-
</ul>
197-
</li>
198-
</ul>
199-
</td>
200-
</tr>
201-
<tr>
202-
<td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
203-
<td class="ui-widget-content">1991</td>
204-
<td class="ui-widget-content">3.1</td>
205-
</tr>
206-
<tr>
207-
<td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
208-
<td class="ui-widget-content">1991</td>
209-
<td class="ui-widget-content">3.9</td>
210-
</tr>
211-
<tr>
212-
<td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
213-
<td class="ui-widget-content">1997</td>
214-
<td class="ui-widget-content">2.6</td>
215-
</tr>
216-
</tbody>
217-
</table>
218-
-->
219-
220136
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
221137
Log:
222138
<div id="log" style="height: 100px; width: 300px; overflow: auto;" class="ui-widget-content"></div>

demos/popup/default.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<style type="text/css">
3030
.ui-popup { position: absolute; z-index: 5000; }
3131
.ui-menu { width: 200px; }
32-
32+
3333
/*
3434
table {
3535
border-collapse: collapse;
@@ -55,26 +55,24 @@
5555

5656
<div class="demo">
5757
<a href="#login-form">Log In</a>
58-
<div id="login-form" class="ui-widget-content" tabIndex="0">
59-
<form>
60-
<div>
61-
<label>Username</label>
62-
<input type="username" />
63-
</div>
64-
<div>
65-
<label>Password</label>
66-
<input type="password" />
67-
</div>
68-
<div>
69-
<input type="submit" class="submit" value="Login" />
70-
</div>
71-
</form>
58+
<div class="ui-widget-content" id="login-form" aria-label="Login options">
59+
<div>
60+
<label for="un">Username</label>
61+
<input type="text" id="un" />
62+
</div>
63+
<div>
64+
<label for="pw">Password</label>
65+
<input type="password" id="pw" />
66+
</div>
67+
<div>
68+
<input type="submit" value="Login" class="submit" />
69+
</div>
7270
</div>
7371
</div>
7472

7573
<div class="demo-description">
7674

77-
<p>A link to a login form that opens as a popup. [Not quite functional, focus handling needs to get better]</p>
75+
<p>A link to a login form that opens as a popup.</p>
7876

7977
</div><!-- End demo-description -->
8078

demos/widget/default.html

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<script src="../../ui/jquery.ui.position.js"></script>
1111
<link rel="stylesheet" href="../demos.css">
1212
<style>
13-
.colorize {
13+
.custom-colorize {
1414
font-size: 25px;
1515
width: 75px;
1616
height: 75px;
@@ -28,20 +28,21 @@
2828
blue: 0,
2929

3030
// callbacks
31+
change: null,
3132
random: null
3233
},
3334

3435
// the constructor
3536
_create: function() {
3637
this.element
37-
// add a class for themeing
38-
.addClass("colorize")
38+
// add a class for theming
39+
.addClass( "custom-colorize" )
3940
// prevent double click to select text
4041
.disableSelection();
4142

4243
// bind click events to random method
4344
this._bind({
44-
// _bind won"t call random when widget is disabled
45+
// _bind won't call random when widget is disabled
4546
click: "random"
4647
});
4748
this._refresh();
@@ -68,7 +69,7 @@
6869
blue: Math.floor( Math.random() * 256 )
6970
};
7071

71-
// trigger an event, check if it"s canceled
72+
// trigger an event, check if it's canceled
7273
if ( this._trigger( "random", event, colors ) !== false ) {
7374
this.option( colors );
7475
}
@@ -78,24 +79,26 @@
7879
// revert other modifications here
7980
_destroy: function() {
8081
this.element
81-
.removeClass( "colorize" )
82+
.removeClass( "custom-colorize" )
8283
.enableSelection()
8384
.css( "background-color", "transparent" );
8485
},
8586

86-
_setOption: function( key, value ) {
87-
// prevent invalid color values
88-
if ( /red|green|blue/.test(key) && value < 0 || value > 255 ) {
89-
return;
90-
}
91-
this._super( "_setOptions", options );
92-
},
93-
87+
// _setOptions is called with a hash of all options that are changing
9488
// always refresh when changing options
9589
_setOptions: function() {
96-
// _super handles keeping the right this-context
90+
// _super and _superApply handle keeping the right this-context
9791
this._superApply( "_setOptions", arguments );
9892
this._refresh();
93+
},
94+
95+
// _setOption is called for each individual option that is changing
96+
_setOption: function( key, value ) {
97+
// prevent invalid color values
98+
if ( /red|green|blue/.test(key) && (value < 0 || value > 255) ) {
99+
return;
100+
}
101+
this._super( "_setOption", key, value );
99102
}
100103
});
101104

@@ -131,7 +134,7 @@
131134
red: 0,
132135
green: 0,
133136
blue: 0
134-
} );
137+
});
135138
});
136139
});
137140
</script>

tests/unit/accordion/accordion.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
var actual = accordion.find( ".ui-accordion-content" ).map(function() {
2626
return $( this ).css( "display" ) === "none" ? 0 : 1;
2727
}).get();
28-
same( actual, expected );
28+
deepEqual( actual, expected );
2929
}
30-
function equalHeights( accordion, min, max ) {
30+
function accordion_equalHeights( accordion, min, max ) {
3131
var sizes = [];
3232
accordion.find( ".ui-accordion-content" ).each(function() {
3333
sizes.push( $( this ).outerHeight() );
3434
});
3535
ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max,
3636
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
37-
same( sizes[ 0 ], sizes[ 1 ] );
38-
same( sizes[ 0 ], sizes[ 2 ] );
37+
deepEqual( sizes[ 0 ], sizes[ 1 ] );
38+
deepEqual( sizes[ 0 ], sizes[ 2 ] );
3939
}
4040
function accordionSetupTeardown() {
4141
var animated = $.ui.accordion.prototype.options.animated;

tests/unit/accordion/accordion_core.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@
33
module( "accordion: core", accordionSetupTeardown() );
44

55
$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( type, selector ) {
6+
expect( 4 );
67
test( "markup structure: " + type, function() {
78
var element = $( selector ).accordion();
89
ok( element.hasClass( "ui-accordion" ), "main element is .ui-accordion" );
910
equal( element.find( ".ui-accordion-header" ).length, 3,
1011
".ui-accordion-header elements exist, correct number" );
1112
equal( element.find( ".ui-accordion-content" ).length, 3,
1213
".ui-accordion-content elements exist, correct number" );
13-
same( element.find( ".ui-accordion-header" ).next().get(),
14+
deepEqual( element.find( ".ui-accordion-header" ).next().get(),
1415
element.find( ".ui-accordion-content" ).get(),
1516
"content panels come immediately after headers" );
1617
});
1718
});
1819

1920
test( "handle click on header-descendant", function() {
21+
expect( 1 );
2022
var element = $( "#navigation" ).accordion();
2123
$( "#navigation h2:eq(1) a" ).click();
2224
accordion_state( element, 0, 1, 0 );
@@ -26,28 +28,28 @@ test( "ui-accordion-heading class added to headers anchor", function() {
2628
expect( 1 );
2729
var element = $( "#list1" ).accordion();
2830
var anchors = element.find( ".ui-accordion-heading" );
29-
equals( anchors.length, 3 );
31+
equal( anchors.length, 3 );
3032
});
3133

3234
test( "accessibility", function () {
3335
expect( 13 );
3436
var element = $( "#list1" ).accordion().accordion( "option", "active", 1 );
3537
var headers = element.find( ".ui-accordion-header" );
3638

37-
equals( headers.eq( 1 ).attr( "tabindex" ), 0, "active header should have tabindex=0" );
38-
equals( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header should have tabindex=-1" );
39-
equals( element.attr( "role" ), "tablist", "main role" );
40-
equals( headers.attr( "role" ), "tab", "tab roles" );
41-
equals( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" );
42-
equals( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" );
43-
equals( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" );
44-
equals( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
45-
equals( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
39+
equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header should have tabindex=0" );
40+
equal( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header should have tabindex=-1" );
41+
equal( element.attr( "role" ), "tablist", "main role" );
42+
equal( headers.attr( "role" ), "tab", "tab roles" );
43+
equal( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" );
44+
equal( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" );
45+
equal( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" );
46+
equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
47+
equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
4648
element.accordion( "option", "active", 0 );
47-
equals( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" );
48-
equals( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" );
49-
equals( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
50-
equals( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
49+
equal( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" );
50+
equal( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" );
51+
equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" );
52+
equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" );
5153
});
5254

5355
}( jQuery ) );

tests/unit/accordion/accordion_deprecated.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
var actual = accordion.find( ".ui-accordion-content" ).map(function() {
2323
return $( this ).css( "display" ) === "none" ? 0 : 1;
2424
}).get();
25-
same( actual, expected );
25+
deepEqual( actual, expected );
2626
}
27-
function equalHeights( accordion, min, max ) {
27+
function accordion_equalHeights( accordion, min, max ) {
2828
var sizes = [];
2929
accordion.find( ".ui-accordion-content" ).each(function() {
3030
sizes.push( $( this ).outerHeight() );
3131
});
3232
ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max,
3333
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
34-
same( sizes[ 0 ], sizes[ 1 ] );
35-
same( sizes[ 0 ], sizes[ 2 ] );
34+
deepEqual( sizes[ 0 ], sizes[ 1 ] );
35+
deepEqual( sizes[ 0 ], sizes[ 2 ] );
3636
}
3737
function accordionSetupTeardown() {
3838
var animated = $.ui.accordion.prototype.options.animated;

0 commit comments

Comments
 (0)