code stringlengths 1 2.08M | language stringclasses 1
value |
|---|---|
/*
* mobile event unit tests
*/
(function($){
var libName = "jquery.mobile.event.js",
absFn = Math.abs,
originalEventFn = $.Event.prototype.originalEvent,
preventDefaultFn = $.Event.prototype.preventDefault,
events = ("touchstart touchmove touchend orientationchange tap taphold " +
"swipe swipel... | JavaScript |
/*
* mobile dialog unit tests
*/
(function($){
module('jquery.mobile.fieldContain.js');
test( "Field container contains appropriate css styles", function(){
ok($('#test-fieldcontain').hasClass('ui-field-contain ui-body ui-br'), 'A fieldcontain element must contain styles "ui-field-contain ui-body ui-br"');
});... | JavaScript |
/*
* mobile buttonMarkup tests
*/
(function($){
module("jquery.mobile.buttonMarkup.js");
test( "control group buttons should be enhanced inside a footer", function(){
var group, linkCount;
group = $("#control-group-footer");
linkCount = group.find( "a" ).length;
same( group.find("a.ui-btn").length, linkC... | JavaScript |
/*
* mobile listview unit tests
*/
// TODO split out into seperate test files
(function( $ ){
module( "Collapsible section", {});
asyncTest( "The page should enhanced correctly", function(){
$.testHelper.pageSequence([
function(){
$.testHelper.openPage( "#basic-collapsible-test" );
},
function() {... | JavaScript |
// load testswarm agent
(function() {
var url = window.location.search;
url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
if ( !url || url.indexOf("http") !== 0 ) {
return;
}
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "... | JavaScript |
/*
* mobile media unit tests
*/
(function($){
var cssFn = $.fn.css,
widthFn = $.fn.width;
// make sure original definitions are reset
module('jquery.mobile.media.js', {
setup: function(){
$(document).trigger('mobileinit.htmlclass');
},
teardown: function(){
$.fn.css = cssFn;
$.fn.width = widthF... | JavaScript |
/*
* mobile page unit tests
*/
(function($){
var libName = 'jquery.mobile.page.sections.js',
themedefault = $.mobile.page.prototype.options.theme,
keepNative = $.mobile.page.prototype.options.keepNative;
module(libName, {
setup: function() {
$.mobile.page.prototype.options.keepNative = keepNative;
}
})... | JavaScript |
$(function() {
var Runner = function( ) {
var self = this;
$.extend( self, {
frame: window.frames[ "testFrame" ],
testTimeout: 3 * 60 * 1000,
$frameElem: $( "#testFrame" ),
assertionResultPrefix: "assertion result for test:",
onTimeout: QUnit.start,
onFrameLoad: function() {
// establis... | JavaScript |
/*
* mobile init tests
*/
(function($){
test( "page element is generated when not present in initial markup", function(){
ok( $( ".ui-page" ).length, 1 );
});
})(jQuery);
| JavaScript |
/*
* mobile init tests
*/
(function($){
var mobilePage = undefined,
libName = 'jquery.mobile.init.js',
coreLib = 'jquery.mobile.core.js',
extendFn = $.extend,
setGradeA = function(value) { $.mobile.gradeA = function(){ return value; }; },
reloadCoreNSandInit = function(){
$.testHelper.reloadLib(co... | JavaScript |
/*
* mobile dialog unit tests
*/
(function($) {
module( "jquery.mobile.dialog.js", {
setup: function() {
$.mobile.page.prototype.options.contentTheme = "d";
}
});
asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() {
expect( 2 );
$.testHelper.pageSequence([
... | JavaScript |
//set namespace for unit test markp
$( document ).bind( "mobileinit", function(){
$.mobile.ns = "nstest-";
}); | JavaScript |
/*
* mobile core unit tests
*/
(function($){
var libName = "jquery.mobile.core.js",
setGradeA = function(value, version) {
$.support.mediaquery = value;
$.mobile.browser.ie = version;
},
extendFn = $.extend;
module(libName, {
setup: function(){
// NOTE reset for gradeA tests
$('html').rem... | JavaScript |
/*
* mobile core unit tests
*/
(function($){
var libName = "jquery.mobile.core.js",
scrollTimeout = 20, // TODO expose timing as an attribute
scrollStartEnabledTimeout = 150;
module(libName, {
setup: function(){
$("<div id='scroll-testing' style='height: 1000px'></div>").appendTo("body");
},
teard... | JavaScript |
/*
* mobile support unit tests
*/
$.testHelper.excludeFileProtocol(function(){
var prependToFn = $.fn.prependTo,
libName = "jquery.mobile.support.js";
module(libName, {
teardown: function(){
//NOTE undo any mocking
$.fn.prependTo = prependToFn;
}
});
// NOTE following two tests have debatable valu... | JavaScript |
/*
* mobile navigation unit tests
*/
(function($){
var siteDirectory = location.pathname.replace(/[^/]+$/, "");
module('jquery.mobile.navigation.js', {
setup: function(){
if ( location.hash ) {
stop();
$(document).one("pagechange", function() {
start();
} );
location.hash = "";
}
}
... | JavaScript |
/*
* mobile navigation path unit tests
*/
(function($){
var url = $.mobile.path.parseUrl( location.href ),
home = location.href.replace( url.domain, "" );
var testPageLoad = function(testPageAnchorSelector, expectedTextValue){
expect( 2 );
$.testHelper.pageSequence([
function(){
// reset before each ... | JavaScript |
(function($) {
asyncTest( "dialog ui-state should be part of the hash", function(){
$.testHelper.sequence([
function() {
// open the test page
$.mobile.activePage.find( "a" ).click();
},
function() {
// verify that the hash contains the dialogHashKey
ok( location.hash.search($.mobile.dialog... | JavaScript |
/*
* mobile navigation base tag unit tests
*/
(function($){
var baseDir = $.mobile.path.parseUrl($("base").attr("href")).directory,
contentDir = $.mobile.path.makePathAbsolute("../content/", baseDir);
module('jquery.mobile.navigation.js - base tag', {
setup: function(){
if ( location.hash ) {
stop();
... | JavaScript |
/*
* mobile navigation unit tests
*/
(function($){
// TODO move siteDirectory over to the nav path helper
var changePageFn = $.mobile.changePage,
originalTitle = document.title,
originalLinkBinding = $.mobile.linkBindingEnabled,
siteDirectory = location.pathname.replace( /[^/]+$/, "" ),
home = $.mobile.path... | JavaScript |
/*
* mobile navigation unit tests
*/
(function($){
var perspective = "viewport-flip",
transitioning = "ui-mobile-viewport-transitioning",
animationCompleteFn = $.fn.animationComplete,
//TODO centralize class names?
transitionTypes = "in out fade slide flip reverse pop",
isTransitioning = function(pa... | JavaScript |
/*
* mobile widget unit tests
*/
(function($){
module('jquery.mobile.widget.js');
test( "getting data from creation options", function(){
var expected = "bizzle";
$.mobile.widget.prototype.options = { "fooBar" : true };
$.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">");
same($.m... | JavaScript |
/*
* mobile widget unit tests
*/
(function($){
var widgetInitialized = false;
module( 'jquery.mobile.widget.js' );
$( "#foo" ).live( 'pageinit', function(){
// ordering sensitive here, the value has to be set after the call
// so that if the widget factory says that its not yet initialized,
// which is an ... | JavaScript |
/*
* mobile checkboxradio unit tests
*/
(function($){
module( 'jquery.mobile.forms.checkboxradio.js' );
test( "widget can be disabled and enabled", function(){
var input = $( "#checkbox-1" ),
button = input.parent().find( ".ui-btn" );
input.checkboxradio( "disable" );
input.checkboxradio( "enable" );
o... | JavaScript |
/*
* mobile slider unit tests
*/
(function($){
$.mobile.page.prototype.options.keepNative = "input.should-be-native";
// not testing the positive case here since's it's obviously tested elsewhere
test( "slider elements in the keepNative set shouldn't be enhanced", function() {
same( $("input.should-be-native").... | JavaScript |
/*
* mobile slider unit tests
*/
(function($){
var onChangeCnt = 0;
window.onChangeCounter = function() {
onChangeCnt++;
}
module('jquery.mobile.slider.js');
var keypressTest = function(opts){
var slider = $(opts.selector),
val = window.parseFloat(slider.val()),
handle = slider.siblings('.ui-slid... | JavaScript |
/*
* degradeInputs unit tests
*/
(function($){
module('jquery.mobile.slider.js');
test('keepNative elements should not be degraded', function() {
same($('input#not-to-be-degraded').attr("type"), "range");
});
test('should degrade input type to a different type, as specified in page options', ... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
var resetHash;
resetHash = function(timeout){
$.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" : "#default" );
};
// https://github.com/jquery/jquery-mobile/issues/2181
asyncTest( "dialog sized select should alter the value of its parent sele... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
module("jquery.mobile.forms.select native");
test( "native menu selections alter the button text", function(){
var select = $( "#native-select-choice-few" ), setAndCheck;
setAndCheck = function(key){
var text;
select.val( key ).selectmenu( 'refresh' )... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
var libName = "jquery.mobile.forms.select.js",
originalDefaultDialogTrans = $.mobile.defaultDialogTransition,
originalDefTransitionHandler = $.mobile.defaultTransitionHandler,
originalGetEncodedText = $.fn.getEncodedText,
resetHash, closeDialog;
resetHash = f... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
var libName = "jquery.mobile.forms.select.js";
$(document).bind('mobileinit', function(){
$.mobile.selectmenu.prototype.options.nativeMenu = false;
});
module(libName,{
setup: function(){
$.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" :... | JavaScript |
/*
* mobile checkboxradio unit tests
*/
(function($){
module( 'vertical controlgroup, no refresh' , {
setup: function() {
this.vcontrolgroup = $( "#vertical-controlgroup" );
}
});
test( "vertical controlgroup classes", function() {
var buttons = this.vcontrolgroup.find( ".ui-btn" ),
middlebuttons = bu... | JavaScript |
(function(Perf) {
var $listPage = $( "#list-page" ), firstCounter = 0;
Perf.setCurrentRev();
Perf.pageLoadStart = Date.now();
$listPage.live( "pagebeforecreate", function() {
if( firstCounter == 0 ) {
Perf.pageCreateStart = Date.now();
firstCounter++;
}
});
$listPage.live( "pageinit", function( event... | JavaScript |
window.Perf = (function($, Perf) {
$.extend(Perf, {
reportUrl: 'stats/',
revUrl: 'stats/rev.php',
// should be defined before report or poll are run
currentRev: undefined,
report: function( data, after ) {
$.extend(data, {
pathname: location.pathname,
agent: this.agent(),
agentFull: window.n... | JavaScript |
(function($) {
// TODO this is entire thing sucks
$(function() {
var searchMap = (function() {
var searchSplit, searchMap = {};
if ( !location.search ){
return searchMap;
}
searchSplit = location.search.replace(/^\?/, "").split( /&|;/ );
for( var i = 0; i < searchSplit.length; i++ ) {
var ... | JavaScript |
/*
* mobile support unit tests
*/
(function( $ ) {
$.testHelper = {
excludeFileProtocol: function(callback){
var message = "Tests require script reload and cannot be run via file: protocol";
if (location.protocol == "file:") {
test(message, function(){
ok(false, message);
});
} else {
c... | JavaScript |
//quick & dirty theme switcher, written to potentially work as a bookmarklet
(function($){
$.themeswitcher = function(){
if( $('[data-'+ $.mobile.ns +'-url=themeswitcher]').length ){ return; }
var themesDir = 'http://jquerymobile.com/test/css/themes/',
themes = ['default','valencia'],
currentPage = $.mobile.... | JavaScript |
//thx @elroyjetson for the code example
// When map page opens get location and display map
$('.page-map').live("pagecreate", function() {
//boston :)
var lat = 42.35843,
lng = -71.059773;
//try to get GPS coords
if( navigator.geolocation ) {
//redirect function for successful location
function gpsS... | JavaScript |
/*
* jQuery Mobile Framework : scrollview plugin
* Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change
*/
(function($,window,document,undefined){
jQuery.wid... | JavaScript |
function ResizePageContentHeight(page) {
var $page = $(page),
$content = $page.children( ".ui-content" ),
hh = $page.children( ".ui-header" ).outerHeight() || 0,
fh = $page.children( ".ui-footer" ).outerHeight() || 0,
pt = parseFloat($content.css( "padding-top" )),
pb = parseFloat($content.css( "padding-bott... | JavaScript |
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
... | JavaScript |
/*
* Copy of http://github.com/nje/jquery-tmpl/raw/master/jquery.tmpl.js at f827fb68417bc14ab9f6ae889421d5fea4cb2859
* jQuery Templating Plugin
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function( jQuery, undefined ){
var oldManip = jQuery.fn.domManip, tmplItmAtt = "... | JavaScript |
$(function() {
var symbols = {
"USD": "$",
"EUR": "€",
"GBP": "£",
"Miles": "m",
"Kilometer": "km",
"inch": "\"",
"centimeter": "cm"
};
function list() {
var ul = $( "#conversions" ).empty(),
ulEdit = $( "#edit-conversions" ).empty();
$.each( all, function( index, conversion ) {
... | JavaScript |
(function() {
var defaults = [
{
type: "currency",
from: "USD",
to: "EUR"
},
{
type: "currency",
from: "GBP",
to: "EUR"
}
// TODO add back in as defaults once its possible to add other conversions, not just currencies
/*,
{
type: "distance",
from: "Miles",
to: "Kilometer",
rate: 1.609344
},... | JavaScript |
/*
* StringBuffer class
*/
function StringBuffer() {
this.buffer = [];
}
StringBuffer.prototype.append = function append (string) {
this.buffer.push(string);
return this;
};
StringBuffer.prototype.toString = function toString () {
return this.buffer.join("");
};
/*
* Strip html tags
*/
function ... | JavaScript |
/*!
* jQuery Mobile v1.0b2
* http://jquerymobile.com/
*
* Copyright 2010, jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
/*!
* jQuery UI Widget @VERSION
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Ver... | JavaScript |
//quick view source in new window links
$.fn.addSourceLink = function(style){
return $(this).each(function(){
var link = $('<a href="#" data-'+ $.mobile.ns +'inline="true">View Source</a>'),
src = src = $('<div></div>').append( $(this).clone() ).html(),
page = $( "<div data-"+ $.mobile.ns +"role='dialog' data... | JavaScript |
//set up the theme switcher on the homepage
$('div').live('pagecreate',function(event){
if( !$(this).is('.ui-dialog')){
var appendEl = $(this).find('.ui-footer:last');
if( !appendEl.length ){
appendEl = $(this).find('.ui-content');
}
if( appendEl.is("[data-position]") ){
return;
}
$('<a hre... | JavaScript |
/*
* mobile button unit tests
*/
(function($){
$.mobile.page.prototype.options.keepNative = "button.should-be-native";
test( "button elements in the keepNative set shouldn't be enhanced", function() {
same( $("button.should-be-native").siblings("div.ui-slider").length, 0 );
});
test( "button elements should b... | JavaScript |
/*
* mobile page unit tests
*/
(function($){
var libName = 'jquery.mobile.page.js';
module(libName);
test( "nested header anchors aren't altered", function(){
ok(!$('.ui-header > div > a').hasClass('ui-btn'));
});
test( "nested footer anchors aren't altered", function(){
ok(!$('.ui-footer > div > a').hasC... | JavaScript |
/*
* mobile textinput unit tests
*/
(function($){
module( "jquery.mobile.forms.textinput.js" );
test( "inputs without type specified are enhanced", function(){
ok( $( "#typeless-input" ).hasClass( "ui-input-text" ) );
});
$.mobile.page.prototype.options.keepNative = "textarea.should-be-native";
// not testi... | JavaScript |
(function($) {
asyncTest( "nested pages hash key is always in the hash on default page with no id (replaceState) ", function(){
$.testHelper.pageSequence([
function(){
// Click on the link of the third li element
$('.ui-page-active li:eq(2) a:eq(0)').click();
},
function(){
ok( location.hash.se... | JavaScript |
/*
* mobile listview unit tests
*/
// TODO split out into seperate test files
(function($){
var home = $.mobile.path.parseUrl( location.href ).pathname;
$.mobile.defaultTransition = "none";
module( "Basic Linked list", {
setup: function(){
$.testHelper.openPage( "#basic-linked-test" );
}
});
asyncTes... | JavaScript |
/*
* mobile event unit tests
*/
(function($){
var libName = "jquery.mobile.event.js",
absFn = Math.abs,
originalEventFn = $.Event.prototype.originalEvent,
preventDefaultFn = $.Event.prototype.preventDefault,
events = ("touchstart touchmove touchend orientationchange tap taphold " +
"swipe swipel... | JavaScript |
/*
* mobile dialog unit tests
*/
(function($){
module('jquery.mobile.fieldContain.js');
test( "Field container contains appropriate css styles", function(){
ok($('#test-fieldcontain').hasClass('ui-field-contain ui-body ui-br'), 'A fieldcontain element must contain styles "ui-field-contain ui-body ui-br"');
});... | JavaScript |
/*
* mobile buttonMarkup tests
*/
(function($){
module("jquery.mobile.buttonMarkup.js");
test( "control group buttons should be enhanced inside a footer", function(){
var group, linkCount;
group = $("#control-group-footer");
linkCount = group.find( "a" ).length;
same( group.find("a.ui-btn").length, linkC... | JavaScript |
/*
* mobile listview unit tests
*/
// TODO split out into seperate test files
(function( $ ){
module( "Collapsible section", {});
asyncTest( "The page should enhanced correctly", function(){
$.testHelper.pageSequence([
function(){
$.testHelper.openPage( "#basic-collapsible-test" );
},
function() {... | JavaScript |
// load testswarm agent
(function() {
var url = window.location.search;
url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
if ( !url || url.indexOf("http") !== 0 ) {
return;
}
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "... | JavaScript |
/*
* mobile media unit tests
*/
(function($){
var cssFn = $.fn.css,
widthFn = $.fn.width;
// make sure original definitions are reset
module('jquery.mobile.media.js', {
setup: function(){
$(document).trigger('mobileinit.htmlclass');
},
teardown: function(){
$.fn.css = cssFn;
$.fn.width = widthF... | JavaScript |
/*
* mobile page unit tests
*/
(function($){
var libName = 'jquery.mobile.page.sections.js',
themedefault = $.mobile.page.prototype.options.theme,
keepNative = $.mobile.page.prototype.options.keepNative;
module(libName, {
setup: function() {
$.mobile.page.prototype.options.keepNative = keepNative;
}
})... | JavaScript |
$(function() {
var Runner = function( ) {
var self = this;
$.extend( self, {
frame: window.frames[ "testFrame" ],
testTimeout: 3 * 60 * 1000,
$frameElem: $( "#testFrame" ),
assertionResultPrefix: "assertion result for test:",
onTimeout: QUnit.start,
onFrameLoad: function() {
// establis... | JavaScript |
/*
* mobile init tests
*/
(function($){
test( "page element is generated when not present in initial markup", function(){
ok( $( ".ui-page" ).length, 1 );
});
})(jQuery);
| JavaScript |
/*
* mobile init tests
*/
(function($){
var mobilePage = undefined,
libName = 'jquery.mobile.init.js',
coreLib = 'jquery.mobile.core.js',
extendFn = $.extend,
setGradeA = function(value) { $.mobile.gradeA = function(){ return value; }; },
reloadCoreNSandInit = function(){
$.testHelper.reloadLib(co... | JavaScript |
/*
* mobile dialog unit tests
*/
(function($) {
module( "jquery.mobile.dialog.js", {
setup: function() {
$.mobile.page.prototype.options.contentTheme = "d";
}
});
asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() {
expect( 2 );
$.testHelper.pageSequence([
... | JavaScript |
//set namespace for unit test markp
$( document ).bind( "mobileinit", function(){
$.mobile.ns = "nstest-";
}); | JavaScript |
/*
* mobile core unit tests
*/
(function($){
var libName = "jquery.mobile.core.js",
setGradeA = function(value, version) {
$.support.mediaquery = value;
$.mobile.browser.ie = version;
},
extendFn = $.extend;
module(libName, {
setup: function(){
// NOTE reset for gradeA tests
$('html').rem... | JavaScript |
/*
* mobile core unit tests
*/
(function($){
var libName = "jquery.mobile.core.js",
scrollTimeout = 20, // TODO expose timing as an attribute
scrollStartEnabledTimeout = 150;
module(libName, {
setup: function(){
$("<div id='scroll-testing' style='height: 1000px'></div>").appendTo("body");
},
teard... | JavaScript |
/*
* mobile support unit tests
*/
$.testHelper.excludeFileProtocol(function(){
var prependToFn = $.fn.prependTo,
libName = "jquery.mobile.support.js";
module(libName, {
teardown: function(){
//NOTE undo any mocking
$.fn.prependTo = prependToFn;
}
});
// NOTE following two tests have debatable valu... | JavaScript |
/*
* mobile navigation unit tests
*/
(function($){
var siteDirectory = location.pathname.replace(/[^/]+$/, "");
module('jquery.mobile.navigation.js', {
setup: function(){
if ( location.hash ) {
stop();
$(document).one("pagechange", function() {
start();
} );
location.hash = "";
}
}
... | JavaScript |
/*
* mobile navigation path unit tests
*/
(function($){
var url = $.mobile.path.parseUrl( location.href ),
home = location.href.replace( url.domain, "" );
var testPageLoad = function(testPageAnchorSelector, expectedTextValue){
expect( 2 );
$.testHelper.pageSequence([
function(){
// reset before each ... | JavaScript |
(function($) {
asyncTest( "dialog ui-state should be part of the hash", function(){
$.testHelper.sequence([
function() {
// open the test page
$.mobile.activePage.find( "a" ).click();
},
function() {
// verify that the hash contains the dialogHashKey
ok( location.hash.search($.mobile.dialog... | JavaScript |
/*
* mobile navigation base tag unit tests
*/
(function($){
var baseDir = $.mobile.path.parseUrl($("base").attr("href")).directory,
contentDir = $.mobile.path.makePathAbsolute("../content/", baseDir);
module('jquery.mobile.navigation.js - base tag', {
setup: function(){
if ( location.hash ) {
stop();
... | JavaScript |
/*
* mobile navigation unit tests
*/
(function($){
// TODO move siteDirectory over to the nav path helper
var changePageFn = $.mobile.changePage,
originalTitle = document.title,
originalLinkBinding = $.mobile.linkBindingEnabled,
siteDirectory = location.pathname.replace( /[^/]+$/, "" ),
home = $.mobile.path... | JavaScript |
/*
* mobile navigation unit tests
*/
(function($){
var perspective = "viewport-flip",
transitioning = "ui-mobile-viewport-transitioning",
animationCompleteFn = $.fn.animationComplete,
//TODO centralize class names?
transitionTypes = "in out fade slide flip reverse pop",
isTransitioning = function(pa... | JavaScript |
/*
* mobile widget unit tests
*/
(function($){
module('jquery.mobile.widget.js');
test( "getting data from creation options", function(){
var expected = "bizzle";
$.mobile.widget.prototype.options = { "fooBar" : true };
$.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">");
same($.m... | JavaScript |
/*
* mobile widget unit tests
*/
(function($){
var widgetInitialized = false;
module( 'jquery.mobile.widget.js' );
$( "#foo" ).live( 'pageinit', function(){
// ordering sensitive here, the value has to be set after the call
// so that if the widget factory says that its not yet initialized,
// which is an ... | JavaScript |
/*
* mobile checkboxradio unit tests
*/
(function($){
module( 'jquery.mobile.forms.checkboxradio.js' );
test( "widget can be disabled and enabled", function(){
var input = $( "#checkbox-1" ),
button = input.parent().find( ".ui-btn" );
input.checkboxradio( "disable" );
input.checkboxradio( "enable" );
o... | JavaScript |
/*
* mobile slider unit tests
*/
(function($){
$.mobile.page.prototype.options.keepNative = "input.should-be-native";
// not testing the positive case here since's it's obviously tested elsewhere
test( "slider elements in the keepNative set shouldn't be enhanced", function() {
same( $("input.should-be-native").... | JavaScript |
/*
* mobile slider unit tests
*/
(function($){
var onChangeCnt = 0;
window.onChangeCounter = function() {
onChangeCnt++;
}
module('jquery.mobile.slider.js');
var keypressTest = function(opts){
var slider = $(opts.selector),
val = window.parseFloat(slider.val()),
handle = slider.siblings('.ui-slid... | JavaScript |
/*
* degradeInputs unit tests
*/
(function($){
module('jquery.mobile.slider.js');
test('keepNative elements should not be degraded', function() {
same($('input#not-to-be-degraded').attr("type"), "range");
});
test('should degrade input type to a different type, as specified in page options', ... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
var resetHash;
resetHash = function(timeout){
$.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" : "#default" );
};
// https://github.com/jquery/jquery-mobile/issues/2181
asyncTest( "dialog sized select should alter the value of its parent sele... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
module("jquery.mobile.forms.select native");
test( "native menu selections alter the button text", function(){
var select = $( "#native-select-choice-few" ), setAndCheck;
setAndCheck = function(key){
var text;
select.val( key ).selectmenu( 'refresh' )... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
var libName = "jquery.mobile.forms.select.js",
originalDefaultDialogTrans = $.mobile.defaultDialogTransition,
originalDefTransitionHandler = $.mobile.defaultTransitionHandler,
originalGetEncodedText = $.fn.getEncodedText,
resetHash, closeDialog;
resetHash = f... | JavaScript |
/*
* mobile select unit tests
*/
(function($){
var libName = "jquery.mobile.forms.select.js";
$(document).bind('mobileinit', function(){
$.mobile.selectmenu.prototype.options.nativeMenu = false;
});
module(libName,{
setup: function(){
$.testHelper.openPage( location.hash.indexOf("#default") >= 0 ? "#" :... | JavaScript |
/*
* mobile checkboxradio unit tests
*/
(function($){
module( 'vertical controlgroup, no refresh' , {
setup: function() {
this.vcontrolgroup = $( "#vertical-controlgroup" );
}
});
test( "vertical controlgroup classes", function() {
var buttons = this.vcontrolgroup.find( ".ui-btn" ),
middlebuttons = bu... | JavaScript |
(function(Perf) {
var $listPage = $( "#list-page" ), firstCounter = 0;
Perf.setCurrentRev();
Perf.pageLoadStart = Date.now();
$listPage.live( "pagebeforecreate", function() {
if( firstCounter == 0 ) {
Perf.pageCreateStart = Date.now();
firstCounter++;
}
});
$listPage.live( "pageinit", function( event... | JavaScript |
window.Perf = (function($, Perf) {
$.extend(Perf, {
reportUrl: 'stats/',
revUrl: 'stats/rev.php',
// should be defined before report or poll are run
currentRev: undefined,
report: function( data, after ) {
$.extend(data, {
pathname: location.pathname,
agent: this.agent(),
agentFull: window.n... | JavaScript |
(function($) {
// TODO this is entire thing sucks
$(function() {
var searchMap = (function() {
var searchSplit, searchMap = {};
if ( !location.search ){
return searchMap;
}
searchSplit = location.search.replace(/^\?/, "").split( /&|;/ );
for( var i = 0; i < searchSplit.length; i++ ) {
var ... | JavaScript |
/*
* mobile support unit tests
*/
(function( $ ) {
$.testHelper = {
excludeFileProtocol: function(callback){
var message = "Tests require script reload and cannot be run via file: protocol";
if (location.protocol == "file:") {
test(message, function(){
ok(false, message);
});
} else {
c... | JavaScript |
//quick & dirty theme switcher, written to potentially work as a bookmarklet
(function($){
$.themeswitcher = function(){
if( $('[data-'+ $.mobile.ns +'-url=themeswitcher]').length ){ return; }
var themesDir = 'http://jquerymobile.com/test/css/themes/',
themes = ['default','valencia'],
currentPage = $.mobile.... | JavaScript |
//thx @elroyjetson for the code example
// When map page opens get location and display map
$('.page-map').live("pagecreate", function() {
//boston :)
var lat = 42.35843,
lng = -71.059773;
//try to get GPS coords
if( navigator.geolocation ) {
//redirect function for successful location
function gpsS... | JavaScript |
/*
* jQuery Mobile Framework : scrollview plugin
* Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change
*/
(function($,window,document,undefined){
jQuery.wid... | JavaScript |
function ResizePageContentHeight(page) {
var $page = $(page),
$content = $page.children( ".ui-content" ),
hh = $page.children( ".ui-header" ).outerHeight() || 0,
fh = $page.children( ".ui-footer" ).outerHeight() || 0,
pt = parseFloat($content.css( "padding-top" )),
pb = parseFloat($content.css( "padding-bott... | JavaScript |
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
... | JavaScript |
/*
* Copy of http://github.com/nje/jquery-tmpl/raw/master/jquery.tmpl.js at f827fb68417bc14ab9f6ae889421d5fea4cb2859
* jQuery Templating Plugin
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function( jQuery, undefined ){
var oldManip = jQuery.fn.domManip, tmplItmAtt = "... | JavaScript |
$(function() {
var symbols = {
"USD": "$",
"EUR": "€",
"GBP": "£",
"Miles": "m",
"Kilometer": "km",
"inch": "\"",
"centimeter": "cm"
};
function list() {
var ul = $( "#conversions" ).empty(),
ulEdit = $( "#edit-conversions" ).empty();
$.each( all, function( index, conversion ) {
... | JavaScript |
(function() {
var defaults = [
{
type: "currency",
from: "USD",
to: "EUR"
},
{
type: "currency",
from: "GBP",
to: "EUR"
}
// TODO add back in as defaults once its possible to add other conversions, not just currencies
/*,
{
type: "distance",
from: "Miles",
to: "Kilometer",
rate: 1.609344
},... | JavaScript |
{
"data":{
"current_condition":[
{
"cloudcover":"50",
"humidity":"71",
"observation_time":"03:28 PM",
"precipMM":"0.5",
"pressure":"998",
"temp_C":"8",
"temp_F":"46",
"visibility":"10",
... | JavaScript |
http:// www.worldweatheronline.com/feed/search.ashx?key=216f120440170120131803&format=json&query=Rus
{
"search_api":{
"result":[
{
"areaName":[
{
"value":"Onitewa"
}
],
"country":[
{
... | JavaScript |
if(typeof Object.create!=="function"){
Object.create=function(o){
function F(){
};
F.prototype=o;
return new F();
};
}
var ua={toString:function(){
return navigator.userAgent;
},test:function(s){
return this.toString().toLowerCase().indexOf(s.toLowerCase())>-1;
}};
ua.version=(ua.toString().toLowerCase().match(/[\s\S]+... | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.