From 300d5ec486e23fbde729fd3f5c4eff164dad7ce8 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Fri, 18 May 2018 20:55:35 +0200 Subject: [PATCH] MWInternalLinkAnnotation: test fragment behavior Bug: T194463 Change-Id: I08d587c4e4cd12b1362915a22b37d9a0224de198 --- .../dm/ve.dm.MWInternalLinkAnnotation.test.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js b/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js index 187d378165..a766ecff10 100644 --- a/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js +++ b/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js @@ -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 );