2024-07-26 19:00:58 +00:00
|
|
|
'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 );
|
|
|
|
|
2024-08-21 13:19:32 +00:00
|
|
|
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' );
|
2024-07-26 19:00:58 +00:00
|
|
|
} );
|
2024-07-29 09:33:34 +00:00
|
|
|
|
|
|
|
QUnit.test( 'extends test', ( assert ) => {
|
|
|
|
const doc = ve.dm.citeExample.createExampleDocument( 'extends' );
|
|
|
|
const docRefs = ve.dm.MWDocumentReferences.static.refsForDoc( doc );
|
|
|
|
|
2024-08-21 13:19:32 +00:00
|
|
|
// FIXME: Shows that the class doesn't handle orphans correctly
|
|
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'auto/0' ), '3.1' );
|
|
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'auto/1' ), '1' );
|
|
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'literal/orphaned' ), '2' );
|
|
|
|
assert.strictEqual( docRefs.getIndexLabel( '', 'literal/ldr' ), '3' );
|
2024-07-29 09:33:34 +00:00
|
|
|
} );
|