aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-03-30 21:52:09 -0400
committertimmywil <tim.willison@thisismedium.com>2011-03-30 21:52:09 -0400
commit6da3885cc38043fd8d384d1184468b0a2fba9fd9 (patch)
tree5a04b2c47f119ff700c134a4e53ccb172a81e76b /test
parente93ca40aa7ec4337a57fcdbc699d900e01b4c67e (diff)
parentad4152709cd7c7b7fdafd2dc0b266fd273aff5d5 (diff)
downloadjquery-6da3885cc38043fd8d384d1184468b0a2fba9fd9.tar.gz
jquery-6da3885cc38043fd8d384d1184468b0a2fba9fd9.zip
Merge branch 'master' of git://github.com/jquery/jquery into 2773_find_closest
Diffstat (limited to 'test')
-rw-r--r--test/data/offset/bug_8316.html30
-rw-r--r--test/unit/css.js12
-rw-r--r--test/unit/event.js39
-rw-r--r--test/unit/offset.js17
4 files changed, 97 insertions, 1 deletions
diff --git a/test/data/offset/bug_8316.html b/test/data/offset/bug_8316.html
new file mode 100644
index 000000000..ce32a2826
--- /dev/null
+++ b/test/data/offset/bug_8316.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>bug_8316</title>
+ <style type="text/css" media="screen">
+ #elem {
+ background-color: #000;
+ height: 100px;
+ width: 100px;
+ position: fixed;
+ }
+ </style>
+ <script src="../../../src/core.js"></script>
+ <script src="../../../src/deferred.js"></script>
+ <script src="../../../src/support.js"></script>
+ <script src="../../../src/sizzle/sizzle.js"></script>
+ <script src="../../../src/sizzle-jquery.js"></script>
+ <script src="../../../src/traversing.js"></script>
+ <script src="../../../src/data.js"></script>
+ <script src="../../../src/event.js"></script>
+ <script src="../../../src/css.js"></script>
+ <script src="../../../src/offset.js"></script>
+ </head>
+ <body>
+ <p> Some foo text </p>
+ <div id="elem"></div>
+ </body>
+</html>
diff --git a/test/unit/css.js b/test/unit/css.js
index 555f13575..8ae8fcb34 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -333,3 +333,15 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () {
ok( result, "elem.runtimeStyle does not throw exception" );
});
+
+test("marginRight computed style (bug #3333)", function() {
+ expect(1);
+
+ var $div = jQuery("#foo");
+ $div.css({
+ width: "1px",
+ marginRight: 0
+ });
+
+ equals($div.css("marginRight"), "0px");
+});
diff --git a/test/unit/event.js b/test/unit/event.js
index b7b260462..1e40e0f3e 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -683,6 +683,20 @@ test("hover()", function() {
equals( times, 4, "hover handlers fired" );
});
+test("mouseover triggers mouseenter", function() {
+ expect(1);
+
+ var count = 0,
+ elem = jQuery("<a />");
+ elem.mouseenter(function () {
+ count++;
+ });
+ elem.trigger('mouseover');
+ equals(count, 1, "make sure mouseover triggers a mouseenter" );
+
+ elem.remove();
+});
+
test("trigger() shortcuts", function() {
expect(6);
@@ -1966,6 +1980,31 @@ test("window resize", function() {
ok( !jQuery._data(window, "__events__"), "Make sure all the events are gone." );
});
+test("focusin bubbles", function() {
+ expect(4);
+
+ var input = jQuery( '<input type="text" />' ).prependTo( "body" ),
+ order = 0;
+
+ jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){
+ equals( 1, order++, "focusin on the body second" );
+ });
+
+ input.bind( "focusin.focusinBubblesTest", function(){
+ equals( 0, order++, "focusin on the element first" );
+ });
+
+ // DOM focus method
+ input[0].focus();
+ // jQuery trigger, which calls DOM focus
+ order = 0;
+ input[0].blur();
+ input.trigger( "focus" );
+
+ input.remove();
+ jQuery( "body" ).unbind( "focusin.focusinBubblesTest" );
+});
+
/*
test("jQuery(function($) {})", function() {
stop();
diff --git a/test/unit/offset.js b/test/unit/offset.js
index 329d69f95..b7f72a0cd 100644
--- a/test/unit/offset.js
+++ b/test/unit/offset.js
@@ -422,6 +422,21 @@ test("offsetParent", function(){
equals( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." );
});
+testoffset("bug_8316", function( jQuery ){
+ expect(2);
+
+ var tests = [
+ { id:'#elem', top: 100, left: 100 }
+ ];
+
+ jQuery.each(tests, function(){
+ var el = jQuery(this.id);
+ el.offset({ top: this.top, left: this.left});
+ equals(Math.round(el.offset().top), this.top);
+ equals(Math.round(el.offset().left), this.left);
+ });
+});
+
function testoffset(name, fn) {
test(name, function() {
@@ -447,7 +462,7 @@ function testoffset(name, fn) {
function loadFixture() {
var src = './data/offset/' + name + '.html?' + parseInt( Math.random()*1000, 10 ),
iframe = jQuery('<iframe />').css({
- width: 500, height: 500, position: 'absolute', top: -600, left: -600, visiblity: 'hidden'
+ width: 500, height: 500, position: 'absolute', top: -600, left: -600, visibility: 'hidden'
}).appendTo('body')[0];
iframe.contentWindow.location = src;
return iframe;