mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-12-19 03:20:44 +00:00
fcd4d1a272
pass a collection of jQuery objects to `.append` instead of and array. Use `.css` instead of `.attr` to set thumbnail background image. Change a unit to reflect the escaping pattern of the `.css` method Bug: T219846 Change-Id: I6359be2db6c7c7a8e4b52296e0801d4ded921b46
30 lines
724 B
JavaScript
30 lines
724 B
JavaScript
( function () {
|
|
'use strict';
|
|
|
|
var CardModel = mw.cards.CardModel,
|
|
CardView = mw.cards.CardView;
|
|
|
|
QUnit.module( 'ext.relatedArticles.cards/CardView' );
|
|
|
|
QUnit.test( '#_render escapes the thumbnailUrl model attribute', function ( assert ) {
|
|
var model = new CardModel( {
|
|
title: 'One',
|
|
url: mw.util.getUrl( 'One' ),
|
|
hasThumbnail: true,
|
|
thumbnailUrl: 'http://foo.bar/\');display:none;"//baz.jpg',
|
|
isThumbnailProtrait: false
|
|
} ),
|
|
view = new CardView( model ),
|
|
style;
|
|
|
|
style = view.$el.find( '.ext-related-articles-card-thumb' )
|
|
.eq( 0 )
|
|
.attr( 'style' );
|
|
|
|
assert.strictEqual(
|
|
style,
|
|
"background-image: url(\"http://foo.bar/');display:none;\\\"//baz.jpg\");"
|
|
);
|
|
} );
|
|
}() );
|