2014-02-26 20:09:37 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the MediaWiki extension MediaViewer.
|
|
|
|
*
|
|
|
|
* MediaViewer is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MediaViewer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with MediaViewer. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
( function( mw, $ ) {
|
2014-02-28 11:50:06 +00:00
|
|
|
QUnit.module( 'mmv.ui.Canvas', QUnit.newMwEnvironment() );
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
QUnit.test( 'Constructor sanity check', 3, function( assert ) {
|
|
|
|
var $qf = $( '#qunit-fixture' ),
|
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf, $qf, $qf );
|
|
|
|
|
|
|
|
assert.ok( canvas.$imageDiv, 'Image container is created.' );
|
|
|
|
assert.strictEqual( canvas.$imageWrapper, $qf, '$imageWrapper is set correctly.' );
|
|
|
|
assert.strictEqual( canvas.$mainWrapper, $qf, '$mainWrapper is set correctly.' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
QUnit.test( 'empty() and set()', 8, function( assert ) {
|
|
|
|
var $qf = $( '#qunit-fixture' ),
|
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf ),
|
|
|
|
image = new Image(),
|
|
|
|
$imageElem = $( image ),
|
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.png' );
|
|
|
|
|
|
|
|
canvas.empty();
|
|
|
|
|
|
|
|
assert.strictEqual( canvas.$imageDiv.html(), '', 'Canvas is empty.' );
|
|
|
|
assert.ok( canvas.$imageDiv.hasClass( 'empty' ), 'Canvas is not visible.' );
|
|
|
|
|
|
|
|
canvas.set( imageRawMetadata, $imageElem );
|
|
|
|
|
|
|
|
assert.strictEqual( canvas.$image, $imageElem, 'Image element set correctly.' );
|
|
|
|
assert.strictEqual( canvas.imageRawMetadata, imageRawMetadata, 'Raw metadata set correctly.' );
|
2014-09-11 17:39:19 +00:00
|
|
|
assert.strictEqual( canvas.$imageDiv.html(), '<img>', 'Image added to container.' );
|
2014-02-26 20:09:37 +00:00
|
|
|
assert.ok( !canvas.$imageDiv.hasClass( 'empty' ), 'Canvas is visible.' );
|
|
|
|
|
|
|
|
canvas.empty();
|
|
|
|
|
|
|
|
assert.strictEqual( canvas.$imageDiv.html(), '', 'Canvas is empty.' );
|
|
|
|
assert.ok( canvas.$imageDiv.hasClass( 'empty' ), 'Canvas is not visible.' );
|
|
|
|
} );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
QUnit.test( 'setImageAndMaxDimensions()', 8, function( assert ) {
|
2014-02-26 20:09:37 +00:00
|
|
|
var $qf = $( '#qunit-fixture' ),
|
Make max-height computation more stable
Instead of setting the parent's height as max height of the
<img> element, find the first parent which has a non-automatic
height (that would be .mw-mmv-image-wrapper).
With the old structure, the height of the parent element could
be determined by the height of the image, which would then be
written back into the max-height of the image, messing up the
aspect ratio. I did not see this in the wild, but it was easy
to reproduce by changing the timing of the resize handler (in
particular, I tried to call the resize handler before loading
the new resolution, to make the UI more responsive, and ran
into this problem). This cannot happen anymore now.
This also fix a bug on some browsers (IE 10, maybe iOS Safari)
where the size of the image could be slightly larger than the
available space, and the bottom of the image was obscured by
the metadata panel. I am still not sure how exactly that
happened, but it was related to the <img> parents with automatic
heights having incorrect height. After making sure the <img>
has a max-height derived from an element with non-automatic
height, I cannot reproduce the bug on IE 10 anymore.
Change-Id: I193aefc42e6d6072717643659a9e4c0c8b7c7e93
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/698
Bug: 66244
2014-06-17 21:16:26 +00:00
|
|
|
$mainWrapper = $( '<div>' ).appendTo( $qf ),
|
|
|
|
$innerWrapper =$( '<div>' ).appendTo( $mainWrapper ),
|
|
|
|
$imageWrapper = $( '<div>' ).appendTo( $innerWrapper ),
|
|
|
|
canvas = new mw.mmv.ui.Canvas( $innerWrapper, $imageWrapper, $mainWrapper ),
|
2014-02-26 20:09:37 +00:00
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.png' ),
|
|
|
|
image = new Image(),
|
|
|
|
$imageElem = $( image ),
|
|
|
|
image2 = new Image(),
|
2014-03-04 01:58:27 +00:00
|
|
|
thumbnailWidth = 10,
|
|
|
|
screenWidth = 100,
|
|
|
|
$currentImage,
|
|
|
|
originalWidth;
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
// Need to call set() before using setImageAndMaxDimensions()
|
|
|
|
canvas.set( imageRawMetadata, $imageElem );
|
2014-03-04 01:58:27 +00:00
|
|
|
originalWidth = image.width;
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
// Call with the same image
|
2014-03-04 01:58:27 +00:00
|
|
|
canvas.setImageAndMaxDimensions(
|
|
|
|
{ width: thumbnailWidth },
|
|
|
|
image,
|
|
|
|
{ cssWidth: screenWidth }
|
|
|
|
);
|
2014-02-26 20:09:37 +00:00
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
assert.strictEqual( image.width, originalWidth, 'Image width was not modified.' );
|
2014-02-26 20:09:37 +00:00
|
|
|
assert.strictEqual( canvas.$image, $imageElem, 'Image element still set correctly.' );
|
Make max-height computation more stable
Instead of setting the parent's height as max height of the
<img> element, find the first parent which has a non-automatic
height (that would be .mw-mmv-image-wrapper).
With the old structure, the height of the parent element could
be determined by the height of the image, which would then be
written back into the max-height of the image, messing up the
aspect ratio. I did not see this in the wild, but it was easy
to reproduce by changing the timing of the resize handler (in
particular, I tried to call the resize handler before loading
the new resolution, to make the UI more responsive, and ran
into this problem). This cannot happen anymore now.
This also fix a bug on some browsers (IE 10, maybe iOS Safari)
where the size of the image could be slightly larger than the
available space, and the bottom of the image was obscured by
the metadata panel. I am still not sure how exactly that
happened, but it was related to the <img> parents with automatic
heights having incorrect height. After making sure the <img>
has a max-height derived from an element with non-automatic
height, I cannot reproduce the bug on IE 10 anymore.
Change-Id: I193aefc42e6d6072717643659a9e4c0c8b7c7e93
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/698
Bug: 66244
2014-06-17 21:16:26 +00:00
|
|
|
assert.strictEqual( canvas.$image.css( 'maxWidth' ), canvas.$imageDiv.width() + 'px', 'MaxWidth set correctly.' );
|
2014-02-26 20:09:37 +00:00
|
|
|
assert.strictEqual( canvas.$image.css( 'maxHeight' ), canvas.$imageDiv.height() + 'px', 'MaxHeight set correctly.' );
|
|
|
|
|
|
|
|
$currentImage = canvas.$image;
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
// Call with a new image bigger than screen size
|
|
|
|
thumbnailWidth = 150;
|
|
|
|
canvas.setImageAndMaxDimensions(
|
|
|
|
{ width: thumbnailWidth },
|
|
|
|
image2,
|
|
|
|
{ cssWidth: screenWidth }
|
|
|
|
);
|
2014-02-26 20:09:37 +00:00
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
assert.strictEqual( image2.width, screenWidth, 'Image width was trimmed correctly.' );
|
|
|
|
assert.notStrictEqual( canvas.$image, $currentImage, 'Image element switched correctly.' );
|
Make max-height computation more stable
Instead of setting the parent's height as max height of the
<img> element, find the first parent which has a non-automatic
height (that would be .mw-mmv-image-wrapper).
With the old structure, the height of the parent element could
be determined by the height of the image, which would then be
written back into the max-height of the image, messing up the
aspect ratio. I did not see this in the wild, but it was easy
to reproduce by changing the timing of the resize handler (in
particular, I tried to call the resize handler before loading
the new resolution, to make the UI more responsive, and ran
into this problem). This cannot happen anymore now.
This also fix a bug on some browsers (IE 10, maybe iOS Safari)
where the size of the image could be slightly larger than the
available space, and the bottom of the image was obscured by
the metadata panel. I am still not sure how exactly that
happened, but it was related to the <img> parents with automatic
heights having incorrect height. After making sure the <img>
has a max-height derived from an element with non-automatic
height, I cannot reproduce the bug on IE 10 anymore.
Change-Id: I193aefc42e6d6072717643659a9e4c0c8b7c7e93
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/698
Bug: 66244
2014-06-17 21:16:26 +00:00
|
|
|
assert.strictEqual( canvas.$image.css( 'maxWidth' ), canvas.$imageDiv.width() + 'px', 'MaxWidth set correctly.' );
|
2014-02-26 20:09:37 +00:00
|
|
|
assert.strictEqual( canvas.$image.css( 'maxHeight' ), canvas.$imageDiv.height() + 'px', 'MaxHeight set correctly.' );
|
|
|
|
} );
|
|
|
|
|
2014-04-15 00:01:03 +00:00
|
|
|
QUnit.test( 'maybeDisplayPlaceholder: Constrained area for SVG files', 4, function ( assert ) {
|
2014-02-26 20:09:37 +00:00
|
|
|
var $image,
|
|
|
|
blurredThumbnailShown,
|
|
|
|
$qf = $( '#qunit-fixture' ),
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.svg' ),
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata.filePageTitle = {
|
2014-05-28 22:43:35 +00:00
|
|
|
getExtension: function() { return 'svg'; }
|
2014-03-04 01:58:27 +00:00
|
|
|
};
|
|
|
|
canvas.imageRawMetadata = imageRawMetadata;
|
|
|
|
|
|
|
|
canvas.set = function () {
|
2014-04-15 00:01:03 +00:00
|
|
|
assert.ok ( false, 'Placeholder is not shown');
|
2014-03-04 01:58:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
$image = $( '<img>' ).width( 10 ).height( 5 );
|
|
|
|
|
|
|
|
blurredThumbnailShown = canvas.maybeDisplayPlaceholder(
|
|
|
|
{ width : 200, height : 100 },
|
|
|
|
$image,
|
|
|
|
{ cssWidth : 300, cssHeight: 150 }
|
|
|
|
);
|
|
|
|
|
2014-04-15 00:01:03 +00:00
|
|
|
assert.strictEqual( $image.width(), 10, 'Placeholder width was not set to max' );
|
|
|
|
assert.strictEqual( $image.height(), 5, 'Placeholder height was not set to max' );
|
2014-03-04 01:58:27 +00:00
|
|
|
assert.ok( ! $image.hasClass( 'blurred' ), 'Placeholder is not blurred' );
|
|
|
|
assert.ok( ! blurredThumbnailShown, 'Placeholder state is correct' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
QUnit.test( 'maybeDisplayPlaceholder: placeholder big enough that it doesn\'t need blurring, actual image bigger than the lightbox', 5, function ( assert ) {
|
|
|
|
var $image,
|
|
|
|
blurredThumbnailShown,
|
|
|
|
$qf = $( '#qunit-fixture' ),
|
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.png' ),
|
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf );
|
|
|
|
|
|
|
|
imageRawMetadata.filePageTitle = {
|
2014-05-28 22:43:35 +00:00
|
|
|
getExtension: function() { return 'png'; }
|
2014-03-04 01:58:27 +00:00
|
|
|
};
|
|
|
|
canvas.imageRawMetadata = imageRawMetadata;
|
|
|
|
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas.set = function () {
|
|
|
|
assert.ok ( true, 'Placeholder shown');
|
|
|
|
};
|
|
|
|
|
|
|
|
$image = $( '<img>' ).width( 200 ).height( 100 );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
blurredThumbnailShown = canvas.maybeDisplayPlaceholder(
|
2014-02-26 20:09:37 +00:00
|
|
|
{ width : 1000, height : 500 },
|
|
|
|
$image,
|
2014-03-04 01:58:27 +00:00
|
|
|
{ cssWidth : 300, cssHeight: 150 }
|
2014-02-26 20:09:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
assert.strictEqual( $image.width(), 300, 'Placeholder has the right width' );
|
|
|
|
assert.strictEqual( $image.height(), 150, 'Placeholder has the right height' );
|
|
|
|
assert.ok( ! $image.hasClass( 'blurred' ), 'Placeholder is not blurred' );
|
|
|
|
assert.ok( ! blurredThumbnailShown, 'Placeholder state is correct' );
|
|
|
|
} );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
QUnit.test( 'maybeDisplayPlaceholder: big-enough placeholder that needs blurring, actual image bigger than the lightbox', 5, function ( assert ) {
|
2014-02-26 20:09:37 +00:00
|
|
|
var $image,
|
|
|
|
blurredThumbnailShown,
|
|
|
|
$qf = $( '#qunit-fixture' ),
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.png' ),
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata.filePageTitle = {
|
2014-05-28 22:43:35 +00:00
|
|
|
getExtension: function() { return 'png'; }
|
2014-03-04 01:58:27 +00:00
|
|
|
};
|
|
|
|
canvas.imageRawMetadata = imageRawMetadata;
|
|
|
|
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas.set = function () {
|
|
|
|
assert.ok ( true, 'Placeholder shown');
|
|
|
|
};
|
|
|
|
|
|
|
|
$image = $( '<img>' ).width( 100 ).height( 50 );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
blurredThumbnailShown = canvas.maybeDisplayPlaceholder(
|
2014-02-26 20:09:37 +00:00
|
|
|
{ width : 1000, height : 500 },
|
|
|
|
$image,
|
2014-03-04 01:58:27 +00:00
|
|
|
{ cssWidth : 300, cssHeight : 150 }
|
2014-02-26 20:09:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
assert.strictEqual( $image.width(), 300, 'Placeholder has the right width' );
|
|
|
|
assert.strictEqual( $image.height(), 150, 'Placeholder has the right height' );
|
|
|
|
assert.ok( $image.hasClass( 'blurred' ), 'Placeholder is blurred' );
|
|
|
|
assert.ok( blurredThumbnailShown, 'Placeholder state is correct' );
|
|
|
|
} );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
QUnit.test( 'maybeDisplayPlaceholder: big-enough placeholder that needs blurring, actual image smaller than the lightbox', 5, function ( assert ) {
|
2014-02-26 20:09:37 +00:00
|
|
|
var $image,
|
|
|
|
blurredThumbnailShown,
|
|
|
|
$qf = $( '#qunit-fixture' ),
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.png' ),
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata.filePageTitle = {
|
2014-05-28 22:43:35 +00:00
|
|
|
getExtension: function() { return 'png'; }
|
2014-03-04 01:58:27 +00:00
|
|
|
};
|
|
|
|
canvas.imageRawMetadata = imageRawMetadata;
|
|
|
|
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas.set = function () {
|
|
|
|
assert.ok ( true, 'Placeholder shown');
|
|
|
|
};
|
|
|
|
|
|
|
|
$image = $( '<img>' ).width( 100 ).height( 50 );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
blurredThumbnailShown = canvas.maybeDisplayPlaceholder(
|
2014-02-26 20:09:37 +00:00
|
|
|
{ width : 1000, height : 500 },
|
|
|
|
$image,
|
2014-03-04 01:58:27 +00:00
|
|
|
{ cssWidth : 1200, cssHeight : 600 }
|
2014-02-26 20:09:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
assert.strictEqual( $image.width(), 1000, 'Placeholder has the right width' );
|
|
|
|
assert.strictEqual( $image.height(), 500, 'Placeholder has the right height' );
|
|
|
|
assert.ok( $image.hasClass( 'blurred' ), 'Placeholder is blurred' );
|
|
|
|
assert.ok( blurredThumbnailShown, 'Placeholder state is correct' );
|
|
|
|
} );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
QUnit.test( 'maybeDisplayPlaceholder: placeholder too small to be displayed, actual image bigger than the lightbox', 4, function ( assert ) {
|
2014-02-26 20:09:37 +00:00
|
|
|
var $image,
|
|
|
|
blurredThumbnailShown,
|
|
|
|
$qf = $( '#qunit-fixture' ),
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata = new mw.mmv.LightboxImage( 'foo.png' ),
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
imageRawMetadata.filePageTitle = {
|
2014-05-28 22:43:35 +00:00
|
|
|
getExtension: function() { return 'png'; }
|
2014-03-04 01:58:27 +00:00
|
|
|
};
|
|
|
|
canvas.imageRawMetadata = imageRawMetadata;
|
|
|
|
|
2014-02-26 20:09:37 +00:00
|
|
|
canvas.set = function () {
|
|
|
|
assert.ok ( false, 'Placeholder shown when it should not');
|
|
|
|
};
|
|
|
|
|
|
|
|
$image = $( '<img>' ).width( 10 ).height( 5 );
|
|
|
|
|
2014-03-04 01:58:27 +00:00
|
|
|
blurredThumbnailShown = canvas.maybeDisplayPlaceholder(
|
2014-02-26 20:09:37 +00:00
|
|
|
{ width : 1000, height : 500 },
|
|
|
|
$image,
|
2014-03-04 01:58:27 +00:00
|
|
|
{ cssWidth : 300, cssHeight : 150 }
|
2014-02-26 20:09:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
assert.strictEqual( $image.width(), 10, 'Placeholder has the right width' );
|
|
|
|
assert.strictEqual( $image.height(), 5, 'Placeholder has the right height' );
|
|
|
|
assert.ok( ! $image.hasClass( 'blurred' ), 'Placeholder is not blurred' );
|
|
|
|
assert.ok( ! blurredThumbnailShown, 'Placeholder state is correct' );
|
|
|
|
} );
|
|
|
|
|
2014-05-14 10:02:39 +00:00
|
|
|
QUnit.test( 'Unblur', 4, function ( assert ) {
|
2014-02-26 20:09:37 +00:00
|
|
|
var $qf = $( '#qunit-fixture' ),
|
|
|
|
canvas = new mw.mmv.ui.Canvas( $qf ),
|
|
|
|
oldAnimate = $.fn.animate;
|
|
|
|
|
|
|
|
$.fn.animate = function ( target, options ) {
|
|
|
|
var self = this,
|
|
|
|
lastValue;
|
|
|
|
|
|
|
|
$.each( target, function ( key, value ) {
|
|
|
|
lastValue = self.key = value;
|
|
|
|
} );
|
|
|
|
|
|
|
|
if ( options ) {
|
|
|
|
if ( options.step ) {
|
|
|
|
options.step.call( this, lastValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( options.complete ) {
|
|
|
|
options.complete.call( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
canvas.$image = $( '<img>' );
|
|
|
|
|
Refactor progressbar & blur handling
This tries to fix a number of related issues:
* the blurred thumbnail was visible for a split-second sometimes
when switching back to an already-loaded image. (Presumably when
JS was sluggish enough to take more than 10 ms to execute.) We
now check whether the promise is pending before showing a placeholder.
(More generally, a lot of unnecessary logic was executed when paging
through already loaded images, like displaying the placeholder, so
this might make the UI a bit more responsive.)
* the blur could get stuck sometimes - I have seen this a few times,
but have never been able to reproduce it, so I'm only guessing, but
maybe the timing was really unfortunate, and we switched back less
than 10 ms before loading finished. We now remove the blur on every
branch, just to be sure.
* adding a progress handler to a promise might not have any immediate
effect, so when switching to an image which was loading, the progress
bar reacted too late. We now store the progress state per thumbnail
so it is always available immediately.
* the progress would animate from 0 to its actual state whenever we
navigated to the image. The change on paging is now instant; the
progress bar only animates when we are looking at it.
* switching quickly back and forthe between a loaded and a loading
image resulted in the loading image becoming unblurred. This seems
fixed now, I'm not sure why. Maybe the "skip on non-pending promise"
logic affects it somehow.
Also removes some unused things / renames some things which were
confusing, and makes an unrelated fix in the image provider, which kept
amassing fail handlers.
Change-Id: I580becff246f197ec1bc65e82acd422620e35578
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/489
2014-04-25 22:26:34 +00:00
|
|
|
canvas.unblurWithAnimation();
|
2014-02-26 20:09:37 +00:00
|
|
|
|
|
|
|
assert.ok( ! canvas.$image.css( '-webkit-filter' ) || !canvas.$image.css( '-webkit-filter' ).length,
|
2014-05-14 10:02:39 +00:00
|
|
|
'Image has no -webkit-filter left' );
|
|
|
|
assert.ok( ! canvas.$image.css( 'filter' ) || !canvas.$image.css( 'filter' ).length || canvas.$image.css( 'filter' ) === 'none',
|
2014-02-26 20:09:37 +00:00
|
|
|
'Image has no filter left' );
|
|
|
|
assert.strictEqual( parseInt( canvas.$image.css( 'opacity' ), 10 ), 1,
|
|
|
|
'Image is fully opaque' );
|
|
|
|
assert.ok( ! canvas.$image.hasClass( 'blurred' ), 'Image has no "blurred" class' );
|
|
|
|
|
|
|
|
$.fn.animate = oldAnimate;
|
|
|
|
} );
|
|
|
|
|
|
|
|
}( mediaWiki, jQuery ) );
|