2017-06-06 23:38:57 +00:00
|
|
|
( function () {
|
|
|
|
'use strict';
|
|
|
|
|
2022-04-15 00:49:12 +00:00
|
|
|
var CardModel = require( '../../resources/ext.relatedArticles.readMore/CardModel.js' ),
|
|
|
|
CardView = require( '../../resources/ext.relatedArticles.readMore/CardView.js' );
|
2017-06-06 23:38:57 +00:00
|
|
|
|
|
|
|
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' );
|
|
|
|
|
2018-11-12 19:13:43 +00:00
|
|
|
assert.strictEqual(
|
2017-06-06 23:38:57 +00:00
|
|
|
style,
|
2019-05-01 11:01:56 +00:00
|
|
|
"background-image: url(\"http://foo.bar/');display:none;\\\"//baz.jpg\");"
|
2017-06-06 23:38:57 +00:00
|
|
|
);
|
|
|
|
} );
|
|
|
|
}() );
|