2017-06-06 23:38:57 +00:00
|
|
|
( function () {
|
|
|
|
'use strict';
|
|
|
|
|
Limit RelatedArticles feature to ES6 browsers
We currently require support for IntersectionObserver.
which is supported on Edge >= 15 (15 has partial support),
Firefox >55, Chrome >58, Safari 12.1, Opera >=38,
iOS Safari >=12.2, Android 100
Full ES6 is supported in Edge >=15, Firefox >=54, Chrome >=51,
Safari >=10, Opera >=38, iOS Safari >=10, so such a change
would only drop support for Edge 15 and Firefox 54.
CSS.escape is guaranteed in all these browsers according to
caniuse, with the only discrepancy being the Edge browser (versions
16-18) so it is also suggested we remove support for those browsers.
Firefox 54 accounts for 0.0026% of page views
Edge 15-18 accounts for 0.069% of page views
Bug: T306355
Change-Id: Id2987e3456607b610c38da9ee157a026d1d00ada
2022-04-18 22:20:04 +00:00
|
|
|
const CardModel = require( '../../resources/ext.relatedArticles.readMore/CardModel.js' ),
|
2022-04-15 00:49:12 +00:00
|
|
|
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 ) {
|
Limit RelatedArticles feature to ES6 browsers
We currently require support for IntersectionObserver.
which is supported on Edge >= 15 (15 has partial support),
Firefox >55, Chrome >58, Safari 12.1, Opera >=38,
iOS Safari >=12.2, Android 100
Full ES6 is supported in Edge >=15, Firefox >=54, Chrome >=51,
Safari >=10, Opera >=38, iOS Safari >=10, so such a change
would only drop support for Edge 15 and Firefox 54.
CSS.escape is guaranteed in all these browsers according to
caniuse, with the only discrepancy being the Edge browser (versions
16-18) so it is also suggested we remove support for those browsers.
Firefox 54 accounts for 0.0026% of page views
Edge 15-18 accounts for 0.069% of page views
Bug: T306355
Change-Id: Id2987e3456607b610c38da9ee157a026d1d00ada
2022-04-18 22:20:04 +00:00
|
|
|
const model = new CardModel( {
|
2017-06-06 23:38:57 +00:00
|
|
|
title: 'One',
|
|
|
|
url: mw.util.getUrl( 'One' ),
|
|
|
|
hasThumbnail: true,
|
|
|
|
thumbnailUrl: 'http://foo.bar/\');display:none;"//baz.jpg',
|
|
|
|
isThumbnailProtrait: false
|
|
|
|
} ),
|
Limit RelatedArticles feature to ES6 browsers
We currently require support for IntersectionObserver.
which is supported on Edge >= 15 (15 has partial support),
Firefox >55, Chrome >58, Safari 12.1, Opera >=38,
iOS Safari >=12.2, Android 100
Full ES6 is supported in Edge >=15, Firefox >=54, Chrome >=51,
Safari >=10, Opera >=38, iOS Safari >=10, so such a change
would only drop support for Edge 15 and Firefox 54.
CSS.escape is guaranteed in all these browsers according to
caniuse, with the only discrepancy being the Edge browser (versions
16-18) so it is also suggested we remove support for those browsers.
Firefox 54 accounts for 0.0026% of page views
Edge 15-18 accounts for 0.069% of page views
Bug: T306355
Change-Id: Id2987e3456607b610c38da9ee157a026d1d00ada
2022-04-18 22:20:04 +00:00
|
|
|
view = new CardView( model );
|
2017-06-06 23:38:57 +00:00
|
|
|
|
Limit RelatedArticles feature to ES6 browsers
We currently require support for IntersectionObserver.
which is supported on Edge >= 15 (15 has partial support),
Firefox >55, Chrome >58, Safari 12.1, Opera >=38,
iOS Safari >=12.2, Android 100
Full ES6 is supported in Edge >=15, Firefox >=54, Chrome >=51,
Safari >=10, Opera >=38, iOS Safari >=10, so such a change
would only drop support for Edge 15 and Firefox 54.
CSS.escape is guaranteed in all these browsers according to
caniuse, with the only discrepancy being the Edge browser (versions
16-18) so it is also suggested we remove support for those browsers.
Firefox 54 accounts for 0.0026% of page views
Edge 15-18 accounts for 0.069% of page views
Bug: T306355
Change-Id: Id2987e3456607b610c38da9ee157a026d1d00ada
2022-04-18 22:20:04 +00:00
|
|
|
const style = view.$el.find( '.ext-related-articles-card-thumb' )
|
2017-06-06 23:38:57 +00:00
|
|
|
.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
|
|
|
);
|
|
|
|
} );
|
|
|
|
}() );
|