jQuery: JSDoc'd width + added width test suite

This commit is contained in:
johnnyreilly
2014-01-01 15:48:56 +00:00
parent f6e89c970d
commit 6baada500f
2 changed files with 64 additions and 1 deletions
+27
View File
@@ -1642,6 +1642,33 @@ function test_height() {
});
}
function test_width() {
// Returns width of browser viewport
$(window).width();
// Returns width of HTML document
$(document).width();
function showWidth(ele, w) {
$("div").text("The width for the " + ele + " is " + w + "px.");
}
$("#getp").click(function () {
showWidth("paragraph", $("p").width());
});
$("#getd").click(function () {
showWidth("document", $(document).width());
});
$("#getw").click(function () {
showWidth("window", $(window).width());
});
var modWidth = 50;
$("div").one("click", function () {
$(this).width(modWidth).addClass("mod");
modWidth -= 8;
});
}
function test_hide() {
$('.target').hide();
$('#clickme').click(function () {