Skip to content

Commit 6edce2b

Browse files
committed
Fix issue with checking if ref is from included archive.
1 parent 656fc0c commit 6edce2b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/mixins/referencesProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default {
5353
}
5454

5555
return includedArchiveIdentifiers.some(archiveId => (
56-
id?.startsWith(`doc://${archiveId}`)
56+
id?.startsWith(`doc://${archiveId}/`)
5757
));
5858
},
5959
},

tests/unit/mixins/referencesProvider.spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,17 @@ const bb = {
4545
url: '/documentation/B/b',
4646
title: 'B.B',
4747
};
48+
const bbb = {
49+
identifier: 'doc://BB/documentation/BB/b',
50+
url: '/documentation/BB/b',
51+
title: 'BB.B',
52+
};
4853

4954
const references = {
5055
[aa.identifier]: aa,
5156
[ab.identifier]: ab,
5257
[bb.identifier]: bb,
58+
[bbb.identifier]: bbb,
5359
};
5460

5561
const provide = {
@@ -85,7 +91,7 @@ describe('referencesProvider', () => {
8591
// `includedArchiveIdentifiers` contains all refs - no changes to refs
8692
outer.setData({
8793
appState: {
88-
includedArchiveIdentifiers: ['A', 'B'],
94+
includedArchiveIdentifiers: ['A', 'B', 'BB'],
8995
},
9096
});
9197
inner = outer.find(FakeComponentInner);
@@ -109,5 +115,7 @@ describe('referencesProvider', () => {
109115
expect(refs3[ab.identifier].url).toBeFalsy(); // ab `url` is gone now
110116
expect(refs3[bb.identifier].title).toBe(bb.title);
111117
expect(refs3[bb.identifier].url).toBe(bb.url); // bb still has `url`
118+
expect(refs3[bbb.identifier].title).toBe(bbb.title);
119+
expect(refs3[bbb.identifier].url).toBeFalsy(); // bbb `url` is gone now
112120
});
113121
});

0 commit comments

Comments
 (0)