Specify document base URLs in more test cases

Depends-On: I0e301bef38d97fa2234aa901c787360d9fbde8a3
Change-Id: I07a8c097dba0f5572c0aedf4febdf1434063ea6f
This commit is contained in:
Bartosz Dziewoński 2023-01-21 18:00:56 +01:00
parent 30d02d99ac
commit a845923a65
2 changed files with 14 additions and 7 deletions

View file

@ -12,7 +12,11 @@ QUnit.test( 'getModelFromDom', function ( assert ) {
for ( var msg in cases ) {
var caseItem = ve.copy( cases[ msg ] );
// TODO: Cite tests contain unsecaped < in attrs, handle this upstream somehow
caseItem.base = ve.dm.citeExample.baseUri;
caseItem.mwConfig = {
wgArticlePath: '/wiki/$1'
};
// TODO: Cite tests contain unescaped < in attrs, handle this upstream somehow
caseItem.ignoreXmlWarnings = true;
if ( caseItem.mwConfig ) {
mw.config.set( caseItem.mwConfig );
@ -27,7 +31,11 @@ QUnit.test( 'getDomFromModel', function ( assert ) {
for ( var msg in cases ) {
var caseItem = ve.copy( cases[ msg ] );
// TODO: Cite tests contain unsecaped < in attrs, handle this upstream somehow
caseItem.base = ve.dm.citeExample.baseUri;
caseItem.mwConfig = {
wgArticlePath: '/wiki/$1'
};
// TODO: Cite tests contain unescaped < in attrs, handle this upstream somehow
caseItem.ignoreXmlWarnings = true;
if ( caseItem.mwConfig ) {
mw.config.set( caseItem.mwConfig );

View file

@ -7,8 +7,10 @@
ve.dm.citeExample = {};
ve.dm.citeExample.createExampleDocument = function ( name, store ) {
return ve.dm.example.createExampleDocumentFromObject( name, store, ve.dm.citeExample );
ve.dm.citeExample.baseUri = 'http://example.com/wiki/';
ve.dm.citeExample.createExampleDocument = function ( name, store, base ) {
return ve.dm.example.createExampleDocumentFromObject( name, store, ve.dm.citeExample, base || ve.dm.citeExample.baseUri );
};
ve.dm.citeExample.refListItemClipboard = function ( text ) {
@ -158,7 +160,6 @@ ve.dm.citeExample.domToDataCases = {
'</li>' +
'</ol>' +
'</div>',
head: '<base href="http://example.com/wiki/" />',
data: [
{ type: 'paragraph' },
'F', 'o', 'o',
@ -376,7 +377,6 @@ ve.dm.citeExample.domToDataCases = {
'<a style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a>' +
'</sup>' +
'</p>',
head: '<base href="http://example.com/wiki/" />',
data: [
{ type: 'paragraph' },
'F', 'o', 'o',
@ -469,7 +469,6 @@ ve.dm.citeExample.domToDataCases = {
'{&quot;html&quot;:&quot;Foo<!-- bar -->&quot;},&quot;name&quot;:&quot;ref&quot;}" ' +
' class="mw-ref reference">' +
'<a style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>',
head: '<base href="http://example.com/wiki/" />',
data: [
{ type: 'paragraph' },
{