@stencil/vitest 1.1.17 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"html-serializer.d.ts","sourceRoot":"","sources":["../../src/testing/html-serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkCH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,gBAAgB,GAAG,MAAM,EAC3D,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAWR;AAqHD;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkDjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD"}
1
+ {"version":3,"file":"html-serializer.d.ts","sourceRoot":"","sources":["../../src/testing/html-serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkCH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,gBAAgB,GAAG,MAAM,EAC3D,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAWR;AAyID;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkDjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -64,19 +64,27 @@ function serializeElementWithShadow(element, excludeStyles, serializeShadowRoot
64
64
  return html;
65
65
  }
66
66
  const elem = element;
67
- const tagName = elem.tagName.toLowerCase();
67
+ // Use localName to preserve case for SVG elements (e.g., foreignObject, feGaussianBlur)
68
+ // For HTML elements, localName is already lowercase
69
+ const tagName = elem.localName || elem.tagName.toLowerCase();
68
70
  // Build opening tag with attributes
69
71
  let html = `<${tagName}`;
70
72
  // Add attributes
71
73
  if (elem.attributes) {
72
74
  for (let i = 0; i < elem.attributes.length; i++) {
73
75
  const attr = elem.attributes[i];
76
+ // Handle namespaced attributes (e.g., xlink:href)
77
+ // Use prefix + localName if available, otherwise fall back to name
78
+ let attrName = attr.name;
79
+ if (attr.prefix && attr.localName) {
80
+ attrName = `${attr.prefix}:${attr.localName}`;
81
+ }
74
82
  // Boolean attributes (empty string value) should not have ="value"
75
83
  if (attr.value === '') {
76
- html += ` ${attr.name}`;
84
+ html += ` ${attrName}`;
77
85
  }
78
86
  else {
79
- html += ` ${attr.name}="${attr.value}"`;
87
+ html += ` ${attrName}="${attr.value}"`;
80
88
  }
81
89
  }
82
90
  }
@@ -88,7 +96,15 @@ function serializeElementWithShadow(element, excludeStyles, serializeShadowRoot
88
96
  const hasStencilPolyfill = serializeShadowRoot && '__childNodes' in stencilElem && stencilElem.__childNodes;
89
97
  if (hasShadowRoot) {
90
98
  // Use mock:shadow-root format to match mock-doc's output
91
- html += '<mock:shadow-root>';
99
+ // Include shadow root mode (open/closed) and other properties
100
+ const shadowRoot = elem.shadowRoot;
101
+ let shadowRootTag = '<mock:shadow-root';
102
+ // Add delegatesFocus if true
103
+ if (shadowRoot.delegatesFocus) {
104
+ shadowRootTag += ' shadowrootdelegatesfocus';
105
+ }
106
+ shadowRootTag += '>';
107
+ html += shadowRootTag;
92
108
  // Serialize shadow DOM children
93
109
  const shadowChildren = Array.from(elem.shadowRoot.childNodes);
94
110
  for (const child of shadowChildren) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/stenciljs/vitest"
6
6
  },
7
- "version": "1.1.17",
7
+ "version": "1.1.19",
8
8
  "description": "First-class testing utilities for Stencil design systems with Vitest",
9
9
  "license": "MIT",
10
10
  "type": "module",
@@ -97,7 +97,7 @@
97
97
  "dependencies": {
98
98
  "jiti": "^2.6.1",
99
99
  "local-pkg": "^1.1.2",
100
- "vitest-environment-stencil": "1.1.17"
100
+ "vitest-environment-stencil": "1.1.19"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@eslint/js": "^9.39.2",