diff --git a/src/PropertiesPanel.js b/src/PropertiesPanel.js index f2273059..43b24516 100644 --- a/src/PropertiesPanel.js +++ b/src/PropertiesPanel.js @@ -117,6 +117,7 @@ const DEFAULT_TOOLTIP = {}; * @param {TooltipConfig} [props.tooltipConfig] * @param {Function} [props.tooltipLoaded] * @param {HTMLElement} [props.feelPopupContainer] + * @param {Function} [props.getFeelPopupLinks] * @param {Object} [props.eventBus] */ export default function PropertiesPanel(props) { @@ -132,6 +133,7 @@ export default function PropertiesPanel(props) { tooltipConfig, tooltipLoaded, feelPopupContainer, + getFeelPopupLinks, eventBus } = props; @@ -243,7 +245,8 @@ export default function PropertiesPanel(props) { + popupContainer={ feelPopupContainer } + getPopupLinks={ getFeelPopupLinks }>
[] } = props; const prevElement = usePrevious(element); @@ -121,6 +122,7 @@ export default function FEELPopupRoot(props) { @@ -133,6 +135,7 @@ export default function FEELPopupRoot(props) { function FeelPopupComponent(props) { const { container, + getLinks, id, hostLanguage, onInput, @@ -218,20 +221,16 @@ function FeelPopupComponent(props) { closeButtonTooltip="Save and close" onClose={ onClose } draggable> - {type === 'feel' && ( - - Learn FEEL expressions - - - ) - } - {type === 'feelers' && ( - - Learn templating - - - ) - } + <> + { + getLinks(type).map((link) => { + return + { link.title} + + ; + }) + } +
+ + + diff --git a/src/components/icons/help.svg b/src/components/icons/help.svg deleted file mode 100644 index 2f0ca40d..00000000 --- a/src/components/icons/help.svg +++ /dev/null @@ -1 +0,0 @@ -help \ No newline at end of file diff --git a/src/components/icons/index.js b/src/components/icons/index.js index c64ff131..39c16dbf 100644 --- a/src/components/icons/index.js +++ b/src/components/icons/index.js @@ -1,9 +1,9 @@ export { default as ArrowIcon } from './Arrow.svg'; +export { default as CloseIcon } from './Close.svg'; export { default as CreateIcon } from './Create.svg'; export { default as DeleteIcon } from './Delete.svg'; export { default as DragIcon } from './Drag.svg'; export { default as ExternalLinkIcon } from './ExternalLink.svg'; export { default as FeelIcon } from './Feel.svg'; -export { default as HelpIcon } from './help.svg'; -export { default as PopupIcon } from './Popup.svg'; -export { default as CloseIcon } from './Close.svg'; \ No newline at end of file +export { default as LaunchIcon } from './Launch.svg'; +export { default as PopupIcon } from './Popup.svg'; \ No newline at end of file diff --git a/test/spec/components/FeelPopup.spec.js b/test/spec/components/FeelPopup.spec.js index 94b124bc..69a5566d 100644 --- a/test/spec/components/FeelPopup.spec.js +++ b/test/spec/components/FeelPopup.spec.js @@ -12,7 +12,8 @@ import TestContainer from 'mocha-test-container-support'; import EventBus from 'diagram-js/lib/core/EventBus'; import { - query as domQuery + query as domQuery, + queryAll as domQueryAll } from 'min-dom'; import { @@ -78,6 +79,49 @@ describe('', function() { }); + it('should render links', async function() { + + // given + const parent = document.createElement('div'); + + // when + createFeelPopup({ + popupContainer: parent, + getPopupLinks: (type) => { + if (type === 'foo') { + return [ + { href: 'https://foo.com/', title: 'Foo' }, + { href: 'https://bar.com/', title: 'Bar' } + ]; + } + + return []; + }, + type: 'foo' + }, container); + + const childComponent = domQuery('.child-component', container); + + const btn = domQuery('button', childComponent); + + // when + await act(() => { + btn.click(); + }); + + // then + const links = domQueryAll('.bio-properties-panel-feel-popup__title-link', parent); + + expect(links.length).to.equal(2); + + expect(links[0].href).to.equal('https://foo.com/'); + expect(links[0].textContent).to.equal('Foo'); + + expect(links[1].href).to.equal('https://bar.com/'); + expect(links[1].textContent).to.equal('Bar'); + }); + + it('should restore focus on source element', async function() { // given @@ -412,25 +456,6 @@ describe('', function() { }); - it('should link to documentation', async function() { - - // given - createFeelPopup({ type: 'feel' }, container); - - const childComponent = domQuery('.child-component', container); - const btn = domQuery('button', childComponent); - - // when - await act(() => { - btn.click(); - }); - - // then - const link = domQuery('.bio-properties-panel-feel-popup__title-link', document.body); - expect(link).to.exist; - }); - - it('should focus editor', async function() { // given @@ -587,25 +612,6 @@ describe('', function() { }); - it('should link to documentation', async function() { - - // given - createFeelPopup({ type: 'feelers' }, container); - - const childComponent = domQuery('.child-component', container); - const btn = domQuery('button', childComponent); - - // when - await act(() => { - btn.click(); - }); - - // then - const link = domQuery('.bio-properties-panel-feel-popup__title-link', document.body); - expect(link).to.exist; - }); - - it('should focus editor', async function() { // given @@ -738,13 +744,14 @@ describe('', function() { function createFeelPopup(props, container) { const { popupContainer, + getPopupLinks, element = noopElement, eventBus = new EventBus(), type } = props; return render( - + , { container }