File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ export class LionIcon extends LitElement {
8383 */
8484 set svg ( svg ) {
8585 this . __svg = svg ;
86- if ( svg === undefined ) {
86+ if ( svg === undefined || svg === null ) {
8787 this . _renderSvg ( nothing ) ;
8888 } else if ( isPromise ( svg ) ) {
8989 this . _renderSvg ( nothing ) ; // show nothing before resolved
Original file line number Diff line number Diff line change @@ -203,6 +203,18 @@ describe('lion-icon', () => {
203203 expect ( el . innerHTML ) . to . equal ( '<!----><!---->' ) ; // don't use lightDom.to.equal(''), it gives false positives
204204 } ) ;
205205
206+ it ( 'does not render "null" if changed from valid input to null' , async ( ) => {
207+ const el = await fixture (
208+ html `
209+ < lion-icon .svg =${ heartSvg } > </ lion-icon >
210+ ` ,
211+ ) ;
212+ await el . updateComplete ;
213+ el . svg = null ;
214+ await el . updateComplete ;
215+ expect ( el . innerHTML ) . to . equal ( '<!----><!---->' ) ; // don't use lightDom.to.equal(''), it gives false positives
216+ } ) ;
217+
206218 describe ( 'race conditions with dynamic promisified icons' , ( ) => {
207219 async function prepareRaceCondition ( ...svgs ) {
208220 const container = fixtureSync ( `<div></div>` ) ;
You can’t perform that action at this time.
0 commit comments