Skip to content

Commit 76b22c0

Browse files
committed
Merge branch 'master' into panel
2 parents 5136104 + c49be0b commit 76b22c0

18 files changed

+226
-670
lines changed

external/qunit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ function validTest( name ) {
579579

580580
function push(result, actual, expected, message) {
581581
message = message || (result ? "okay" : "failed");
582-
QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) );
582+
QUnit.ok( result, result ? message + ": " + QUnit.jsDump.parse(expected) : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) );
583583
}
584584

585585
function synchronize( callback ) {
@@ -1060,9 +1060,9 @@ QUnit.jsDump = (function() {
10601060
name:'name',
10611061
'class':'className'
10621062
},
1063-
HTML:true,//if true, entities are escaped ( <, >, \t, space and \n )
1063+
HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
10641064
indentChar:' ',//indentation unit
1065-
multiline:true //if true, items in a collection, are separated by a \n, else just a space.
1065+
multiline:false //if true, items in a collection, are separated by a \n, else just a space.
10661066
};
10671067

10681068
return jsDump;

tests/unit/accordion/accordion.html

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525

2626
<style>
2727
#main { font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
28-
#main h2 { margin: 0; }
29-
#main ul, #main li { padding: 0; }
28+
#navigation * { margin: 0; padding: 0; font-size: 12px; }
3029
</style>
3130
</head>
3231
<body>
@@ -39,37 +38,39 @@ <h2 id="qunit-userAgent"></h2>
3938

4039
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
4140

42-
<div id="list1">
43-
<a>There is one obvious advantage:</a>
44-
<div>
45-
<p>
46-
You've seen it coming!
47-
<br/>
48-
Buy now and get nothing for free!
49-
<br/>
50-
Well, at least no free beer. Perhaps a bear, if you can afford it.
51-
</p>
52-
</div>
53-
<a>Now that you've got...</a>
54-
<div>
55-
<p>
56-
your bear, you have to admit it!
57-
<br/>
58-
No, we aren't selling bears.
59-
</p>
60-
<p>
61-
We could talk about renting one.
62-
</p>
63-
</div>
64-
<a>Rent one bear, ...</a>
65-
<div>
66-
<p>
67-
get two for three beer.
68-
</p>
69-
<p>
70-
And now, for something completely different.
71-
</p>
72-
</div>
41+
<div>
42+
<div id="list1" class="foo">
43+
<a class="bar">There is one obvious advantage:</a>
44+
<div style="" class="foo">
45+
<p>
46+
You've seen it coming!
47+
<br/>
48+
Buy now and get nothing for free!
49+
<br/>
50+
Well, at least no free beer. Perhaps a bear, if you can afford it.
51+
</p>
52+
</div>
53+
<a class="bar">Now that you've got...</a>
54+
<div style="" class="foo">
55+
<p>
56+
your bear, you have to admit it!
57+
<br/>
58+
No, we aren't selling bears.
59+
</p>
60+
<p>
61+
We could talk about renting one.
62+
</p>
63+
</div>
64+
<a class="bar">Rent one bear, ...</a>
65+
<div style="" class="foo">
66+
<p>
67+
get two for three beer.
68+
</p>
69+
<p>
70+
And now, for something completely different.
71+
</p>
72+
</div>
73+
</div>
7374
</div>
7475

7576
<div id="navigationWrapper">

tests/unit/accordion/accordion_methods.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,9 @@ test("init", function() {
4040
});
4141

4242
test("destroy", function() {
43-
$("<div></div>").appendTo('body').accordion().accordion("destroy").remove();
44-
ok(true, '.accordion("destroy") called on element');
45-
46-
$([]).accordion().accordion("destroy").remove();
47-
ok(true, '.accordion("destroy") called on empty collection');
48-
49-
$('<div></div>').accordion().accordion("destroy").remove();
50-
ok(true, '.accordion("destroy") called on disconnected DOMElement');
51-
52-
$('<div></div>').accordion().accordion("destroy").accordion("foo").remove();
53-
ok(true, 'arbitrary method called after destroy');
54-
55-
var expected = $('<div></div>').accordion(),
56-
actual = expected.accordion('destroy');
57-
equals(actual, expected, 'destroy is chainable');
43+
var beforeHtml = $("#list1").parent().html();
44+
var afterHtml = $("#list1").accordion().accordion("destroy").parent().html();
45+
equal( afterHtml, beforeHtml );
5846
});
5947

6048
test("enable", function() {

tests/unit/accordion/accordion_options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ test("{ fillSpace: false }, default", function() {
116116
test("{ fillSpace: true }", function() {
117117
$("#navigationWrapper").height(500);
118118
$('#navigation').accordion({ fillSpace: true });
119-
equals( $('#navigation > li:eq(0) > ul').height(), 362 );
120-
equals( $('#navigation > li:eq(1) > ul').height(), 362 );
121-
equals( $('#navigation > li:eq(2) > ul').height(), 362 );
119+
equals( $('#navigation > li:eq(0) > ul').height(), 446 );
120+
equals( $('#navigation > li:eq(1) > ul').height(), 446 );
121+
equals( $('#navigation > li:eq(2) > ul').height(), 446 );
122122
});
123123

124124
test("{ header: '> li > :first-child,> :not(li):even' }, default", function() {

tests/unit/autocomplete/autocomplete_methods.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ module("autocomplete: methods", {
1313
test("destroy", function() {
1414
var beforeHtml = $("#autocomplete").parent().html();
1515
var afterHtml = $("#autocomplete").autocomplete().autocomplete("destroy").parent().html();
16-
// TODO can't use same, as that would insert the markup unescaped into the test results, screwing up other tests
17-
ok( beforeHtml == afterHtml );
16+
equal( afterHtml, beforeHtml, "before/after html should be the same" );
1817
})
1918

2019
var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];

tests/unit/button/button_methods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module("button: methods");
99
test("destroy", function() {
1010
var beforeHtml = $("#button").parent().html();
1111
var afterHtml = $("#button").button().button("destroy").parent().html();
12-
same( beforeHtml, afterHtml );
12+
equal( afterHtml, beforeHtml );
1313
});
1414

1515
})(jQuery);

tests/unit/position/position.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,9 @@ <h2 id="qunit-userAgent"></h2>
4343

4444
<div style="position: absolute; height: 5000px; width: 5000px;"></div>
4545

46+
<div id="bug-5280" style="height: 30px; width: 201px;">
47+
<div style="width: 50px; height: 10px;"></div>
48+
</div>
49+
4650
</body>
4751
</html>

tests/unit/position/position_core.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,22 @@ test("collision: none, with offset", function() {
330330
}, { top: -13, left: -12 }, "left top, negative offset");
331331
});
332332

333+
//test('bug #5280: consistent results (avoid fractional values)', function() {
334+
// var wrapper = $('#bug-5280'),
335+
// elem = wrapper.children(),
336+
// offset1 = elem.position({
337+
// my: 'center',
338+
// at: 'center',
339+
// of: wrapper,
340+
// collision: 'none'
341+
// }).offset(),
342+
// offset2 = elem.position({
343+
// my: 'center',
344+
// at: 'center',
345+
// of: wrapper,
346+
// collision: 'none'
347+
// }).offset();
348+
// same(offset1, offset2);
349+
//});
350+
333351
})(jQuery);

tests/unit/slider/slider_events.js

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,54 @@
33
*/
44
(function($) {
55

6-
var el;
7-
86
module( "slider: events" );
97

10-
test( "start", function() {
11-
ok( false, "missing test - untested code is broken code." );
12-
});
13-
14-
test( "slide", function() {
15-
ok( false, "missing test - untested code is broken code." );
16-
});
17-
188
//Specs from http://wiki.jqueryui.com/Slider#specs
199
//"change callback: triggers when the slider has stopped moving and has a new
2010
// value (even if same as previous value), via mouse(mouseup) or keyboard(keyup)
2111
// or value method/option"
22-
test( "change", function() {
23-
expect(8);
12+
test( "mouse based interaction", function() {
13+
expect(4);
2414

25-
var handle;
26-
// Test mouseup at end of handle slide (mouse)
27-
el = $( "<div></div>" )
15+
var el = $( "<div></div>" )
2816
.appendTo( "body" )
2917
.slider({
18+
start: function(event, ui) {
19+
equals( event.originalEvent.type, "mousedown", "start triggered by mousedown" );
20+
},
21+
slide: function(event, ui) {
22+
equals( event.originalEvent.type, "mousemove", "slider triggered by mousemove" );
23+
},
24+
stop: function(event, ui) {
25+
equals( event.originalEvent.type, "mouseup", "stop triggered by mouseup" );
26+
},
3027
change: function(event, ui) {
31-
ok( true, "change triggered by mouseup at end of handle slide (mouse)" );
28+
equals( event.originalEvent.type, "mouseup", "change triggered by mouseup" );
3229
}
3330
});
3431

3532
el.find( ".ui-slider-handle" ).eq( 0 )
3633
.simulate( "drag", { dx: 10, dy: 10 } );
3734

38-
reset();
35+
});
36+
test( "keyboard based interaction", function() {
37+
expect(3);
38+
3939
// Test keyup at end of handle slide (keyboard)
40-
el = $( "<div></div>" )
40+
var el = $( "<div></div>" )
4141
.appendTo( "body" )
4242
.slider({
43+
start: function(event, ui) {
44+
equals( event.originalEvent.type, "keydown", "start triggered by keydown" );
45+
},
46+
slide: function(event, ui) {
47+
ok( false, "Slider never triggered by keys" );
48+
},
49+
stop: function(event, ui) {
50+
equals( event.originalEvent.type, "keyup", "stop triggered by keyup" );
51+
},
4352
change: function(event, ui) {
44-
ok( true, "change triggered by keyup at end of handle slide (keyboard)" );
53+
equals( event.originalEvent.type, "keyup", "change triggered by keyup" );
4554
}
4655
});
4756

@@ -50,9 +59,12 @@ test( "change", function() {
5059
.simulate( "keypress", { keyCode: $.ui.keyCode.LEFT } )
5160
.simulate( "keyup", { keyCode: $.ui.keyCode.LEFT } );
5261

53-
reset();
62+
});
63+
test( "programmatic event triggers", function() {
64+
expect(6);
65+
5466
// Test value method
55-
el = $( "<div></div>" )
67+
var el = $( "<div></div>" )
5668
.slider({
5769
change: function(event, ui) {
5870
ok( true, "change triggered by value method" );
@@ -94,8 +106,4 @@ test( "change", function() {
94106

95107
});
96108

97-
test( "stop", function() {
98-
ok( false, "missing test - untested code is broken code." );
99-
});
100-
101109
}( jQuery ) );

tests/unit/slider/slider_options.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ function handle() {
1111

1212
module("slider: options");
1313

14-
test("animate", function() {
15-
ok(false, "missing test - untested code is broken code.");
16-
});
17-
1814
test("max", function() {
1915
el = $('<div></div>');
2016

@@ -93,7 +89,17 @@ test("range", function() {
9389
});
9490

9591
test("step", function() {
96-
ok(false, "missing test - untested code is broken code.");
92+
var el = $('<div></div>').slider({
93+
step: 10
94+
});
95+
equals( el.slider("value"), 0 )
96+
el.slider("value", 1);
97+
equals( el.slider("value"), 10 );
98+
el.slider("value", 10);
99+
equals( el.slider("value"), 10 );
100+
el.slider("value", 11);
101+
equals( el.slider("value"), 20 );
102+
el.slider('destroy');
97103
});
98104

99105
test("value", function() {

0 commit comments

Comments
 (0)