Skip to content

Commit

Permalink
fix: citeproc records type
Browse files Browse the repository at this point in the history
  • Loading branch information
Myllaume committed Jan 6, 2025
1 parent e896d43 commit d81abb4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions core/models/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default class Record {
id: citeItem.id,
title: libraryItem['title'],
content: bibliography.getNotes([citeItem])[0],
types: [config.opts.references_type_label],
};

const { error } = schema.validate(props);
Expand Down
3 changes: 2 additions & 1 deletion core/models/record.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const config = Config.getFrom({
people: { fill: '#858585', stroke: '#858585' },
},
record_metas: ['author'],
references_type_label: 'author',
});

describe('Record model', () => {
Expand Down Expand Up @@ -193,7 +194,7 @@ Content`;
expect(result).toEqual({
id: citeItem.id,
title: bibliography.library['engelbart1962'].title,
types: ['undefined'],
types: [config.opts.references_type_label],
content: note,
links: [],
metas: {},
Expand Down
23 changes: 16 additions & 7 deletions e2e/record.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,22 @@ describe('Record', () => {
});
});

it('should create bibliographic record contains quote note', () => {
cy.visit('temp/citeproc.html#matuschak2019');
assertRecordPanelIsOpened();
cy.get('.record-content:visible').should(
'contain.text',
'MATUSCHAK, Andy et NIELSEN, Michael, 2019',
);
describe('bibliographic record', () => {
beforeEach(() => {
cy.visit('temp/citeproc.html#matuschak2019');
assertRecordPanelIsOpened();
});

it('should contains quote note', () => {
cy.get('.record-content:visible').should(
'contain.text',
'MATUSCHAK, Andy et NIELSEN, Michael, 2019',
);
});

it('should has type from config', () => {
cy.get('.record.active .record-type').should('contain.text', 'reference');
});
});

it('should add quote notes at footer of record', () => {
Expand Down

0 comments on commit d81abb4

Please sign in to comment.