Awight has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173249
Change subject: QUnit tests for client banner allocations
......................................................................
QUnit tests for client banner allocations
Change-Id: I58eee6f15f0d01f7d8e4d57020d4148ddd8d5152
---
A
tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
1 file changed, 35 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice
refs/changes/49/173249/1
diff --git
a/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
b/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
new file mode 100644
index 0000000..b3a8ca6
--- /dev/null
+++
b/tests/qunit/ext.centralNotice.bannerController.lib/bannerController.lib.tests.js
@@ -0,0 +1,35 @@
+( function ( mw, $ ) {
+ 'use strict';
+
+ QUnit.module( 'ext.centralNotice.bannerController.lib',
QUnit.newMwEnvironment( {
+ setup: function () {
+ mw.centralNotice.data.getVars.country = 'US';
+ mw.centralNotice.data.device = 'desktop';
+ // TODO: remaining config, initialize CN.
+ },
+ teardown: function () {
+ }
+ } ) );
+
+ $.ajax( {
+ url: mw.config.get( 'wgExtensionAssetsPath' )
+ + '/CentralNotice/tests/data/AllocationsFixtures.json'
+ } ).done( function( responseData ) {
+ responseData.forEach( function( testCaseData ) {
+ var data = testCaseData[0],
+ lib = mw.cnBannerControllerLib;
+
+ QUnit.test( data.title, 1, function( assert ) {
+ lib.setChoiceData( data.choices );
+ lib.filterChoiceData();
+ var allocations =
lib.calculateBannerAllocations();
+
+ assert.deepEqual( allocations, data.allocations
);
+ } );
+
+ } );
+ } );
+
+ // TODO: chooser tests
+
+} ( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/173249
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I58eee6f15f0d01f7d8e4d57020d4148ddd8d5152
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits