Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
// Browser globals
factory( jQuery );
}
})( function(){} );
} )( function() {} );
740 changes: 370 additions & 370 deletions tests/integration/collapsible/collapsible_core.js

Large diffs are not rendered by default.

114 changes: 57 additions & 57 deletions tests/integration/core/core_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,60 @@
* mobile core unit tests
*/

(function($){
var libName = "core",
scrollTimeout = 70, // TODO expose timing as an attribute
scrollStartEnabledTimeout = 150;

module(libName, {
setup: function() {
$( "<div id='scroll-testing' " +
"style='height: " + ( screen.height * 3 ) + "px'></div>").appendTo( "body" );
},

teardown: function(){
$("#scroll-testing").remove();
}
});

var scrollUp = function( pos ){
$( window ).scrollTop( screen.height );
deepEqual( $( window ).scrollTop() > 0, true,
"After setting scrollTop, it is " + $( window ).scrollTop() );
$.mobile.silentScroll(pos);
};

asyncTest( "silent scroll scrolls the page to the top by default", function(){
scrollUp();

setTimeout(function(){
deepEqual( $(window).scrollTop(), $.mobile.defaultHomeScroll,
"After parameterless silentScroll(), scrollTop is $.mobile.defaultHomescroll: " +
$.mobile.defaultHomeScroll );
start();
}, scrollTimeout);
});

asyncTest( "silent scroll scrolls the page to the passed y position", function(){
var pos = 10;
scrollUp(pos);

setTimeout(function(){
deepEqual($(window).scrollTop(), pos);
start();
}, scrollTimeout);
});

asyncTest( "scrolling marks scrollstart as disabled for 150 ms", function(){
$.event.special.scrollstart.enabled = true;
scrollUp();
ok(!$.event.special.scrollstart.enabled);

setTimeout(function(){
ok($.event.special.scrollstart.enabled);
start();
}, scrollStartEnabledTimeout);
});

//TODO test that silentScroll is called on window load
})(jQuery);
( function( $ ) {
var libName = "core",
scrollTimeout = 70, // TODO expose timing as an attribute
scrollStartEnabledTimeout = 150;

module( libName, {
setup: function() {
$( "<div id='scroll-testing' " +
"style='height: " + ( screen.height * 3 ) + "px'></div>" ).appendTo( "body" );
},

teardown: function() {
$( "#scroll-testing" ).remove();
}
} );

var scrollUp = function( pos ) {
$( window ).scrollTop( screen.height );
deepEqual( $( window ).scrollTop() > 0, true,
"After setting scrollTop, it is " + $( window ).scrollTop() );
$.mobile.silentScroll( pos );
};

asyncTest( "silent scroll scrolls the page to the top by default", function() {
scrollUp();

setTimeout( function() {
deepEqual( $( window ).scrollTop(), $.mobile.defaultHomeScroll,
"After parameterless silentScroll(), scrollTop is $.mobile.defaultHomescroll: " +
$.mobile.defaultHomeScroll );
start();
}, scrollTimeout );
} );

asyncTest( "silent scroll scrolls the page to the passed y position", function() {
var pos = 10;
scrollUp( pos );

setTimeout( function() {
deepEqual( $( window ).scrollTop(), pos );
start();
}, scrollTimeout );
} );

asyncTest( "scrolling marks scrollstart as disabled for 150 ms", function() {
$.event.special.scrollstart.enabled = true;
scrollUp();
ok( !$.event.special.scrollstart.enabled );

setTimeout( function() {
ok( $.event.special.scrollstart.enabled );
start();
}, scrollStartEnabledTimeout );
} );

//TODO test that silentScroll is called on window load
} )( jQuery );
35 changes: 19 additions & 16 deletions tests/integration/forms/forms_core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* mobile popup unit tests
*/
(function($){
( function( $ ) {

asyncTest( "Form resets correctly", function() {

Expand All @@ -20,7 +20,7 @@ asyncTest( "Form resets correctly", function() {
};

for ( arIdx in arrays ) {
for (idx in widgets[ arrays[ arIdx ] ] ) {
for ( idx in widgets[ arrays[ arIdx ] ] ) {
ret[ arrays[ arIdx ] ].push( widgets[ arrays[ arIdx ] ][ idx ].is( ":checked" ) );
}
}
Expand All @@ -32,7 +32,8 @@ asyncTest( "Form resets correctly", function() {
var id = el.attr( "id" ),
slider = el.next(),
buttonStyle = slider.children().attr( "style" ).split( ";" ),
styleItem, style = {};
styleItem,
style = {};

// Reconstruct the inline style of the object. The result will be stored in the variable "style"
for ( idx in buttonStyle ) {
Expand Down Expand Up @@ -60,7 +61,7 @@ asyncTest( "Form resets correctly", function() {
ok( wrapper.length === 1, prefix + id + " has a wrapper" );
ok( wrapper.hasClass( "ui-select" ), prefix + id + "'s wrapper has class ui-select" );
ok( anonySpan.length === 1, prefix + id + "'s wrapper contains a single span element as its first child" );
ok( anonySpan.text() === el.children("[value='" + el.val() + "']").text(), prefix + id + "'s text is identical to the text inside the selected <option> element" );
ok( anonySpan.text() === el.children( "[value='" + el.val() + "']" ).text(), prefix + id + "'s text is identical to the text inside the selected <option> element" );
}

function verifyFlipswitch( prefix, el, value ) {
Expand Down Expand Up @@ -155,9 +156,11 @@ asyncTest( "Form resets correctly", function() {
setTimeout( function() {
runTest( e.target, function() {
testComplete = true;
setTimeout( function() { $( "#goToStartPage" ).click(); } );
});
});
setTimeout( function() {
$( "#goToStartPage" ).click();
} );
} );
} );
} else if ( e.target.id === "startPage" ) {
if ( wentToTestPage ) {
if ( testComplete ) {
Expand All @@ -168,18 +171,18 @@ asyncTest( "Form resets correctly", function() {
setTimeout( maybeGoToTestPage );
}
}
}
}

$( document ).bind( "pageshow", handlePageShow );

setTimeout( maybeGoToTestPage );
});
} );

asyncTest( "form action is honored", function() {

expect( 1 );

$.testHelper.pageSequence([
$.testHelper.pageSequence( [
function() {
$( "#default-submit" ).click();
},
Expand All @@ -190,14 +193,14 @@ asyncTest( "form action is honored", function() {
},

start
]);
});
] );
} );

asyncTest( "button's formaction attribute is honored", function() {

expect( 1 );

$.testHelper.pageSequence([
$.testHelper.pageSequence( [
function() {
$( "#formaction-submit" ).click();
},
Expand All @@ -208,7 +211,7 @@ asyncTest( "button's formaction attribute is honored", function() {
},

start
]);
});
] );
} );

})( jQuery );
} )( jQuery );
Loading