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 @@ -89,7 +89,7 @@ export class LionIcon extends LionLitElement {
8989 * so make sure to have <svg focusable="false"> in svg files
9090 */
9191 _setSvg ( ) {
92- this . innerHTML = this . svg ;
92+ this . innerHTML = this . svg ? this . svg : '' ;
9393 }
9494
9595 // TODO: find a better way to render dynamic icons without the need for unsafeHTML
Original file line number Diff line number Diff line change @@ -149,4 +149,16 @@ describe('lion-icon', () => {
149149
150150 expect ( el . children [ 0 ] . id ) . to . equal ( 'svg-heart' ) ;
151151 } ) ;
152+
153+ it ( 'does not render "undefined" if changed from valid input to undefined' , async ( ) => {
154+ const el = await fixture (
155+ html `
156+ < lion-icon .svg =${ heartSvg } > </ lion-icon >
157+ ` ,
158+ ) ;
159+ await el . updateComplete ;
160+ el . svg = undefined ;
161+ await el . updateComplete ;
162+ expect ( el . innerHTML ) . to . equal ( '' ) ;
163+ } ) ;
152164} ) ;
You can’t perform that action at this time.
0 commit comments