<commit_before>module("dimensions", { teardown: moduleTeardown });

function pass( val ) {
	return val;
}

function fn( val ) {
	return function(){ return val; };
}

function testWidth( val ) {
	expect(8);

	var $div = jQuery("#nothiddendiv");
	$div.width( val(30) );
	equal($div.width(), 30, "Test set to 30 correctly");
	$div.hide();
	equal($div.width(), 30, "Test hidden div");
	$div.show();
	$div.width( val(-1) ); // handle negative numbers by ignoring #1599
	equal($div.width(), 30, "Test negative width ignored");
	$div.css("padding", "20px");
	equal($div.width(), 30, "Test padding specified with pixels");
	$div.css("border", "2px solid #fff");
	equal($div.width(), 30, "Test border specified with pixels");

	$div.css({ display: "", border: "", padding: "" });

	jQuery("#nothiddendivchild").css({ width: 20, padding: "3px", border: "2px solid #fff" });
	equal(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding");
	jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });

	var blah = jQuery("blah");
	equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
	equal( blah.width(), null, "Make sure 'null' is returned on an empty set");

	jQuery.removeData($div[0], "olddisplay", true);
}

test("width()", function() {
	testWidth( pass );
});

test("width(undefined)", function() {
	expect(1);
	equal(jQuery("#nothiddendiv").width(30).width(undefined).width(), 30, ".width(undefined) is chainable (#5571)");
});

test("width(Function)", function() {
	testWidth( fn );
});

test("width(Function(args))", function() {
	expect( 2 );

	var $div = jQuery("#nothiddendiv");
	$div.width( 30 ).width(function(i, width) {
		equal( width, 30, "Make sure previous value is corrrect." );
		return width + 1;
	});

	equal( $div.width(), 31, "Make sure value was modified correctly." );
});

function testHeight( val ) {
	expect(8);

	var $div = jQuery("#nothiddendiv");
	$div.height( val(30) );
	equal($div.height(), 30, "Test set to 30 correctly");
	$div.hide();
	equal($div.height(), 30, "Test hidden div");
	$div.show();
	$div.height( val(-1) ); // handle negative numbers by ignoring #1599
	equal($div.height(), 30, "Test negative height ignored");
	$div.css("padding", "20px");
	equal($div.height(), 30, "Test padding specified with pixels");
	$div.css("border", "2px solid #fff");
	equal($div.height(), 30, "Test border specified with pixels");

	$div.css({ display: "", border: "", padding: "", height: "1px" });

	jQuery("#nothiddendivchild").css({ height: 20, padding: "3px", border: "2px solid #fff" });
	equal(jQuery("#nothiddendivchild").height(), 20, "Test child height with border and padding");
	jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", height: "" });

	var blah = jQuery("blah");
	equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
	equal( blah.height(), null, "Make sure 'null' is returned on an empty set");

	jQuery.removeData($div[0], "olddisplay", true);
}

test("height()", function() {
	testHeight( pass );
});
<commit_msg>Update dimensions unit tests from changes in #11604<commit_after>module("dimensions", { teardown: moduleTeardown });

function pass( val ) {
	return val;
}

function fn( val ) {
	return function(){ return val; };
}

function testWidth( val ) {
	expect(8);

	var $div = jQuery("#nothiddendiv");
	$div.width( val(30) );
	equal($div.width(), 30, "Test set to 30 correctly");
	$div.hide();
	equal($div.width(), 30, "Test hidden div");
	$div.show();
	$div.width( val(-1) ); // handle negative numbers by setting to 0 #11604
	equal($div.width(), 0, "Test negative width normalized to 0");
	$div.css("padding", "20px");
	equal($div.width(), 0, "Test padding specified with pixels");
	$div.css("border", "2px solid #fff");
	equal($div.width(), 0, "Test border specified with pixels");

	$div.css({ display: "", border: "", padding: "" });

	jQuery("#nothiddendivchild").css({ width: 20, padding: "3px", border: "2px solid #fff" });
	equal(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding");
	jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });

	var blah = jQuery("blah");
	equal( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
	equal( blah.width(), null, "Make sure 'null' is returned on an empty set");

	jQuery.removeData($div[0], "olddisplay", true);
}

test("width()", function() {
	testWidth( pass );
});

test("width(undefined)", function() {
	expect(1);
	equal(jQuery("#nothiddendiv").width(30).width(undefined).width(), 30, ".width(undefined) is chainable (#5571)");
});

test("width(Function)", function() {
	testWidth( fn );
});

test("width(Function(args))", function() {
	expect( 2 );

	var $div = jQuery("#nothiddendiv");
	$div.width( 30 ).width(function(i, width) {
		equal( width, 30, "Make sure previous value is corrrect." );
		return width + 1;
	});

	equal( $div.width(), 31, "Make sure value was modified correctly." );
});

function testHeight( val ) {
	expect(8);

	var $div = jQuery("#nothiddendiv");
	$div.height( val(30) );
	equal($div.height(), 30, "Test set to 30 correctly");
	$div.hide();
	equal($div.height(), 30, "Test hidden div");
	$div.show();
	$div.height( val(-1) ); // handle negative numbers by setting to 0 #11604
	equal($div.height(), 0, "Test negative height normalized to 0");
	$div.css("padding", "20px");
	equal($div.height(), 0, "Test padding specified with pixels");
	$div.css("border", "2px solid #fff");
	equal($div.height(), 0, "Test border specified with pixels");

	$div.css({ display: "", border: "", padding: "", height: "1px" });

	jQuery("#nothiddendivchild").css({ height: 20, padding: "3px", border: "2px solid #fff" });
	equal(jQuery("#nothiddendivchild").height(), 20, "Test child height with border and padding");
	jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", height: "" });

	var blah = jQuery("blah");
	equal( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
	equal( blah.height(), null, "Make sure 'null' is returned on an empty set");

	jQuery.removeData($div[0], "olddisplay", true);
}

test("height()", function() {
	testHeight( pass );
});

{'fraction_non_alphanumeric': 0.2067716535433071, 'fraction_numerical': 0.026614173228346458, 'mean_word_length': 5.166019417475728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7522804', 'n_tokens_mistral': 2241, 'n_tokens_neox': 2083, 'n_words': 631}