diff --git a/addon/components/prismic/children.hbs b/addon/components/prismic/children.hbs index 2c94223a..9c893a3b 100644 --- a/addon/components/prismic/children.hbs +++ b/addon/components/prismic/children.hbs @@ -1,5 +1,9 @@ {{~#each @node.children as |child|~}} - + {{~else~}} {{~@node.element.text~}} {{~/each~}} \ No newline at end of file diff --git a/addon/components/prismic/dom.hbs b/addon/components/prismic/dom.hbs index 968dd4c7..e61420e1 100644 --- a/addon/components/prismic/dom.hbs +++ b/addon/components/prismic/dom.hbs @@ -3,7 +3,11 @@ {{@nodes}} {{~else~}} {{~#each this.tree.children as |child|~}} - + {{~/each~}} {{~/if~}} \ No newline at end of file diff --git a/addon/components/prismic/element.hbs b/addon/components/prismic/element.hbs index 4c6973bc..4a5aa27d 100644 --- a/addon/components/prismic/element.hbs +++ b/addon/components/prismic/element.hbs @@ -1,15 +1,27 @@ -{{~#if (eq @node.type "image")~}} +{{~#if (eq @node.type 'image')~}} -{{~else if (eq @node.type "span")~}} - -{{~else if (eq @node.type "hyperlink")~}} +{{~else if (eq @node.type 'span')~}} + +{{~else if (eq @node.type 'hyperlink')~}} + > {{~else~}} {{~#let (element this.tagName) as |Tag|~}} - + {{~/let~}} {{~/if~}} \ No newline at end of file diff --git a/tests/integration/components/prismic/dom-test.js b/tests/integration/components/prismic/dom-test.js index 5860f38e..e31116c2 100644 --- a/tests/integration/components/prismic/dom-test.js +++ b/tests/integration/components/prismic/dom-test.js @@ -17,6 +17,40 @@ module('Integration | Component | prismic/dom', function (hooks) { }); module('complex combinations', function () { + test('doc hyperlink with linkResolver', async function (assert) { + this.nodes = [ + { + type: 'paragraph', + text: 'A link to another doc', + spans: [ + { + start: 18, + end: 21, + type: 'hyperlink', + data: { + id: 'YAlUbREAACIAEKtG', + type: 'faq_article', + tags: ['transaction_helper_cards'], + slug: 'processing-card-transaction', + lang: 'en-us', + link_type: 'Document', + isBroken: false, + }, + }, + ], + }, + ]; + this.linkResolver = ({ uid }) => `https://qonto.com/${uid}`; + + await render( + hbs`` + ); + + assert + .dom('a') + .hasProperty('href', 'https://qonto.com/processing-card-transaction'); + }); + test('list', async function (assert) { this.nodes = [ { type: 'o-list-item', text: 'one', spans: [] },