Jforrester has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/370287 )
Change subject: tests: Prepare for qunit 2.x ...................................................................... tests: Prepare for qunit 2.x Change-Id: I60c6f267bc95563a40a2fa14db6f53aa84dcc5d4 --- M tests/Element.test.js M tests/JSPHP.test.karma.js M tests/JSPHP.test.standalone.js M tests/QUnit.assert.equalDomElement.js M tests/core.test.js M tests/widgets/NumberInputWidget.test.js 6 files changed, 18 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/87/370287/1 diff --git a/tests/Element.test.js b/tests/Element.test.js index 723781e..c5be298 100644 --- a/tests/Element.test.js +++ b/tests/Element.test.js @@ -1,5 +1,5 @@ QUnit.module( 'Element', { - setup: function () { + beforeEach: function () { this.fixture = document.createElement( 'div' ); document.body.appendChild( this.fixture ); @@ -9,7 +9,7 @@ return ( frame.contentWindow && frame.contentWindow.document ) || frame.contentDocument; }; }, - teardown: function () { + afterEach: function () { this.fixture.parentNode.removeChild( this.fixture ); this.fixture = null; } diff --git a/tests/JSPHP.test.karma.js b/tests/JSPHP.test.karma.js index 0d5e75b..c0d3e33 100644 --- a/tests/JSPHP.test.karma.js +++ b/tests/JSPHP.test.karma.js @@ -18,8 +18,11 @@ } function makeTest( theme, klassName, infuseOnly, tests, output ) { - QUnit.test( theme + ': ' + klassName, tests.length * ( infuseOnly ? 1 : 2 ), function ( assert ) { + QUnit.test( theme + ': ' + klassName, function ( assert ) { var test, config, instance, infused, $fromPhp, i, testName; + + assert.expect( tests.length * ( infuseOnly ? 1 : 2 ) ); + OO.ui.theme = themes[ theme ]; for ( i = 0; i < tests.length; i++ ) { test = tests[ i ]; diff --git a/tests/JSPHP.test.standalone.js b/tests/JSPHP.test.standalone.js index 20b926f..66fe8ed 100644 --- a/tests/JSPHP.test.standalone.js +++ b/tests/JSPHP.test.standalone.js @@ -18,8 +18,11 @@ } function makeTest( theme, klassName, infuseOnly, tests ) { - QUnit.test( theme + ': ' + klassName, tests.length * ( infuseOnly ? 1 : 2 ), function ( assert ) { + QUnit.test( theme + ': ' + klassName, function ( assert ) { var test, config, instance, infused, id, fromPhp, i, testName; + + assert.expect( tests.length * ( infuseOnly ? 1 : 2 ) ); + OO.ui.theme = themes[ theme ]; for ( i = 0; i < tests.length; i++ ) { test = tests[ i ]; diff --git a/tests/QUnit.assert.equalDomElement.js b/tests/QUnit.assert.equalDomElement.js index 7a86a6b..3caa15f 100644 --- a/tests/QUnit.assert.equalDomElement.js +++ b/tests/QUnit.assert.equalDomElement.js @@ -162,7 +162,7 @@ actualSummaryHtml = JSON.stringify( actualSummaryHtml, null, 2 ); expectedSummaryHtml = JSON.stringify( expectedSummaryHtml, null, 2 ); - QUnit.push( + this.pushResult( QUnit.equiv( actualSummary, expectedSummary ), actualSummaryHtml, expectedSummaryHtml, message ); }; diff --git a/tests/core.test.js b/tests/core.test.js index 8624a72..a758e65 100644 --- a/tests/core.test.js +++ b/tests/core.test.js @@ -85,7 +85,7 @@ } ]; - QUnit.expect( cases.length ); + assert.expect( cases.length ); for ( i = 0; i < cases.length; i++ ) { $html = $( cases[ i ].html ).appendTo( 'body' ); result = OO.ui.isFocusableElement( cases[ i ].selector ? $html.find( cases[ i ].selector ) : $html ); diff --git a/tests/widgets/NumberInputWidget.test.js b/tests/widgets/NumberInputWidget.test.js index 21abf64..b05b733 100644 --- a/tests/widgets/NumberInputWidget.test.js +++ b/tests/widgets/NumberInputWidget.test.js @@ -1,7 +1,7 @@ ( function () { QUnit.module( 'NumberInputWidget' ); - QUnit.test( 'validate number', 7, function ( assert ) { + QUnit.test( 'validate number', function ( assert ) { var widget = new OO.ui.NumberInputWidget( { allowInteger: true, min: -10, @@ -9,6 +9,8 @@ step: 1, required: false } ); + + assert.expect( 7 ); assert.ok( widget.validateNumber( 0 ), @@ -44,7 +46,7 @@ ); } ); - QUnit.test( 'adjust value', 4, function ( assert ) { + QUnit.test( 'adjust value', function ( assert ) { var widget = new OO.ui.NumberInputWidget( { allowInteger: false, min: -10, @@ -53,6 +55,8 @@ required: false } ); + assert.expect( 4 ); + widget.adjustValue( 1 ); assert.equal( widget.getValue(), -- To view, visit https://gerrit.wikimedia.org/r/370287 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I60c6f267bc95563a40a2fa14db6f53aa84dcc5d4 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits