| 1 | 'use strict'; |
| 2 | |
| 3 | QUnit.module( 've.dm.MWDocumentReferences (Cite)', ve.test.utils.newMwEnvironment() ); |
| 4 | |
| 5 | QUnit.test( 'first simple test', ( assert ) => { |
| 6 | const doc = ve.dm.citeExample.createExampleDocument( 'references' ); |
| 7 | const docRefs = ve.dm.MWDocumentReferences.static.refsForDoc( doc ); |
| 8 | |
| 9 | assert.strictEqual( docRefs.getIndexLabel( '', 'auto/0' ), '1' ); |
| 10 | assert.strictEqual( docRefs.getIndexLabel( '', 'literal/bar' ), '2' ); |
| 11 | assert.strictEqual( docRefs.getIndexLabel( '', 'literal/:3' ), '3' ); |
| 12 | assert.strictEqual( docRefs.getIndexLabel( '', 'auto/1' ), '4' ); |
| 13 | assert.strictEqual( docRefs.getIndexLabel( 'foo', 'auto/2' ), '1' ); |
| 14 | } ); |
| 15 | |
| 16 | QUnit.test( 'extends test', ( assert ) => { |
| 17 | const doc = ve.dm.citeExample.createExampleDocument( 'extends' ); |
| 18 | const docRefs = ve.dm.MWDocumentReferences.static.refsForDoc( doc ); |
| 19 | |
| 20 | assert.strictEqual( docRefs.getIndexLabel( '', 'auto/0' ), '1.1' ); |
| 21 | assert.strictEqual( docRefs.getIndexLabel( '', 'auto/1' ), '2' ); |
| 22 | assert.strictEqual( docRefs.getIndexLabel( '', 'literal/orphaned' ), '3.1' ); |
| 23 | assert.strictEqual( docRefs.getIndexLabel( '', 'literal/ldr' ), '1' ); |
| 24 | } ); |