mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-24 04:22:51 +00:00
6e03d2cafa
Pushes per-group knowledge down into a structured object and give it an interface, separated from the singleton cache across all groups. Also changes the behavior of orphaned subrefs so that they're still rendered as subrefs, with an error placeholder where the parent should be. Bug: T372871 Change-Id: I84e679a8365f3fbfabaf344d99f56f6d069c0776
25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
QUnit.module( 've.dm.MWDocumentReferences (Cite)', ve.test.utils.newMwEnvironment() );
|
|
|
|
QUnit.test( 'first simple test', ( assert ) => {
|
|
const doc = ve.dm.citeExample.createExampleDocument( 'references' );
|
|
const docRefs = ve.dm.MWDocumentReferences.static.refsForDoc( doc );
|
|
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'auto/0' ), '1' );
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'literal/bar' ), '2' );
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'literal/:3' ), '3' );
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'auto/1' ), '4' );
|
|
assert.strictEqual( docRefs.getIndexLabel( 'foo', 'auto/2' ), '1' );
|
|
} );
|
|
|
|
QUnit.test( 'extends test', ( assert ) => {
|
|
const doc = ve.dm.citeExample.createExampleDocument( 'extends' );
|
|
const docRefs = ve.dm.MWDocumentReferences.static.refsForDoc( doc );
|
|
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'auto/0' ), '1.1' );
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'auto/1' ), '2' );
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'literal/orphaned' ), '3.1' );
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'literal/ldr' ), '1' );
|
|
} );
|