From 6fd5e71ef9bfe940ae666dbd300c301b5299fab1 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 11 Jul 2017 13:05:17 -0700 Subject: [PATCH 1/1] mediawiki.toc: Migrate test from deprecated asyncTest() Instead, use assert.async(), or (in this case) return the Promise directly to QUnit.test, which will naturally await it. As bonus, it'll handle errors, too. (instead of timing out) Change-Id: I94ee0bf72a3d8ac2e588cd75cbe0787b5001d5b4 --- .../suites/resources/mediawiki/mediawiki.toc.test.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js index 477550bd4b..b20b68f5d6 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.toc.test.js @@ -6,7 +6,7 @@ } } ) ); - QUnit.asyncTest( 'toggleToc', function ( assert ) { + QUnit.test( 'toggleToc', function ( assert ) { var tocHtml, $toc, $toggleLink, $tocList; assert.strictEqual( $( '.toc' ).length, 0, 'There is no table of contents on the page at the beginning' ); @@ -29,13 +29,11 @@ assert.strictEqual( $tocList.is( ':hidden' ), false, 'The table of contents is now visible' ); $toggleLink.click(); - $tocList.promise().done( function () { + return $tocList.promise().then( function () { assert.strictEqual( $tocList.is( ':hidden' ), true, 'The table of contents is now hidden' ); $toggleLink.click(); - $tocList.promise().done( function () { - QUnit.start(); - } ); + return $tocList.promise(); } ); } ); }( mediaWiki, jQuery ) ); -- 2.20.1