Jforrester has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/366027 )
Change subject: tests: Move QUnit fiddles to VE-core-only file ...................................................................... tests: Move QUnit fiddles to VE-core-only file Change-Id: I3f214fb1d5d78a82b367cdb6b896a1020b00685e --- M build/modules.json M tests/index.html M tests/ve.qunit.js A tests/ve.qunit.local.js M tests/ve.test.utils.js 5 files changed, 37 insertions(+), 31 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/27/366027/1 diff --git a/build/modules.json b/build/modules.json index dd14f92..da2c0de 100644 --- a/build/modules.json +++ b/build/modules.json @@ -663,6 +663,7 @@ "visualEditor.test": { "scripts": [ "tests/ve.qunit.js", + "tests/ve.qunit.local.js", "tests/ve.test.utils.js", "tests/ve.test.js", "tests/ve.EventSequencer.test.js", diff --git a/tests/index.html b/tests/index.html index 0769b6e..f54e1d6 100644 --- a/tests/index.html +++ b/tests/index.html @@ -447,6 +447,7 @@ <!-- visualEditor.test --> <script src="../tests/ve.qunit.js"></script> + <script src="../tests/ve.qunit.local.js"></script> <script src="../tests/ve.test.utils.js"></script> <script src="../tests/ve.test.js"></script> <script src="../tests/ve.EventSequencer.test.js"></script> diff --git a/tests/ve.qunit.js b/tests/ve.qunit.js index 12697b3..380800e 100644 --- a/tests/ve.qunit.js +++ b/tests/ve.qunit.js @@ -341,5 +341,4 @@ return $div.html(); }; - }( QUnit ) ); diff --git a/tests/ve.qunit.local.js b/tests/ve.qunit.local.js new file mode 100644 index 0000000..c9a712f --- /dev/null +++ b/tests/ve.qunit.local.js @@ -0,0 +1,35 @@ +/*! + * VisualEditor core-only plugin for QUnit. + * + * @copyright 2011-2017 VisualEditor Team and others; see http://ve.mit-license.org + */ + +// Extend QUnit.module to provide a fixture element. This used to be in tests/index.html, but +// dynamic test runners like Karma build their own web page. +( function ( QUnit ) { + var orgModule = QUnit.module; + + QUnit.dump.maxDepth = 10; + + QUnit.module = function ( name, localEnv ) { + localEnv = localEnv || {}; + orgModule( name, { + beforeEach: function () { + this.fixture = document.createElement( 'div' ); + this.fixture.id = 'qunit-fixture'; + document.body.appendChild( this.fixture ); + + if ( localEnv.beforeEach ) { + localEnv.beforeEach.call( this ); + } + }, + afterEach: function () { + if ( localEnv.afterEach ) { + localEnv.afterEach.call( this ); + } + + this.fixture.parentNode.removeChild( this.fixture ); + } + } ); + }; +}( QUnit ) ); diff --git a/tests/ve.test.utils.js b/tests/ve.test.utils.js index 5c833b5..bb9ff2a 100644 --- a/tests/ve.test.utils.js +++ b/tests/ve.test.utils.js @@ -52,36 +52,6 @@ // Disable scroll animatinos ve.scrollIntoView = function () {}; - // Extend QUnit.module to provide a fixture element. This used to be in tests/index.html, but - // dynamic test runners like Karma build their own web page. - ( function () { - var orgModule = QUnit.module; - - QUnit.dump.maxDepth = 10; - - QUnit.module = function ( name, localEnv ) { - localEnv = localEnv || {}; - orgModule( name, { - beforeEach: function () { - this.fixture = document.createElement( 'div' ); - this.fixture.id = 'qunit-fixture'; - document.body.appendChild( this.fixture ); - - if ( localEnv.beforeEach ) { - localEnv.beforeEach.call( this ); - } - }, - afterEach: function () { - if ( localEnv.afterEach ) { - localEnv.afterEach.call( this ); - } - - this.fixture.parentNode.removeChild( this.fixture ); - } - } ); - }; - }() ); - ve.test.utils.runIsolateTest = function ( assert, type, range, expected, label ) { var data, doc = ve.dm.example.createExampleDocument( 'isolationData' ), -- To view, visit https://gerrit.wikimedia.org/r/366027 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f214fb1d5d78a82b367cdb6b896a1020b00685e Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor 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