initial checkin from subversion
This commit is contained in:
1007
server/node_modules/jquery/test/core.js
generated
vendored
Normal file
1007
server/node_modules/jquery/test/core.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
124
server/node_modules/jquery/test/css.js
generated
vendored
Normal file
124
server/node_modules/jquery/test/css.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
var testCase = require('nodeunit').testCase,
|
||||
static_document = require('fs').readFileSync('test/fixtures/css.html', 'utf8');
|
||||
|
||||
// need to be global as helpers access these variables
|
||||
window = document = jQuery = $ = null;
|
||||
|
||||
var helpers = require('./helpers/helper'),
|
||||
q = helpers.query_ids;
|
||||
|
||||
module.exports = testCase({
|
||||
setUp: function (callback) {
|
||||
jQuery = $ = helpers.recreate_doc(static_document);
|
||||
callback();
|
||||
},
|
||||
tearDown: function (callback) {
|
||||
// clean up
|
||||
callback();
|
||||
},
|
||||
"css(String|Hash)": function(test) {
|
||||
test.expect(18);
|
||||
|
||||
//test.equals( jQuery('#main').css("display"), 'block', 'Check for css property "display"');
|
||||
|
||||
test.ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible');
|
||||
jQuery('#nothiddendiv').css({display: 'none'});
|
||||
test.ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden');
|
||||
jQuery('#nothiddendiv').css({display: 'block'});
|
||||
test.ok( jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is visible');
|
||||
|
||||
var div = jQuery( "<div>" );
|
||||
|
||||
// These should be "auto" (or some better value)
|
||||
// temporarily provide "0px" for backwards compat
|
||||
test.equals( div.css("width"), "0px", "Width on disconnected node." );
|
||||
test.equals( div.css("height"), "0px", "Height on disconnected node." );
|
||||
|
||||
div.css({ width: 4, height: 4 });
|
||||
|
||||
test.equals( div.css("width"), "4px", "Width on disconnected node." );
|
||||
test.equals( div.css("height"), "4px", "Height on disconnected node." );
|
||||
|
||||
var div2 = jQuery( "<div style='display:none;'><input type='text' style='height:20px;'/><textarea style='height:20px;'/><div style='height:20px;'></div></div>").appendTo("body");
|
||||
|
||||
test.equals( div2.find("input").css("height"), "20px", "Height on hidden input." );
|
||||
test.equals( div2.find("textarea").css("height"), "20px", "Height on hidden textarea." );
|
||||
test.equals( div2.find("div").css("height"), "20px", "Height on hidden textarea." );
|
||||
|
||||
div2.remove();
|
||||
|
||||
// handle negative numbers by ignoring #1599, #4216
|
||||
jQuery('#nothiddendiv').css({ 'width': 1, 'height': 1 });
|
||||
|
||||
var width = parseFloat(jQuery('#nothiddendiv').css('width')), height = parseFloat(jQuery('#nothiddendiv').css('height'));
|
||||
jQuery('#nothiddendiv').css({ width: -1, height: -1 });
|
||||
//test.equals( parseFloat(jQuery('#nothiddendiv').css('width')), width, 'Test negative width ignored')
|
||||
//test.equals( parseFloat(jQuery('#nothiddendiv').css('height')), height, 'Test negative height ignored')
|
||||
|
||||
test.equals( jQuery('<div style="display: none;">').css('display'), 'none', 'Styles on disconnected nodes');
|
||||
|
||||
//jQuery('#floatTest').css('float', 'right');
|
||||
//test.equals( jQuery('#floatTest').css('float'), 'right', 'Modified CSS float using "float": Assert float is right');
|
||||
//jQuery('#floatTest').css({'font-size': '30px'});
|
||||
//test.equals( jQuery('#floatTest').css('font-size'), '30px', 'Modified CSS font-size: Assert font-size is 30px');
|
||||
|
||||
/*jQuery.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
|
||||
jQuery('#foo').css({opacity: n});
|
||||
test.equals( jQuery('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
|
||||
jQuery('#foo').css({opacity: parseFloat(n)});
|
||||
test.equals( jQuery('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
|
||||
});*/
|
||||
jQuery('#foo').css({opacity: ''});
|
||||
test.equals( jQuery('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
|
||||
|
||||
//test.equals( jQuery('#empty').css('opacity'), '0', "Assert opacity is accessible via filter property set in stylesheet in IE" );
|
||||
//jQuery('#empty').css({ opacity: '1' });
|
||||
//test.equals( jQuery('#empty').css('opacity'), '1', "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
|
||||
|
||||
var div = jQuery('#nothiddendiv'), child = jQuery('#nothiddendivchild');
|
||||
|
||||
//test.equals( parseInt(div.css("fontSize")), 16, "Verify fontSize px set." );
|
||||
//test.equals( parseInt(div.css("font-size")), 16, "Verify fontSize px set." );
|
||||
//test.equals( parseInt(child.css("fontSize")), 16, "Verify fontSize px set." );
|
||||
//test.equals( parseInt(child.css("font-size")), 16, "Verify fontSize px set." );
|
||||
|
||||
child.css("height", "100%");
|
||||
test.equals( child[0].style.height, "100%", "Make sure the height is being set correctly." );
|
||||
|
||||
child.attr("class", "em");
|
||||
//test.equals( parseInt(child.css("fontSize")), 32, "Verify fontSize em set." );
|
||||
|
||||
// Have to verify this as the result depends upon the browser's CSS
|
||||
// support for font-size percentages
|
||||
child.attr("class", "prct");
|
||||
var prctval = parseInt(child.css("fontSize")), checkval = 0;
|
||||
if ( prctval === 16 || prctval === 24 ) {
|
||||
checkval = prctval;
|
||||
}
|
||||
|
||||
//test.equals( prctval, checkval, "Verify fontSize % set." );
|
||||
|
||||
test.equals( typeof child.css("width"), "string", "Make sure that a string width is returned from css('width')." );
|
||||
|
||||
var old = child[0].style.height;
|
||||
|
||||
// Test NaN
|
||||
child.css("height", parseFloat("zoo"));
|
||||
test.equals( child[0].style.height, old, "Make sure height isn't changed on NaN." );
|
||||
|
||||
// Test null
|
||||
child.css("height", null);
|
||||
test.equals( child[0].style.height, old, "Make sure height isn't changed on null." );
|
||||
|
||||
old = child[0].style.fontSize;
|
||||
|
||||
// Test NaN
|
||||
child.css("font-size", parseFloat("zoo"));
|
||||
test.equals( child[0].style.fontSize, old, "Make sure font-size isn't changed on NaN." );
|
||||
|
||||
// Test null
|
||||
child.css("font-size", null);
|
||||
test.equals( child[0].style.fontSize, old, "Make sure font-size isn't changed on null." );
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
31
server/node_modules/jquery/test/fixtures/core.html
generated
vendored
Normal file
31
server/node_modules/jquery/test/fixtures/core.html
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>jQuery Test Suite</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/" class="GROUPS">Google Groups (Link)</a>.
|
||||
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<p id="first">Try them out:</p>
|
||||
<form id="form" action="formaction">
|
||||
<input id="input1" name="PWD" type="password" value="" />
|
||||
<input id="input2" name="T1" type="text" />
|
||||
</form>
|
||||
<item jid="2345" subscription="both" name="test val" gr:t="B" gr:w="41" gr:mc="161" gr:emc="2"/>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
3
server/node_modules/jquery/test/fixtures/css.css
generated
vendored
Normal file
3
server/node_modules/jquery/test/fixtures/css.css
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#nothiddendiv { font-size: 16px; }
|
||||
#nothiddendivchild.em { font-size: 2em; }
|
||||
#nothiddendivchild.prct { font-size: 150%; }
|
||||
42
server/node_modules/jquery/test/fixtures/css.html
generated
vendored
Normal file
42
server/node_modules/jquery/test/fixtures/css.html
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>jQuery Test Suite</title>
|
||||
<style type="text/css" media="screen">
|
||||
#nothiddendiv { font-size: 16px; }
|
||||
#nothiddendivchild.em { font-size: 2em; }
|
||||
#nothiddendivchild.prct { font-size: 150%; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body id="body">
|
||||
<!-- Test HTML -->
|
||||
<div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
|
||||
<div id="nothiddendivchild"></div>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/" class="GROUPS">Google Groups (Link)</a>.
|
||||
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<p id="first">Try them out:</p>
|
||||
<form id="form" action="formaction">
|
||||
<input name="PWD" type="password" value="" />
|
||||
<input name="T1" type="text" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
24
server/node_modules/jquery/test/helpers/helper.js
generated
vendored
Normal file
24
server/node_modules/jquery/test/helpers/helper.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Returns an array of elements with the given IDs, eg.
|
||||
* @example q("main", "foo", "bar")
|
||||
* @result [<div id="main">, <span id="foo">, <input id="bar">]
|
||||
*/
|
||||
var query_ids = function() {
|
||||
var r = [];
|
||||
|
||||
for ( var i = 0; i < arguments.length; i++ ) {
|
||||
r.push( document.getElementById( arguments[i] ) );
|
||||
}
|
||||
|
||||
return r;
|
||||
};
|
||||
|
||||
var recreate_doc = function(html) {
|
||||
document = require('jsdom').jsdom(html);
|
||||
window = document.createWindow();
|
||||
return require(process.cwd() + '/lib/node-jquery').create(window);
|
||||
};
|
||||
|
||||
|
||||
exports.query_ids = query_ids;
|
||||
exports.recreate_doc = recreate_doc;
|
||||
Reference in New Issue
Block a user