mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-29 05:07:36 +00:00
Merge "Match size of preview and real image"
This commit is contained in:
commit
6bde670acc
|
@ -116,19 +116,6 @@
|
|||
this.$imageDiv.html( this.$image );
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets max-width and max-height of the image equal to those of its parent element.
|
||||
* FIXME what is this good for, actually?
|
||||
*/
|
||||
C.setImageMaxDimensions = function () {
|
||||
this.$image.css( {
|
||||
maxWidth : this.$image.parent().width(),
|
||||
// for height, use closest ancestor which has non-content-defined height;
|
||||
// otherwise this could be determined by the height of the image.
|
||||
maxHeight : this.$imageWrapper.height()
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets contained image and also the max dimensions. Called while resizing the viewer.
|
||||
* Assumes set function called before.
|
||||
|
@ -153,8 +140,6 @@
|
|||
|
||||
this.setUpImageClick();
|
||||
}
|
||||
|
||||
this.setImageMaxDimensions();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
assert.ok( canvas.$imageDiv.hasClass( 'empty' ), 'Canvas is not visible.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'setImageAndMaxDimensions()', 8, function ( assert ) {
|
||||
QUnit.test( 'setImageAndMaxDimensions()', 4, function ( assert ) {
|
||||
var $qf = $( '#qunit-fixture' ),
|
||||
$mainWrapper = $( '<div>' ).appendTo( $qf ),
|
||||
$innerWrapper =$( '<div>' ).appendTo( $mainWrapper ),
|
||||
|
@ -80,8 +80,6 @@
|
|||
|
||||
assert.strictEqual( image.width, originalWidth, 'Image width was not modified.' );
|
||||
assert.strictEqual( canvas.$image, $imageElem, 'Image element still set correctly.' );
|
||||
assert.strictEqual( canvas.$image.css( 'maxWidth' ), canvas.$imageDiv.width() + 'px', 'MaxWidth set correctly.' );
|
||||
assert.strictEqual( canvas.$image.css( 'maxHeight' ), canvas.$imageDiv.height() + 'px', 'MaxHeight set correctly.' );
|
||||
|
||||
$currentImage = canvas.$image;
|
||||
|
||||
|
@ -95,8 +93,6 @@
|
|||
|
||||
assert.strictEqual( image2.width, screenWidth, 'Image width was trimmed correctly.' );
|
||||
assert.notStrictEqual( canvas.$image, $currentImage, 'Image element switched correctly.' );
|
||||
assert.strictEqual( canvas.$image.css( 'maxWidth' ), canvas.$imageDiv.width() + 'px', 'MaxWidth set correctly.' );
|
||||
assert.strictEqual( canvas.$image.css( 'maxHeight' ), canvas.$imageDiv.height() + 'px', 'MaxHeight set correctly.' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'maybeDisplayPlaceholder: Constrained area for SVG files', 4, function ( assert ) {
|
||||
|
|
Loading…
Reference in a new issue