aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2024-09-09 17:52:53 +0200
committerGitHub <noreply@github.com>2024-09-09 17:52:53 +0200
commitfd1b8a03b22411e68e703426fb85a2566318623d (patch)
tree0f4cfbc3f97bb0657a88a738caa3395c15689551
parent54f96eea31b21d9ecb00912261df3e5aaebf8cce (diff)
downloadjquery-ui-fd1b8a03b22411e68e703426fb85a2566318623d.tar.gz
jquery-ui-fd1b8a03b22411e68e703426fb85a2566318623d.zip
Tests: Properly check `$.uiBackCompat` in common widget tests
The "common widget" tests, checking if a widget doesn't overwrite some core widget APIs wasn't running as it was incorrectly checking for `$.uiBackCompat === false` instead of `$.uiBackCompat !== true` after the default changed in gh-2250. Fixing the check uncovered that the draggable & sortable modules do overwrite the `_trigger` method. Add an exception in the test for that; at this stage of the project we don't plan to change the implementation. Closes gh-2286 Ref gh-2250
-rw-r--r--tests/lib/common.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/lib/common.js b/tests/lib/common.js
index 56b7a3ff3..ba78fb6f6 100644
--- a/tests/lib/common.js
+++ b/tests/lib/common.js
@@ -34,7 +34,7 @@ function testWidgetDefaults( widget, defaults ) {
}
function testWidgetOverrides( widget ) {
- if ( $.uiBackCompat === false ) {
+ if ( $.uiBackCompat !== true ) {
QUnit.test( "$.widget overrides", function( assert ) {
assert.expect( 4 );
$.each( [
@@ -43,8 +43,19 @@ function testWidgetOverrides( widget ) {
"option",
"_trigger"
], function( i, method ) {
- assert.strictEqual( $.ui[ widget ].prototype[ method ],
- $.Widget.prototype[ method ], "should not override " + method );
+
+ if ( method === "_trigger" &&
+ /^(?:draggable|sortable): common widget$/
+ .test( assert.test.module.name ) ) {
+
+ // Draggable & sortable modules overwrite _trigger. They
+ // should not, but we don't plan to change the API at this
+ // stage of the project.
+ assert.ok( true, "draggable & sortable modules overwrite _trigger" );
+ } else {
+ assert.strictEqual( $.ui[ widget ].prototype[ method ],
+ $.Widget.prototype[ method ], "should not override " + method );
+ }
} );
} );
}