Skip to content
Permalink
Browse files

Merge branch 'master' into tooltip

  • Loading branch information
jzaefferer committed Mar 27, 2010
2 parents f193314 + c49be0b commit a009595bd3d7c6992d438900672fdf98f5e728c3
@@ -579,7 +579,7 @@ function validTest( name ) {

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

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

return jsDump;
@@ -25,8 +25,7 @@

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

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

<div id="list1">
<a>There is one obvious advantage:</a>
<div>
<p>
You've seen it coming!
<br/>
Buy now and get nothing for free!
<br/>
Well, at least no free beer. Perhaps a bear, if you can afford it.
</p>
</div>
<a>Now that you've got...</a>
<div>
<p>
your bear, you have to admit it!
<br/>
No, we aren't selling bears.
</p>
<p>
We could talk about renting one.
</p>
</div>
<a>Rent one bear, ...</a>
<div>
<p>
get two for three beer.
</p>
<p>
And now, for something completely different.
</p>
</div>
<div>
<div id="list1" class="foo">
<a class="bar">There is one obvious advantage:</a>
<div style="" class="foo">
<p>
You've seen it coming!
<br/>
Buy now and get nothing for free!
<br/>
Well, at least no free beer. Perhaps a bear, if you can afford it.
</p>
</div>
<a class="bar">Now that you've got...</a>
<div style="" class="foo">
<p>
your bear, you have to admit it!
<br/>
No, we aren't selling bears.
</p>
<p>
We could talk about renting one.
</p>
</div>
<a class="bar">Rent one bear, ...</a>
<div style="" class="foo">
<p>
get two for three beer.
</p>
<p>
And now, for something completely different.
</p>
</div>
</div>
</div>

<div id="navigationWrapper">
@@ -40,21 +40,9 @@ test("init", function() {
});

test("destroy", function() {
$("<div></div>").appendTo('body').accordion().accordion("destroy").remove();
ok(true, '.accordion("destroy") called on element');

$([]).accordion().accordion("destroy").remove();
ok(true, '.accordion("destroy") called on empty collection');

$('<div></div>').accordion().accordion("destroy").remove();
ok(true, '.accordion("destroy") called on disconnected DOMElement');

$('<div></div>').accordion().accordion("destroy").accordion("foo").remove();
ok(true, 'arbitrary method called after destroy');

var expected = $('<div></div>').accordion(),
actual = expected.accordion('destroy');
equals(actual, expected, 'destroy is chainable');
var beforeHtml = $("#list1").parent().html();
var afterHtml = $("#list1").accordion().accordion("destroy").parent().html();
equal( afterHtml, beforeHtml );
});

test("enable", function() {
@@ -116,9 +116,9 @@ test("{ fillSpace: false }, default", function() {
test("{ fillSpace: true }", function() {
$("#navigationWrapper").height(500);
$('#navigation').accordion({ fillSpace: true });
equals( $('#navigation > li:eq(0) > ul').height(), 362 );
equals( $('#navigation > li:eq(1) > ul').height(), 362 );
equals( $('#navigation > li:eq(2) > ul').height(), 362 );
equals( $('#navigation > li:eq(0) > ul').height(), 446 );
equals( $('#navigation > li:eq(1) > ul').height(), 446 );
equals( $('#navigation > li:eq(2) > ul').height(), 446 );
});

test("{ header: '> li > :first-child,> :not(li):even' }, default", function() {
@@ -13,8 +13,7 @@ module("autocomplete: methods", {
test("destroy", function() {
var beforeHtml = $("#autocomplete").parent().html();
var afterHtml = $("#autocomplete").autocomplete().autocomplete("destroy").parent().html();
// TODO can't use same, as that would insert the markup unescaped into the test results, screwing up other tests
ok( beforeHtml == afterHtml );
equal( afterHtml, beforeHtml, "before/after html should be the same" );
})

var data = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
@@ -9,7 +9,7 @@ module("button: methods");
test("destroy", function() {
var beforeHtml = $("#button").parent().html();
var afterHtml = $("#button").button().button("destroy").parent().html();
same( beforeHtml, afterHtml );
equal( afterHtml, beforeHtml );
});

})(jQuery);
@@ -43,5 +43,9 @@ <h2 id="qunit-userAgent"></h2>

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

<div id="bug-5280" style="height: 30px; width: 201px;">
<div style="width: 50px; height: 10px;"></div>
</div>

</body>
</html>
@@ -330,4 +330,22 @@ test("collision: none, with offset", function() {
}, { top: -13, left: -12 }, "left top, negative offset");
});

//test('bug #5280: consistent results (avoid fractional values)', function() {
// var wrapper = $('#bug-5280'),
// elem = wrapper.children(),
// offset1 = elem.position({
// my: 'center',
// at: 'center',
// of: wrapper,
// collision: 'none'
// }).offset(),
// offset2 = elem.position({
// my: 'center',
// at: 'center',
// of: wrapper,
// collision: 'none'
// }).offset();
// same(offset1, offset2);
//});

})(jQuery);
@@ -3,45 +3,54 @@
*/
(function($) {

var el;

module( "slider: events" );

test( "start", function() {
ok( false, "missing test - untested code is broken code." );
});

test( "slide", function() {
ok( false, "missing test - untested code is broken code." );
});

//Specs from http://wiki.jqueryui.com/Slider#specs
//"change callback: triggers when the slider has stopped moving and has a new
// value (even if same as previous value), via mouse(mouseup) or keyboard(keyup)
// or value method/option"
test( "change", function() {
expect(8);
test( "mouse based interaction", function() {
expect(4);

var handle;
// Test mouseup at end of handle slide (mouse)
el = $( "<div></div>" )
var el = $( "<div></div>" )
.appendTo( "body" )
.slider({
start: function(event, ui) {
equals( event.originalEvent.type, "mousedown", "start triggered by mousedown" );
},
slide: function(event, ui) {
equals( event.originalEvent.type, "mousemove", "slider triggered by mousemove" );
},
stop: function(event, ui) {
equals( event.originalEvent.type, "mouseup", "stop triggered by mouseup" );
},
change: function(event, ui) {
ok( true, "change triggered by mouseup at end of handle slide (mouse)" );
equals( event.originalEvent.type, "mouseup", "change triggered by mouseup" );
}
});

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

reset();
});
test( "keyboard based interaction", function() {
expect(3);

// Test keyup at end of handle slide (keyboard)
el = $( "<div></div>" )
var el = $( "<div></div>" )
.appendTo( "body" )
.slider({
start: function(event, ui) {
equals( event.originalEvent.type, "keydown", "start triggered by keydown" );
},
slide: function(event, ui) {
ok( false, "Slider never triggered by keys" );
},
stop: function(event, ui) {
equals( event.originalEvent.type, "keyup", "stop triggered by keyup" );
},
change: function(event, ui) {
ok( true, "change triggered by keyup at end of handle slide (keyboard)" );
equals( event.originalEvent.type, "keyup", "change triggered by keyup" );
}
});

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

reset();
});
test( "programmatic event triggers", function() {
expect(6);

// Test value method
el = $( "<div></div>" )
var el = $( "<div></div>" )
.slider({
change: function(event, ui) {
ok( true, "change triggered by value method" );
@@ -94,8 +106,4 @@ test( "change", function() {

});

test( "stop", function() {
ok( false, "missing test - untested code is broken code." );
});

}( jQuery ) );
@@ -11,10 +11,6 @@ function handle() {

module("slider: options");

test("animate", function() {
ok(false, "missing test - untested code is broken code.");
});

test("max", function() {
el = $('<div></div>');

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

test("step", function() {
ok(false, "missing test - untested code is broken code.");
var el = $('<div></div>').slider({
step: 10
});
equals( el.slider("value"), 0 )
el.slider("value", 1);
equals( el.slider("value"), 10 );
el.slider("value", 10);
equals( el.slider("value"), 10 );
el.slider("value", 11);
equals( el.slider("value"), 20 );
el.slider('destroy');
});

test("value", function() {

0 comments on commit a009595

Please sign in to comment.
You can’t perform that action at this time.