Modified example for css(String) as proposed in the list (concerning camlCase for dashed properties like font-weight); Modified test to cache test fixture instead of reloading it, should make the test suite run faster
This commit is contained in:
parent
00e6e81f94
commit
b5220adbbc
|
@ -1,18 +1,13 @@
|
||||||
var queue = [];
|
var queue = [];
|
||||||
var blocking = false;
|
var blocking = false;
|
||||||
|
var fixture;
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
synchronize(function() {
|
if(fixture) {
|
||||||
blocking = true;
|
$("#main").html(fixture);
|
||||||
$.get('index.html', function(content) {
|
} else {
|
||||||
var div = $(document.createElement('div')).html(content)
|
fixture = $("#main").html();
|
||||||
// search for main div
|
}
|
||||||
.find('[@id=main]').html();
|
|
||||||
$('#main').html(div);
|
|
||||||
blocking = false;
|
|
||||||
process();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function synchronize(callback) {
|
function synchronize(callback) {
|
||||||
|
@ -31,10 +26,11 @@ function process() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTests(files) {
|
function runTests(files) {
|
||||||
|
var fixture = null;
|
||||||
|
reset();
|
||||||
var startTime = new Date();
|
var startTime = new Date();
|
||||||
for( var i=0; i < files.length; i++) {
|
for( var i=0; i < files.length; i++) {
|
||||||
runTest( files, i );
|
runTest( files, i );
|
||||||
reset();
|
|
||||||
}
|
}
|
||||||
synchronize(function() {
|
synchronize(function() {
|
||||||
var runTime = new Date() - startTime;
|
var runTime = new Date() - startTime;
|
||||||
|
@ -91,6 +87,7 @@ function runTest( files, num ) {
|
||||||
document.getElementById("tests").appendChild( li );
|
document.getElementById("tests").appendChild( li );
|
||||||
|
|
||||||
Test = [];
|
Test = [];
|
||||||
|
reset();
|
||||||
blocking = false;
|
blocking = false;
|
||||||
process();
|
process();
|
||||||
});
|
});
|
||||||
|
|
13
src/jquery/jquery.js
vendored
13
src/jquery/jquery.js
vendored
|
@ -466,6 +466,17 @@ jQuery.fn = jQuery.prototype = {
|
||||||
* @example $("p").css("color");
|
* @example $("p").css("color");
|
||||||
* @before <p style="color:red;">Test Paragraph.</p>
|
* @before <p style="color:red;">Test Paragraph.</p>
|
||||||
* @result red
|
* @result red
|
||||||
|
* @desc Retrieves the color style of the first paragraph
|
||||||
|
*
|
||||||
|
* @example $("p").css("fontWeight");
|
||||||
|
* @before <p style="font-weight: bold;">Test Paragraph.</p>
|
||||||
|
* @result bold
|
||||||
|
* @desc Retrieves the font-weight style of the first paragraph.
|
||||||
|
* Note that for all style properties with a dash (like 'font-weight'), you have to
|
||||||
|
* write it in camelCase. In other words: Every time you have a '-' in a
|
||||||
|
* property, remove it and replace the next character with an uppercase
|
||||||
|
* representation of itself. Eg. fontWeight, fontSize, fontFamily, borderWidth,
|
||||||
|
* borderStyle, borderBottomWidth etc.
|
||||||
*
|
*
|
||||||
* @test ok( $('#foo').css("display") == 'block', 'Check for css property "display"');
|
* @test ok( $('#foo').css("display") == 'block', 'Check for css property "display"');
|
||||||
*
|
*
|
||||||
|
@ -502,6 +513,8 @@ jQuery.fn = jQuery.prototype = {
|
||||||
* @example $("p").css("color","red");
|
* @example $("p").css("color","red");
|
||||||
* @before <p>Test Paragraph.</p>
|
* @before <p>Test Paragraph.</p>
|
||||||
* @result <p style="color:red;">Test Paragraph.</p>
|
* @result <p style="color:red;">Test Paragraph.</p>
|
||||||
|
* @desc Changes the color of all paragraphs to red
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @test ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
|
* @test ok( $('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible');
|
||||||
* @test $('#foo').css('display', 'none');
|
* @test $('#foo').css('display', 'none');
|
||||||
|
|
Loading…
Reference in a new issue