mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-24 00:03:56 +00:00
Back button doesn't close MediaViewer if the URL has a fragment with "/"
Bug: T361612 Change-Id: I1a516dbe62bd3a8c621a148c3fb36111128a57ef
This commit is contained in:
parent
fc75d3aabe
commit
a12565e8aa
|
@ -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