mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
synced 2024-12-04 20:58:49 +00:00
32 lines
776 B
JavaScript
32 lines
776 B
JavaScript
|
/* jshint unused:false */
|
||
|
|
||
|
( 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', 1, 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.equal(
|
||
|
style,
|
||
|
'background-image: url( \'http\\:\\/\\/foo\\.bar\\/\\\'\\)\\;display\\:none\\;\\"\\/\\/baz\\.jpg\' );'
|
||
|
);
|
||
|
} );
|
||
|
}() );
|