mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Move test for escaped URLs into seperate check
With this I want to pull apart testing two things at one, checking if the URL is escaped and if it is put to the right position. So this adds an explicit test, that makes sure that urls in the popup are escaped safely and lets the big test become more general in that regard. Bug: T214971 Change-Id: I09b5225a8370e8b1337b2cf6ca03ccb79b3a64aa
This commit is contained in:
parent
f688bfebdd
commit
de8f7a133c
|
@ -296,7 +296,7 @@ QUnit.test( 'createDisambiguationPreview(model)', ( assert ) => {
|
|||
|
||||
QUnit.test( 'createReferencePreview(model)', ( assert ) => {
|
||||
const model = {
|
||||
url: '#custom_id <"\'>',
|
||||
url: '#custom_id',
|
||||
extract: 'Custom <i>extract</i> with a <a href="//wikipedia.de">link</a>',
|
||||
type: previewTypes.TYPE_REFERENCE,
|
||||
referenceType: 'web'
|
||||
|
@ -319,6 +319,21 @@ QUnit.test( 'createReferencePreview(model)', ( assert ) => {
|
|||
1,
|
||||
'links in (and only in) the content open in new tabs'
|
||||
);
|
||||
assert.strictEqual(
|
||||
preview.el.find( '.mwe-popups-read-link' ).attr( 'href' ),
|
||||
'#custom_id',
|
||||
'readlink is correctly linked'
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( 'createReferencePreview escapes URLs safely', ( assert ) => {
|
||||
const model = {
|
||||
url: '#custom_id <"\'>',
|
||||
extract: '',
|
||||
type: previewTypes.TYPE_REFERENCE
|
||||
},
|
||||
preview = renderer.createPreviewWithType( model );
|
||||
|
||||
assert.strictEqual(
|
||||
preview.el.find( '.mwe-popups-read-link' ).attr( 'href' ),
|
||||
'#custom_id <"\'>',
|
||||
|
|
Loading…
Reference in a new issue