aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2021-05-04 13:31:39 +0200
committerGitHub <noreply@github.com>2021-05-04 13:31:39 +0200
commiteffa323f1505f2ce7a324e4f429fa9032c72f280 (patch)
tree088d41daccc854daa63abbf77557761c7afde734 /tests
parent32850869d308d5e7c9bf3e3b4d483ea886d373ce (diff)
downloadjquery-ui-effa323f1505f2ce7a324e4f429fa9032c72f280.tar.gz
jquery-ui-effa323f1505f2ce7a324e4f429fa9032c72f280.zip
Position: Make sure `of` is treated as a CSS selector
Closes gh-1955
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/position/core.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/unit/position/core.js b/tests/unit/position/core.js
index 49f02afab..f5c784242 100644
--- a/tests/unit/position/core.js
+++ b/tests/unit/position/core.js
@@ -113,7 +113,9 @@ QUnit.test( "positions", function( assert ) {
} );
QUnit.test( "of", function( assert ) {
- assert.expect( 9 + ( scrollTopSupport() ? 1 : 0 ) );
+ assert.expect( 10 + ( scrollTopSupport() ? 1 : 0 ) );
+
+ var done = assert.async();
var event;
@@ -225,6 +227,21 @@ QUnit.test( "of", function( assert ) {
top: 600,
left: 400
}, "event - left top, right bottom" );
+
+ try {
+ $( "#elx" ).position( {
+ my: "left top",
+ at: "right bottom",
+ of: "<img onerror='window.globalOf=true' src='/404' />",
+ collision: "none"
+ } );
+ } catch ( e ) {}
+
+ setTimeout( function() {
+ assert.equal( window.globalOf, undefined, "of treated as a selector" );
+ delete window.globalOf;
+ done();
+ }, 500 );
} );
QUnit.test( "offsets", function( assert ) {
@@ -334,6 +351,7 @@ QUnit.test( "using", function( assert ) {
assert.deepEqual( position, expectedPosition, "correct position for call #" + count );
assert.deepEqual( feedback.element.element[ 0 ], elems[ count ] );
delete feedback.element.element;
+ delete feedback.target.element.prevObject;
assert.deepEqual( feedback, expectedFeedback );
count++;
}