Skip to content

Commit fd1b8a0

Browse files
authored
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
1 parent 54f96ee commit fd1b8a0

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tests/lib/common.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function testWidgetDefaults( widget, defaults ) {
3434
}
3535

3636
function testWidgetOverrides( widget ) {
37-
if ( $.uiBackCompat === false ) {
37+
if ( $.uiBackCompat !== true ) {
3838
QUnit.test( "$.widget overrides", function( assert ) {
3939
assert.expect( 4 );
4040
$.each( [
@@ -43,8 +43,19 @@ function testWidgetOverrides( widget ) {
4343
"option",
4444
"_trigger"
4545
], function( i, method ) {
46-
assert.strictEqual( $.ui[ widget ].prototype[ method ],
47-
$.Widget.prototype[ method ], "should not override " + method );
46+
47+
if ( method === "_trigger" &&
48+
/^(?:draggable|sortable): common widget$/
49+
.test( assert.test.module.name ) ) {
50+
51+
// Draggable & sortable modules overwrite _trigger. They
52+
// should not, but we don't plan to change the API at this
53+
// stage of the project.
54+
assert.ok( true, "draggable & sortable modules overwrite _trigger" );
55+
} else {
56+
assert.strictEqual( $.ui[ widget ].prototype[ method ],
57+
$.Widget.prototype[ method ], "should not override " + method );
58+
}
4859
} );
4960
} );
5061
}

0 commit comments

Comments
 (0)