-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rewrite vaadin-iconset as vanilla custom element (#8550)
- Loading branch information
1 parent
e4eac52
commit 38146af
Showing
14 changed files
with
108 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
import '../vaadin-lit-icon.js'; | ||
import '../vaadin-lit-iconset.js'; | ||
import './icon.common.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
import '../vaadin-icon.js'; | ||
import '../vaadin-iconset.js'; | ||
import './icon.common.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { expect } from '@vaadin/chai-plugins'; | ||
import { fixtureSync } from '@vaadin/testing-helpers'; | ||
|
||
describe('vaadin-iconset lazy upgrade', () => { | ||
let iconset; | ||
|
||
const ICON = '<path d="M3 4h10l-5 7z"></path>'; | ||
|
||
before(() => { | ||
iconset = document.createElement('vaadin-iconset'); | ||
iconset.name = 'vaadin'; | ||
iconset.size = 16; | ||
iconset.innerHTML = ` | ||
<svg xmlns="http://www.w3.org/2000/svg"> | ||
<defs> | ||
<g id="vaadin:caret-down">${ICON}</g> | ||
</defs> | ||
</svg> | ||
`; | ||
document.body.appendChild(iconset); | ||
}); | ||
|
||
after(() => { | ||
iconset.remove(); | ||
}); | ||
|
||
it('should use correct name and size set as attributes before upgrade', async () => { | ||
const icon = fixtureSync('<vaadin-icon icon="vaadin:caret-down"></vaadin-icon>'); | ||
|
||
// Import vaadin-icon, which also imports vaadin-iconset internally. | ||
await import('../vaadin-icon.js'); | ||
|
||
const svgElement = icon.shadowRoot.querySelector('svg'); | ||
|
||
expect(svgElement.querySelector('#svg-group > g').innerHTML).to.equal(ICON); | ||
expect(svgElement.getAttribute('viewBox')).to.equal('0 0 16 16'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
packages/icon/test/iconset.common.js → packages/icon/test/iconset.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.