@@ -1103,10 +1103,33 @@ describe("utils", () => {
1103
1103
) ;
1104
1104
} ) ;
1105
1105
1106
- it . todo (
1107
- "should SVG work with foreingObject setting correctly the namespace outside the foreingObject node" ,
1108
- ( ) => { } ,
1109
- ) ;
1106
+ it ( "should SVG work with foreingObject setting correctly the namespace outside the foreingObject node" , ( ) => {
1107
+ function SVG ( { } , { h } : any ) {
1108
+ return h ( "svg" , { width : "12cm" , height : "12cm" } , [
1109
+ "foreignObject" ,
1110
+ { width : "100%" , height : "100%" } ,
1111
+ [ "div" , { xmlns : "http://www.w3.org/1999/xhtml" } , "test" ] ,
1112
+ ] ) ;
1113
+ }
1114
+
1115
+ customElements . define ( "test-svg" , brisaElement ( SVG ) ) ;
1116
+ document . body . innerHTML = "<test-svg />" ;
1117
+
1118
+ const testSVG = document . querySelector ( "test-svg" ) as HTMLElement ;
1119
+ const svg = testSVG ?. shadowRoot ?. querySelector ( "svg" ) as SVGElement ;
1120
+ const foreignObject = testSVG ?. shadowRoot ?. querySelector (
1121
+ "foreignObject" ,
1122
+ ) as SVGElement ;
1123
+ const div = testSVG ?. shadowRoot ?. querySelector ( "div" ) as HTMLElement ;
1124
+
1125
+ expect ( svg . namespaceURI ) . toBe ( "http://www.w3.org/2000/svg" ) ;
1126
+ expect ( foreignObject . namespaceURI ) . toBe ( "http://www.w3.org/2000/svg" ) ;
1127
+ expect ( div . namespaceURI ) . toBe ( "http://www.w3.org/1999/xhtml" ) ;
1128
+
1129
+ expect ( testSVG ?. shadowRoot ?. innerHTML ) . toBe (
1130
+ '<svg width="12cm" height="12cm"><foreignobject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">test</div></foreignobject></svg>' ,
1131
+ ) ;
1132
+ } ) ;
1110
1133
1111
1134
it . todo (
1112
1135
"should reactively update the DOM after adding a new property to the web-component" ,
0 commit comments