mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-19 13:25:53 +00:00
7f3be6dcd4
Popups currently makes use of a render cache. Using a cache in this way without protection causes problems (I will look at cleaning this up) The hack below it `mw.popups.$popup.html( mw.popups.$popup.html() );` will lead to the html of the cached object being wiped out on IE9 meaning future loads will show an empty popup. Add a unit test (which previously would fail in IE9) to protect against this in future. Bug: T68496 Change-Id: Icef784fb389b0ab1856e2ba7464c9423ebcd62ab
28 lines
746 B
JavaScript
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 );
|