Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Properly check $.uiBackCompat in common widget tests #2286

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions tests/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( [
Expand All @@ -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 );
}
} );
} );
}
Expand Down