-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide templates as replace menu entries #207
Conversation
...template, | ||
group, | ||
id: `replace-with-template-${id}`, | ||
imageUrl: sanitizeImageUrl(icon.contents), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we'd need to do this here? Feels like a core concern (to sanitize the image URL).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(We could of course decide element templates are stricter than the core).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to add it in the core. But I don't have a super strong opinion on this
3719ce6
to
b21e4f3
Compare
b21e4f3
to
286a15b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall. I verified via an integration test that it works as expected.
I'd ask you to do the following:
- test via API, not DOM that integration works.
- add an actual test to verify template -> popup menu entry conversion works as expected (including
category
) - consider adding a
it.skip
test case for the bug you found so we can pick this up as a follow up.
286a15b
to
6acd4a7
Compare
it('should have group - default', inject(function(popupMenu) { | ||
|
||
// given | ||
const templateEntryId = getTemplateEntries()[0]; | ||
const entry = popupMenu._getEntry(templateEntryId); | ||
|
||
// then | ||
expect(entry.group.id).to.eql('templates'); | ||
expect(entry.group.name).to.eql('Templates'); | ||
|
||
})); | ||
|
||
|
||
it('should have group - category', inject(function(popupMenu) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already had this for group/category (reworked now to not use DOM). Were you envisioning something else ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that one, thanks :)
isTemplateApplied | ||
} from 'lib/camunda-cloud/features/replace/ElementTemplatesReplaceProvider'; | ||
|
||
import simpleXml from '../fixtures/replaceElementTemplates.bpmn'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move test diagrams and implementation close to each other.
Name ElementTemplatesReplaceProvider.element-templates.json
Name ElementTemplatesReplaceProvider.bpmn
.
This way we embrace locality (and ensure diagrams are not accidentally used by others).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll incorporate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we have fixtures
in many places still, but it is an anti pattern (to move things away from each other).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know we were trying to move away from this so I was trying to respect it. But makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good example is bpmn-js, where we stared with a HUGE ball of fixtures, and now moved to a very "focused per test" fixture set. That worked much better.
Incorporates new popup menu. BREAKING CHANGES: * Slight changes in popup menu look
Improves ability to integration test.
6acd4a7
to
7db5e58
Compare
7db5e58
to
96abacd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love how clean this is now (also testing the actual template entries, not DOM anymore).
Great work!
Closes #204
See comment #204 (comment)