Skip to content

Commit

Permalink
Merge pull request #333 from FDMediagroep/fix-infographic
Browse files Browse the repository at this point in the history
Fix infographic
  • Loading branch information
willemliufdmg committed Apr 17, 2024
2 parents d0f8a7c + 8ba68ca commit c63f17e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions __tests__/XMLToJSON.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,21 @@ describe('parseXML', () => {

expect(actual).toEqual(expected);
});
it('should return a json with infographic', () => {
const xmlString =
'<fdmg-infographic height="500"><fdmg-url>https://localfocuswidgets.net/661e726fea11a</fdmg-url></fdmg-infographic>';

const expected = [
{
name: 'fdmg-infographic',
url: 'https://localfocuswidgets.net/661e726fea11a',
height: '500',
},
];
const actual = parseXML(xmlString);

expect(actual).toEqual(expected);
});
it('should return a json with infographic extended', () => {
const xmlString =
'<fdmg-infographic-extended><graphic view="responsive" name="Mobile.svg" url="https://fd-external-development.imgix.net/d2d6138666864d50b506ca1dd5a0ecdb.png"/><graphic view="desktop" name="medium.svg" url="https://fd-external-development.imgix.net/cafecf28e8b04467ab75532b273cd6ef.png"/><graphic view="xl" name="Large.svg" url="https://fd-external-development.imgix.net/5e0594906a214cd28bf106cfa78b4520.png"/></fdmg-infographic-extended>';
Expand Down
2 changes: 1 addition & 1 deletion src/elements/infographic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface fdmgInfographic extends fdmgObject {
export const getInfographic = (element: fdmgObject): fdmgInfographic => {
const infographic: fdmgInfographic = {
name: element.name,
url: findElement(element.children, 'fdmg-id'),
url: findElement(element.children, 'fdmg-url'),
height: element.attributes?.height,
};

Expand Down

0 comments on commit c63f17e

Please sign in to comment.