mediawiki-extensions-Popups/tests/qunit/ext.popups.desktopRenderer.test.js
jdlrobson 7dfad14da1 Directory structure should reflect the ResourceLoader definitions
Given we currently have modules defined in extension.json and in hooks
it can be really confusing understanding how the code fits together.

This change hopefully makes this a little clearer by using folder names
that are named after the resource loader modules - this is also consistent
with how we do things in our other extensions.

A images folder is added to the route so that it is clearer that the images
are not used in ResourceLoader module definitions and are only used to illustrate
the beta feature.

Change-Id: Ia650ec03e3a6d3069165441ddfa069d390be4d10
2016-10-19 20:52:40 +00:00

28 lines
746 B
JavaScript

( function ( $, mw ) {
QUnit.module( 'ext.popups.renderer.desktopRenderer', {
setup: function () {
mw.popups.$popup = $( '<div>' );
mw.popups.render.cache[ '/wiki/Kittens' ] = {
settings: {
title: 'Kittens'
},
popup: $( '<div>hello</div>' ),
getClasses: function () {
return [ 'foo' ];
},
process: $.noop,
getOffset: function () {
return {};
}
};
}
} );
QUnit.test( 'mw.popups.render.openPopup (T68496)', 1, function ( assert ) {
mw.popups.render.openPopup( $( '<a href="/wiki/Kittens">' ) );
mw.popups.render.openPopup( $( '<a href="/wiki/Kittens">' ) );
assert.strictEqual( mw.popups.render.cache[ '/wiki/Kittens' ].popup.text(), 'hello' );
} );
} )( jQuery, mediaWiki );