[MediaWiki-commits] [Gerrit] data-values/value-view[master]: Make tests compatible with QUnit 2

2017-07-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/368121 )

Change subject: Make tests compatible with QUnit 2
..


Make tests compatible with QUnit 2

* Avoid QUnit.asyncTest, QUnit.start/stop (deprecated in 1.x, removed in 2.0).
  Instead, use assert.async(), or return a Promise to QUnit.test().

* Remove testCount from QUnit.test(). This has not been required in
  QUnit for a while. MW's testrunner has also removed enforcement.
  QUnit's improve async control and context-aware assert tracking has
  been it mostly redundant. For now, keep it in most places by using
  assert.expect(), and remove it from simple cases.

Bug: T170515
Change-Id: I15fc0b75832308cf7865e79b8156432717063631
---
M tests/lib/jquery.event/jquery.event.special.eachchange.tests.js
M tests/lib/jquery.ui/jquery.ui.inputextender.tests.js
M tests/lib/jquery.ui/jquery.ui.listrotator.tests.js
M tests/lib/jquery.ui/jquery.ui.ooMenu.tests.js
M tests/lib/jquery.ui/jquery.ui.preview.tests.js
M tests/lib/jquery.ui/jquery.ui.suggester.tests.js
M tests/lib/jquery.ui/jquery.ui.toggler.tests.js
M tests/lib/jquery/jquery.PurposedCallbacks.tests.js
M tests/lib/jquery/jquery.animateWithEvent.tests.js
M tests/src/ExpertExtender/ExpertExtender.Listrotator.tests.js
M tests/src/ExpertExtender/ExpertExtender.tests.js
M tests/src/experts/GlobeCoordinateInput.tests.js
M tests/src/jquery.valueview.valueview.tests.js
13 files changed, 80 insertions(+), 125 deletions(-)

Approvals:
  Jonas Kress (WMDE): Looks good to me, approved
  Ladsgroup: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Jforrester: Looks good to me, but someone else must approve



diff --git a/tests/lib/jquery.event/jquery.event.special.eachchange.tests.js 
b/tests/lib/jquery.event/jquery.event.special.eachchange.tests.js
index 4a22e10..d8c2875 100644
--- a/tests/lib/jquery.event/jquery.event.special.eachchange.tests.js
+++ b/tests/lib/jquery.event/jquery.event.special.eachchange.tests.js
@@ -79,7 +79,8 @@
}
);
 
-   QUnit.test( 'Triggering on a single input element', 2, function( assert 
) {
+   QUnit.test( 'Triggering on a single input element', function( assert ) {
+   assert.expect( 2 );
var $subject = generateInputElement( { value: 'a' } );
 
$subject.on( 'eachchange', iIncr );
@@ -185,7 +186,7 @@
);
} );
 
-   QUnit.test( 'Bubbling up the DOM tree', 1, function( assert ) {
+   QUnit.test( 'Bubbling up the DOM tree', function( assert ) {
var $subject = generateInputElement(),
$parent = $( '' );
 
@@ -218,7 +219,8 @@
}
);
 
-   QUnit.test( 'Setting prevVal', 4, function( assert ) {
+   QUnit.test( 'Setting prevVal', function( assert ) {
+   assert.expect( 4 );
var $subject = generateInputElement();
var expectedPrevVal = 'a';
 
diff --git a/tests/lib/jquery.ui/jquery.ui.inputextender.tests.js 
b/tests/lib/jquery.ui/jquery.ui.inputextender.tests.js
index a3dddc2..0970ef0 100644
--- a/tests/lib/jquery.ui/jquery.ui.inputextender.tests.js
+++ b/tests/lib/jquery.ui/jquery.ui.inputextender.tests.js
@@ -38,7 +38,7 @@
 * Convenience function for testing behavior before/after/during 
showing and hiding extension.
 *
 * @example
-* showAndHideExtensionAgain( newTestInputextender(), {
+* showAndHideExtensionAgain( assert, newTestInputextender(), {
 * afterCallingShowExtension: function( instance ) {},
 * whenFullyShown: function() { instance },
 * afterCallingHideExtension: function( instance ) {},
@@ -53,8 +53,9 @@
 * @return {Object} jQuery.Promise Resolved after final hiding is done. 
Can be rejected in case
 * a hideControl has been injected and gets rejected.
 */
-   function showAndHideExtensionAgain( instance, hideControl, callbacks ) {
+   function showAndHideExtensionAgain( assert, instance, hideControl, 
callbacks ) {
var deferred = $.Deferred();
+   var done = assert.async( 2 );
if ( !hideControl.done ) {
callbacks = hideControl;
// We will do the hideExtension() immediately in this 
case:
@@ -69,22 +70,18 @@
( callbacks.whenFullyHiddenAgain || 
$.noop )( instance );
 
deferred.resolve();
-   QUnit.start(); // *2*
+   done(); // *2*
} );
( callbacks.afterCallingHideExtension || $.noop 
)( instance );
-
-   QUnit.stop(); // wait for hideExtension() 
callback *2*

[MediaWiki-commits] [Gerrit] data-values/value-view[master]: Make tests compatible with QUnit 2

2017-07-26 Thread Krinkle (Code Review)
Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368121 )

Change subject: Make tests compatible with QUnit 2
..

Make tests compatible with QUnit 2

Avoid QUnit.asyncTest, QUnit.start/stop (deprecated in 1.x, removed in 2.0).

Bug: T170515
Change-Id: I15fc0b75832308cf7865e79b8156432717063631
---
M tests/src/ExpertExtender/ExpertExtender.Listrotator.tests.js
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/data-values/value-view 
refs/changes/21/368121/1

diff --git a/tests/src/ExpertExtender/ExpertExtender.Listrotator.tests.js 
b/tests/src/ExpertExtender/ExpertExtender.Listrotator.tests.js
index 14b2271..522deed 100644
--- a/tests/src/ExpertExtender/ExpertExtender.Listrotator.tests.js
+++ b/tests/src/ExpertExtender/ExpertExtender.Listrotator.tests.js
@@ -39,8 +39,9 @@
assert.equal( listrotator.getValue(), 'custom value' );
} );
 
-   QUnit.asyncTest( 'supports switching away from custom values', 
function( assert ) {
+   QUnit.test( 'supports switching away from custom values', function( 
assert ) {
assert.expect( 2 );
+   var done = assert.async();
var onValueChange = sinon.spy();
var upstreamValue = {
custom: true,
@@ -67,7 +68,7 @@
sinon.assert.calledOnce( onValueChange );
assert.equal( listrotator.getValue(), 'fixed value' );
 
-   QUnit.start();
+   done();
}, 200 );
 
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15fc0b75832308cf7865e79b8156432717063631
Gerrit-PatchSet: 1
Gerrit-Project: data-values/value-view
Gerrit-Branch: master
Gerrit-Owner: Krinkle 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits