aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2012-12-17 18:17:39 +0400
committerDave Methvin <dave.methvin@gmail.com>2012-12-20 22:08:32 -0500
commitc8c6ab6924b48832bfc2b94d40887b2f1b6c891e (patch)
tree9185c82c268d03c84da96ef7773594c562774d5c /test
parent00bbbe207555d3aa9d7716bb9fc6d4e4f4bcbf1e (diff)
downloadjquery-c8c6ab6924b48832bfc2b94d40887b2f1b6c891e.tar.gz
jquery-c8c6ab6924b48832bfc2b94d40887b2f1b6c891e.zip
Fix #12569. Improve feature detect for event bubbling. Close gh-1076.
Diffstat (limited to 'test')
-rw-r--r--test/csp.php5
-rw-r--r--test/unit/event.js28
-rw-r--r--test/unit/support.js121
3 files changed, 142 insertions, 12 deletions
diff --git a/test/csp.php b/test/csp.php
index e3245149c..9ab18f392 100644
--- a/test/csp.php
+++ b/test/csp.php
@@ -1,4 +1,7 @@
-<?php header("X-Content-Security-Policy-Report-Only: allow *"); ?>
+<?php
+ header("X-Content-Security-Policy: default-src localhost 'self';");
+ header("X-WebKit-CSP: script-src 'self'; style-src 'self' 'unsafe-inline'");
+?>
<!DOCTYPE html>
<html>
<head>
diff --git a/test/unit/event.js b/test/unit/event.js
index 32355c9ad..ff2ea1dd5 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -2601,3 +2601,31 @@ test( "make sure events cloned correctly", 18, function() {
clone.find("p:first").click(); // 0 should be fired
clone.find("#check1").change(); // 0 events should fire
});
+
+test( "Check order of focusin/focusout events", 2, function() {
+ var focus, blur,
+ input = jQuery("#name");
+
+ input.on("focus", function() {
+ focus = true;
+
+ }).on("focusin", function() {
+ ok( !focus, "Focusin event should fire before focus does" );
+
+ }).on("blur", function() {
+ blur = true;
+
+ }).on("focusout", function() {
+ ok( !blur, "Focusout event should fire before blur does" );
+ });
+
+ // gain focus
+ input.focus();
+
+ // then lose it
+ jQuery("#search").focus();
+
+ // cleanup
+ input.off();
+});
+
diff --git a/test/unit/support.js b/test/unit/support.js
index 8d4ac21bc..94a871ee9 100644
--- a/test/unit/support.js
+++ b/test/unit/support.js
@@ -7,7 +7,7 @@ test("boxModel", function() {
});
if ( jQuery.css ) {
- testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9238)", "support/bodyBackground.html", function( color, support ) {
+ testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) {
expect( 2 );
var i,
passed = true,
@@ -29,6 +29,7 @@ if ( jQuery.css ) {
strictEqual( jQuery.support[ i ], support[ i ], "Unexpected property: " + i );
}
}
+
ok( passed, "Same support properties" );
});
}
@@ -44,13 +45,12 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
});
(function() {
-
- var userAgent = window.navigator.userAgent,
- expected;
+ var expected,
+ userAgent = window.navigator.userAgent;
// These tests do not have to stay
// They are here to help with upcoming support changes for 1.8
- if ( /chrome\/19\.0/i.test(userAgent) ) {
+ if ( /chrome/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
@@ -83,7 +83,106 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":true,
"doesNotIncludeMarginInBodyOffset":true
};
- } else if ( /msie 8\.0/i.test(userAgent) ) {
+ } else if ( /opera/i.test( userAgent ) ) {
+ expected = {
+ "leadingWhitespace":true,
+ "tbody":true,
+ "htmlSerialize":true,
+ "style":true,
+ "hrefNormalized":true,
+ "opacity":true,
+ "cssFloat":true,
+ "checkOn":true,
+ "optSelected":true,
+ "getSetAttribute":true,
+ "enctype":true,
+ "html5Clone":true,
+ "submitBubbles":true,
+ "changeBubbles":true,
+ "focusinBubbles":false,
+ "deleteExpando":true,
+ "noCloneEvent":true,
+ "inlineBlockNeedsLayout":false,
+ "shrinkWrapBlocks":false,
+ "reliableMarginRight":true,
+ "noCloneChecked":true,
+ "optDisabled":true,
+ "radioValue":false,
+ "checkClone":true,
+ "appendChecked":true,
+ "boxModel":true,
+ "reliableHiddenOffsets":true,
+ "ajax":true,
+ "cors":true,
+ "doesNotIncludeMarginInBodyOffset":true
+ };
+ } else if ( /msie 10\.0/i.test( userAgent ) ) {
+ expected = {
+ "leadingWhitespace":true,
+ "tbody":true,
+ "htmlSerialize":true,
+ "style":true,
+ "hrefNormalized":true,
+ "opacity":true,
+ "cssFloat":true,
+ "checkOn":true,
+ "optSelected":false,
+ "getSetAttribute":true,
+ "enctype":true,
+ "html5Clone":true,
+ "submitBubbles":true,
+ "changeBubbles":true,
+ "focusinBubbles":true,
+ "deleteExpando":true,
+ "noCloneEvent":true,
+ "inlineBlockNeedsLayout":false,
+ "shrinkWrapBlocks":false,
+ "reliableMarginRight":true,
+ "noCloneChecked":false,
+ "optDisabled":true,
+ "radioValue":false,
+ "checkClone":true,
+ "appendChecked":true,
+ "boxModel":true,
+ "reliableHiddenOffsets":true,
+ "ajax":true,
+ "cors":true,
+ "doesNotIncludeMarginInBodyOffset":true
+ };
+ } else if ( /msie 9\.0/i.test( userAgent ) ) {
+ expected = {
+ "leadingWhitespace":true,
+ "tbody":true,
+ "htmlSerialize":true,
+ "style":true,
+ "hrefNormalized":true,
+ "opacity":true,
+ "cssFloat":true,
+ "checkOn":true,
+ "optSelected":false,
+ "getSetAttribute":true,
+ "enctype":true,
+ "html5Clone":true,
+ "submitBubbles":true,
+ "changeBubbles":true,
+ "focusinBubbles":true,
+ "deleteExpando":true,
+ "noCloneEvent":true,
+ "inlineBlockNeedsLayout":false,
+ "shrinkWrapBlocks":false,
+ "reliableMarginRight":true,
+ "noCloneChecked":false,
+ "optDisabled":true,
+ "radioValue":false,
+ "checkClone":true,
+ "appendChecked":true,
+ "boxModel":true,
+ "reliableHiddenOffsets":true,
+ "ajax":true,
+ "cors":false,
+ "doesNotIncludeMarginInBodyOffset":true
+ };
+ } else if ( /msie 8\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":false,
"tbody":true,
@@ -116,7 +215,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":false,
"doesNotIncludeMarginInBodyOffset":true
};
- } else if ( /msie 7\.0/i.test(userAgent) ) {
+ } else if ( /msie 7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": false,
@@ -149,7 +248,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"tbody": false,
"style": false
};
- } else if ( /msie 6\.0/i.test(userAgent) ) {
+ } else if ( /msie 6\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":false,
"tbody":false,
@@ -182,7 +281,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":false,
"doesNotIncludeMarginInBodyOffset":true
};
- } else if ( /5\.1\.1 safari/i.test(userAgent) ) {
+ } else if ( /5\.1\.1 safari/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
@@ -215,7 +314,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":true,
"doesNotIncludeMarginInBodyOffset":true
};
- } else if ( /firefox\/3\.6/i.test(userAgent) ) {
+ } else if ( /firefox/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
@@ -227,7 +326,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"checkOn":true,
"optSelected":true,
"getSetAttribute":true,
- "enctype":false,
+ "enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,