MWInternalLinkAnnotation: test fragment behavior

Bug: T194463
Change-Id: I08d587c4e4cd12b1362915a22b37d9a0224de198
This commit is contained in:
David Lynch 2018-05-18 20:55:35 +02:00
parent a47b78e18c
commit 300d5ec486

View file

@ -43,6 +43,36 @@ QUnit.test( 'toDataElement', function ( assert ) {
title: 'Foo?'
}
}
},
{
// The fragment should make it into some parts of this, and not others
msg: 'Fragments',
element: internalLink( 'Foo#bar' ),
expected: {
type: 'link/mwInternal',
attributes: {
hrefPrefix: '',
lookupTitle: 'Foo',
normalizedTitle: 'Foo#bar',
origTitle: 'Foo#bar',
title: 'Foo#bar'
}
}
},
{
// Question marks in the fragment shouldn't confuse this
msg: 'Question marks in fragments',
element: internalLink( 'Foo#bar?' ),
expected: {
type: 'link/mwInternal',
attributes: {
hrefPrefix: '',
lookupTitle: 'Foo',
normalizedTitle: 'Foo#bar.3F',
origTitle: 'Foo#bar.3F',
title: 'Foo#bar.3F'
}
}
}
],
converter = new ve.dm.Converter( ve.dm.modelRegistry, ve.dm.nodeFactory, ve.dm.annotationFactory, ve.dm.metaItemFactory );