mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-23 15:56:47 +00:00
Merge "Back button doesn't close MediaViewer if the URL has a fragment with "/""
This commit is contained in:
commit
525d333998
|
@ -706,8 +706,8 @@ class MultimediaViewer {
|
|||
* Sets up the route handlers
|
||||
*/
|
||||
setupRouter() {
|
||||
// handle empty hashes, and anchor links (page sections)
|
||||
this.router.addRoute( /^[^/]*$/, () => {
|
||||
// handle empty hashes, and anchor links (page sections, possibly including /)
|
||||
this.router.addRoute( /.*$/, () => {
|
||||
if ( this.isOpen ) {
|
||||
comingFromHashChange = true;
|
||||
document.title = this.createDocumentTitle( null );
|
||||
|
|
|
@ -450,6 +450,24 @@ const { MultimediaViewerBootstrap } = require( 'mmv.bootstrap' );
|
|||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'Viewer is closed then navigating to #foo/bar/baz (page section including slash)', function ( assert ) {
|
||||
location.hash = '#/media/foo';
|
||||
|
||||
const viewer = getMultimediaViewer();
|
||||
viewer.isOpen = true;
|
||||
viewer.ui = undefined;
|
||||
this.sandbox.stub( viewer, 'close' );
|
||||
|
||||
location.hash = '#foo/bar/baz';
|
||||
|
||||
// Wait for route event handler to execute
|
||||
const done = assert.async();
|
||||
setTimeout( () => {
|
||||
assert.true( viewer.close.called, 'The viewer was closed' );
|
||||
done();
|
||||
}, 100 );
|
||||
} );
|
||||
|
||||
QUnit.test( 'Refuse to load too-big thumbnails', ( assert ) => {
|
||||
let expectedWidth;
|
||||
const reuestedWidth = 1000;
|
||||
|
|
Loading…
Reference in a new issue