jenkins-bot has submitted this change and it was merged.

Change subject: Fix QUnit test failure
......................................................................


Fix QUnit test failure

Pre-ES5, non-objects are not allowed as function context, so they are either
casted to an object (e.g. new String('-1') or new Boolean(true) which are
typeof 'object') or replaced with the global object if no valid object can be
created.

Using a named parameter to refer to the current item in $.each fixes it.

Bug: 50138
Change-Id: Ice481fef297b0fc14a2ebdedcb21b8d4bdf40563
---
M tests/ext.eventLogging.tests.js
1 file changed, 7 insertions(+), 7 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/ext.eventLogging.tests.js b/tests/ext.eventLogging.tests.js
index f05ebf3..caf243e 100644
--- a/tests/ext.eventLogging.tests.js
+++ b/tests/ext.eventLogging.tests.js
@@ -169,20 +169,20 @@
                        invalid: [ [], 0, true ]
                },
                timestamp: {
-                       valid: [ new Date().getTime(), new Date() ],
+                       valid: [ +new Date(), new Date() ],
                        invalid: [ -1, 'yesterday', NaN ]
                }
        }, function ( type, cases ) {
                var asserts = cases.valid.length + cases.invalid.length;
 
                QUnit.test( type, asserts, function ( assert ) {
-                       $.each( cases.valid, function () {
-                               assert.strictEqual( mw.eventLog.isInstanceOf( 
this, type ), true,
-                                       $.toJSON( this ) + ' is a ' + type );
+                       $.each( cases.valid, function ( index, value ) {
+                               assert.strictEqual( mw.eventLog.isInstanceOf( 
value, type ), true,
+                                       $.toJSON( value ) + ' is a ' + type );
                        } );
-                       $.each( cases.invalid, function () {
-                               assert.strictEqual( mw.eventLog.isInstanceOf( 
this, type ), false,
-                                       $.toJSON( this ) + ' is not a ' + type 
);
+                       $.each( cases.invalid, function ( index, value ) {
+                               assert.strictEqual( mw.eventLog.isInstanceOf( 
value, type ), false,
+                                       $.toJSON( value ) + ' is not a ' + type 
);
                        } );
                } );
        } );

-- 
To view, visit https://gerrit.wikimedia.org/r/70330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice481fef297b0fc14a2ebdedcb21b8d4bdf40563
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to