-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor fontawesome icon usage. #6282
base: develop
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: a31adc6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
commit: |
Note: Some e2e tests are failing as they were using fontawesome icon in them but the test file was not importing fontawesome cdn |
…saurabh/refactor-fontawesome-icon-usage
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
…saurabh/refactor-fontawesome-icon-usage
…mermaid:mermaid-js/mermaid into saurabh/refactor-fontawesome-icon-usage
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've still got two things in the E2E tests that I'm a bit uncomfortable with, but it's non-blocking, so if you and/or Sid feel it's better to leave them how it is, I'm happy!
Since adding FontAwesome to cypress/platform/viewer.js
is causing ~500 changed E2E screenshot changes (and two tests to fail, see comment below), do you think it's worth making a separate PR for this?
I'm mainly asking @sidharthv96 here, since I don't really know how @argos-ci works, but it might make it easier to review the changes!
cypress/platform/viewer.js
Outdated
await loadFontAwesomeCSS(); | ||
await Promise.all(Array.from(document.fonts, (font) => font.load())); |
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.
issue(blocking):
This change now causes the following E2E tests to fail
mermaid/cypress/integration/rendering/flowchart-v2.spec.js
Lines 82 to 124 in 1d9c2aa
it('7: should render a flowchart when useMaxWidth is true (default)', () => { | |
renderGraph( | |
`flowchart TD | |
A[Christmas] -->|Get money| B(Go shopping) | |
B --> C{Let me think} | |
C -->|One| D[Laptop] | |
C -->|Two| E[iPhone] | |
C -->|Three| F[fa:fa-car Car] | |
`, | |
{ flowchart: { useMaxWidth: true } } | |
); | |
cy.get('svg').should((svg) => { | |
expect(svg).to.have.attr('width', '100%'); | |
// expect(svg).to.have.attr('height'); | |
// use within because the absolute value can be slightly different depending on the environment ±5% | |
// const height = parseFloat(svg.attr('height')); | |
// expect(height).to.be.within(446 * 0.95, 446 * 1.05); | |
const style = svg.attr('style'); | |
expect(style).to.match(/^max-width: [\d.]+px;$/); | |
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); | |
expect(maxWidthValue).to.be.within(417 * 0.95, 417 * 1.05); | |
}); | |
}); | |
it('8: should render a flowchart when useMaxWidth is false', () => { | |
renderGraph( | |
`flowchart TD | |
A[Christmas] -->|Get money| B(Go shopping) | |
B --> C{Let me think} | |
C -->|One| D[Laptop] | |
C -->|Two| E[iPhone] | |
C -->|Three| F[fa:fa-car Car] | |
`, | |
{ flowchart: { useMaxWidth: false } } | |
); | |
cy.get('svg').should((svg) => { | |
// const height = parseFloat(svg.attr('height')); | |
const width = parseFloat(svg.attr('width')); | |
// use within because the absolute value can be slightly different depending on the environment ±5% | |
// expect(height).to.be.within(446 * 0.95, 446 * 1.05); | |
expect(width).to.be.within(417 * 0.95, 417 * 1.05); | |
expect(svg).to.not.have.attr('style'); | |
}); | |
}); |
We could remove the fa:fa-car
icon? Or update the widths to the new value.
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.
cypress/platform/viewer.js
Outdated
await loadFontAwesomeCSS(); | ||
await Promise.all(Array.from(document.fonts, (font) => font.load())); |
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.
Co-authored-by: Alois Klink <alois@aloisklink.com>
Co-authored-by: Alois Klink <alois@aloisklink.com>
Co-authored-by: Alois Klink <alois@aloisklink.com>
📑 Summary
<i>
tag).See mermaid-js/mermaid-cli#474
📏 Design Decisions
When text contains a FontAwesome icon reference:
<i>
tag with the appropriate class).Update to styles.
path
elements insidenode
class. Now we are overriding this style to havefill: currentColor
also reverting stroke and stroke-width to default📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.