2017-06-06 23:38:57 +00:00
|
|
|
( function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var CardModel = mw.cards.CardModel,
|
|
|
|
CardView = mw.cards.CardView;
|
|
|
|
|
|
|
|
QUnit.module( 'ext.relatedArticles.cards/CardView' );
|
|
|
|
|
2017-09-01 15:16:31 +00:00
|
|
|
QUnit.test( '#_render escapes the thumbnailUrl model attribute', function ( assert ) {
|
2017-06-06 23:38:57 +00:00
|
|
|
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\' );'
|
|
|
|
);
|
|
|
|
} );
|
|
|
|
}() );
|