@codefluss/sandbox 0.0.1-alpha.1

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.
Files changed (233) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +413 -0
  3. package/dist/__tests__/auto-resize-script.test.d.ts +2 -0
  4. package/dist/__tests__/auto-resize-script.test.d.ts.map +1 -0
  5. package/dist/__tests__/auto-resize-script.test.js +49 -0
  6. package/dist/__tests__/auto-resize-script.test.js.map +1 -0
  7. package/dist/__tests__/sandbox-component.test.d.ts +2 -0
  8. package/dist/__tests__/sandbox-component.test.d.ts.map +1 -0
  9. package/dist/__tests__/sandbox-component.test.js +281 -0
  10. package/dist/__tests__/sandbox-component.test.js.map +1 -0
  11. package/dist/__tests__/sandbox-config.test.d.ts +2 -0
  12. package/dist/__tests__/sandbox-config.test.d.ts.map +1 -0
  13. package/dist/__tests__/sandbox-config.test.js +148 -0
  14. package/dist/__tests__/sandbox-config.test.js.map +1 -0
  15. package/dist/__tests__/sandbox-iframe.test.d.ts +2 -0
  16. package/dist/__tests__/sandbox-iframe.test.d.ts.map +1 -0
  17. package/dist/__tests__/sandbox-iframe.test.js +212 -0
  18. package/dist/__tests__/sandbox-iframe.test.js.map +1 -0
  19. package/dist/__tests__/setup.d.ts +2 -0
  20. package/dist/__tests__/setup.d.ts.map +1 -0
  21. package/dist/__tests__/setup.js +27 -0
  22. package/dist/__tests__/setup.js.map +1 -0
  23. package/dist/components/index.d.ts +5 -0
  24. package/dist/components/index.d.ts.map +1 -0
  25. package/dist/components/index.js +5 -0
  26. package/dist/components/index.js.map +1 -0
  27. package/dist/components/performance-wrapper.d.ts +12 -0
  28. package/dist/components/performance-wrapper.d.ts.map +1 -0
  29. package/dist/components/performance-wrapper.js +162 -0
  30. package/dist/components/performance-wrapper.js.map +1 -0
  31. package/dist/components/sandbox-component.d.ts +3 -0
  32. package/dist/components/sandbox-component.d.ts.map +1 -0
  33. package/dist/components/sandbox-component.js +123 -0
  34. package/dist/components/sandbox-component.js.map +1 -0
  35. package/dist/components/sandbox-iframe-cached.d.ts +3 -0
  36. package/dist/components/sandbox-iframe-cached.d.ts.map +1 -0
  37. package/dist/components/sandbox-iframe-cached.js +176 -0
  38. package/dist/components/sandbox-iframe-cached.js.map +1 -0
  39. package/dist/components/sandbox-iframe.d.ts +3 -0
  40. package/dist/components/sandbox-iframe.d.ts.map +1 -0
  41. package/dist/components/sandbox-iframe.js +131 -0
  42. package/dist/components/sandbox-iframe.js.map +1 -0
  43. package/dist/converters/auto-detect/auto-detect.d.ts +13 -0
  44. package/dist/converters/auto-detect/auto-detect.d.ts.map +1 -0
  45. package/dist/converters/auto-detect/auto-detect.js +224 -0
  46. package/dist/converters/auto-detect/auto-detect.js.map +1 -0
  47. package/dist/converters/auto-detect/index.d.ts +3 -0
  48. package/dist/converters/auto-detect/index.d.ts.map +1 -0
  49. package/dist/converters/auto-detect/index.js +2 -0
  50. package/dist/converters/auto-detect/index.js.map +1 -0
  51. package/dist/converters/codepen/codepen-converter.d.ts +9 -0
  52. package/dist/converters/codepen/codepen-converter.d.ts.map +1 -0
  53. package/dist/converters/codepen/codepen-converter.js +99 -0
  54. package/dist/converters/codepen/codepen-converter.js.map +1 -0
  55. package/dist/converters/codepen/index.d.ts +2 -0
  56. package/dist/converters/codepen/index.d.ts.map +1 -0
  57. package/dist/converters/codepen/index.js +2 -0
  58. package/dist/converters/codepen/index.js.map +1 -0
  59. package/dist/converters/gist/gist-converter.d.ts +31 -0
  60. package/dist/converters/gist/gist-converter.d.ts.map +1 -0
  61. package/dist/converters/gist/gist-converter.js +162 -0
  62. package/dist/converters/gist/gist-converter.js.map +1 -0
  63. package/dist/converters/gist/index.d.ts +2 -0
  64. package/dist/converters/gist/index.d.ts.map +1 -0
  65. package/dist/converters/gist/index.js +2 -0
  66. package/dist/converters/gist/index.js.map +1 -0
  67. package/dist/converters/shared/html-parser.d.ts +4 -0
  68. package/dist/converters/shared/html-parser.d.ts.map +1 -0
  69. package/dist/converters/shared/html-parser.js +39 -0
  70. package/dist/converters/shared/html-parser.js.map +1 -0
  71. package/dist/converters/shared/index.d.ts +4 -0
  72. package/dist/converters/shared/index.d.ts.map +1 -0
  73. package/dist/converters/shared/index.js +3 -0
  74. package/dist/converters/shared/index.js.map +1 -0
  75. package/dist/converters/shared/sanitization.d.ts +5 -0
  76. package/dist/converters/shared/sanitization.d.ts.map +1 -0
  77. package/dist/converters/shared/sanitization.js +176 -0
  78. package/dist/converters/shared/sanitization.js.map +1 -0
  79. package/dist/converters/shared/types.d.ts +23 -0
  80. package/dist/converters/shared/types.d.ts.map +1 -0
  81. package/dist/converters/shared/types.js +2 -0
  82. package/dist/converters/shared/types.js.map +1 -0
  83. package/dist/core/index.d.ts +13 -0
  84. package/dist/core/index.d.ts.map +1 -0
  85. package/dist/core/index.js +10 -0
  86. package/dist/core/index.js.map +1 -0
  87. package/dist/frameworks/__tests__/file-utils.test.d.ts +2 -0
  88. package/dist/frameworks/__tests__/file-utils.test.d.ts.map +1 -0
  89. package/dist/frameworks/__tests__/file-utils.test.js +408 -0
  90. package/dist/frameworks/__tests__/file-utils.test.js.map +1 -0
  91. package/dist/frameworks/__tests__/sandpack-wrapper.test.d.ts +2 -0
  92. package/dist/frameworks/__tests__/sandpack-wrapper.test.d.ts.map +1 -0
  93. package/dist/frameworks/__tests__/sandpack-wrapper.test.js +147 -0
  94. package/dist/frameworks/__tests__/sandpack-wrapper.test.js.map +1 -0
  95. package/dist/frameworks/file-utils.d.ts +20 -0
  96. package/dist/frameworks/file-utils.d.ts.map +1 -0
  97. package/dist/frameworks/file-utils.js +293 -0
  98. package/dist/frameworks/file-utils.js.map +1 -0
  99. package/dist/frameworks/framework-detector.d.ts +5 -0
  100. package/dist/frameworks/framework-detector.d.ts.map +1 -0
  101. package/dist/frameworks/framework-detector.js +117 -0
  102. package/dist/frameworks/framework-detector.js.map +1 -0
  103. package/dist/frameworks/index.d.ts +6 -0
  104. package/dist/frameworks/index.d.ts.map +1 -0
  105. package/dist/frameworks/index.js +5 -0
  106. package/dist/frameworks/index.js.map +1 -0
  107. package/dist/frameworks/sandpack-wrapper.d.ts +28 -0
  108. package/dist/frameworks/sandpack-wrapper.d.ts.map +1 -0
  109. package/dist/frameworks/sandpack-wrapper.js +55 -0
  110. package/dist/frameworks/sandpack-wrapper.js.map +1 -0
  111. package/dist/frameworks/templates/index.d.ts +8 -0
  112. package/dist/frameworks/templates/index.d.ts.map +1 -0
  113. package/dist/frameworks/templates/index.js +29 -0
  114. package/dist/frameworks/templates/index.js.map +1 -0
  115. package/dist/frameworks/templates/react-template.d.ts +3 -0
  116. package/dist/frameworks/templates/react-template.d.ts.map +1 -0
  117. package/dist/frameworks/templates/react-template.js +376 -0
  118. package/dist/frameworks/templates/react-template.js.map +1 -0
  119. package/dist/frameworks/templates/svelte-template.d.ts +3 -0
  120. package/dist/frameworks/templates/svelte-template.d.ts.map +1 -0
  121. package/dist/frameworks/templates/svelte-template.js +373 -0
  122. package/dist/frameworks/templates/svelte-template.js.map +1 -0
  123. package/dist/frameworks/templates/vanilla-template.d.ts +3 -0
  124. package/dist/frameworks/templates/vanilla-template.d.ts.map +1 -0
  125. package/dist/frameworks/templates/vanilla-template.js +455 -0
  126. package/dist/frameworks/templates/vanilla-template.js.map +1 -0
  127. package/dist/frameworks/templates/vue-template.d.ts +3 -0
  128. package/dist/frameworks/templates/vue-template.d.ts.map +1 -0
  129. package/dist/frameworks/templates/vue-template.js +388 -0
  130. package/dist/frameworks/templates/vue-template.js.map +1 -0
  131. package/dist/frameworks/types.d.ts +57 -0
  132. package/dist/frameworks/types.d.ts.map +1 -0
  133. package/dist/frameworks/types.js +2 -0
  134. package/dist/frameworks/types.js.map +1 -0
  135. package/dist/index.d.ts +7 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +7 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/lib/performance-tracker.d.ts +45 -0
  140. package/dist/lib/performance-tracker.d.ts.map +1 -0
  141. package/dist/lib/performance-tracker.js +165 -0
  142. package/dist/lib/performance-tracker.js.map +1 -0
  143. package/dist/lib/sandbox-cache.d.ts +24 -0
  144. package/dist/lib/sandbox-cache.d.ts.map +1 -0
  145. package/dist/lib/sandbox-cache.js +138 -0
  146. package/dist/lib/sandbox-cache.js.map +1 -0
  147. package/dist/locales/de.json +72 -0
  148. package/dist/locales/en.json +72 -0
  149. package/dist/locales/index.d.ts +148 -0
  150. package/dist/locales/index.d.ts.map +1 -0
  151. package/dist/locales/index.js +7 -0
  152. package/dist/locales/index.js.map +1 -0
  153. package/dist/performance/sandpack-bundle-cache.d.ts +19 -0
  154. package/dist/performance/sandpack-bundle-cache.d.ts.map +1 -0
  155. package/dist/performance/sandpack-bundle-cache.js +48 -0
  156. package/dist/performance/sandpack-bundle-cache.js.map +1 -0
  157. package/dist/sandbox-config.d.ts +4 -0
  158. package/dist/sandbox-config.d.ts.map +1 -0
  159. package/dist/sandbox-config.js +235 -0
  160. package/dist/sandbox-config.js.map +1 -0
  161. package/dist/storage/__tests__/indexeddb-adapter.test.d.ts +2 -0
  162. package/dist/storage/__tests__/indexeddb-adapter.test.d.ts.map +1 -0
  163. package/dist/storage/__tests__/indexeddb-adapter.test.js +192 -0
  164. package/dist/storage/__tests__/indexeddb-adapter.test.js.map +1 -0
  165. package/dist/storage/__tests__/project-manager.test.d.ts +2 -0
  166. package/dist/storage/__tests__/project-manager.test.d.ts.map +1 -0
  167. package/dist/storage/__tests__/project-manager.test.js +266 -0
  168. package/dist/storage/__tests__/project-manager.test.js.map +1 -0
  169. package/dist/storage/index.d.ts +5 -0
  170. package/dist/storage/index.d.ts.map +1 -0
  171. package/dist/storage/index.js +4 -0
  172. package/dist/storage/index.js.map +1 -0
  173. package/dist/storage/indexeddb-adapter.d.ts +18 -0
  174. package/dist/storage/indexeddb-adapter.d.ts.map +1 -0
  175. package/dist/storage/indexeddb-adapter.js +232 -0
  176. package/dist/storage/indexeddb-adapter.js.map +1 -0
  177. package/dist/storage/project-manager.d.ts +35 -0
  178. package/dist/storage/project-manager.d.ts.map +1 -0
  179. package/dist/storage/project-manager.js +213 -0
  180. package/dist/storage/project-manager.js.map +1 -0
  181. package/dist/storage/types.d.ts +59 -0
  182. package/dist/storage/types.d.ts.map +1 -0
  183. package/dist/storage/types.js +2 -0
  184. package/dist/storage/types.js.map +1 -0
  185. package/dist/storage/zip-handler.d.ts +5 -0
  186. package/dist/storage/zip-handler.d.ts.map +1 -0
  187. package/dist/storage/zip-handler.js +200 -0
  188. package/dist/storage/zip-handler.js.map +1 -0
  189. package/dist/types/sandbox-types.d.ts +54 -0
  190. package/dist/types/sandbox-types.d.ts.map +1 -0
  191. package/dist/types/sandbox-types.js +2 -0
  192. package/dist/types/sandbox-types.js.map +1 -0
  193. package/dist/utils/__tests__/converters/auto-detect.test.d.ts +2 -0
  194. package/dist/utils/__tests__/converters/auto-detect.test.d.ts.map +1 -0
  195. package/dist/utils/__tests__/converters/auto-detect.test.js +381 -0
  196. package/dist/utils/__tests__/converters/auto-detect.test.js.map +1 -0
  197. package/dist/utils/__tests__/converters/codepen-converter.test.d.ts +2 -0
  198. package/dist/utils/__tests__/converters/codepen-converter.test.d.ts.map +1 -0
  199. package/dist/utils/__tests__/converters/codepen-converter.test.js +408 -0
  200. package/dist/utils/__tests__/converters/codepen-converter.test.js.map +1 -0
  201. package/dist/utils/__tests__/converters/gist-converter.test.d.ts +2 -0
  202. package/dist/utils/__tests__/converters/gist-converter.test.d.ts.map +1 -0
  203. package/dist/utils/__tests__/converters/gist-converter.test.js +458 -0
  204. package/dist/utils/__tests__/converters/gist-converter.test.js.map +1 -0
  205. package/dist/utils/__tests__/converters/html-parser.test.d.ts +2 -0
  206. package/dist/utils/__tests__/converters/html-parser.test.d.ts.map +1 -0
  207. package/dist/utils/__tests__/converters/html-parser.test.js +285 -0
  208. package/dist/utils/__tests__/converters/html-parser.test.js.map +1 -0
  209. package/dist/utils/__tests__/converters/sanitization.test.d.ts +2 -0
  210. package/dist/utils/__tests__/converters/sanitization.test.d.ts.map +1 -0
  211. package/dist/utils/__tests__/converters/sanitization.test.js +210 -0
  212. package/dist/utils/__tests__/converters/sanitization.test.js.map +1 -0
  213. package/dist/utils/auto-resize-script.d.ts +4 -0
  214. package/dist/utils/auto-resize-script.d.ts.map +1 -0
  215. package/dist/utils/auto-resize-script.js +125 -0
  216. package/dist/utils/auto-resize-script.js.map +1 -0
  217. package/dist/widgets/banner/BannerWidget.d.ts +15 -0
  218. package/dist/widgets/banner/BannerWidget.d.ts.map +1 -0
  219. package/dist/widgets/banner/BannerWidget.js +33 -0
  220. package/dist/widgets/banner/BannerWidget.js.map +1 -0
  221. package/dist/widgets/form/FormWidget.d.ts +23 -0
  222. package/dist/widgets/form/FormWidget.d.ts.map +1 -0
  223. package/dist/widgets/form/FormWidget.js +42 -0
  224. package/dist/widgets/form/FormWidget.js.map +1 -0
  225. package/dist/widgets/index.d.ts +8 -0
  226. package/dist/widgets/index.d.ts.map +1 -0
  227. package/dist/widgets/index.js +28 -0
  228. package/dist/widgets/index.js.map +1 -0
  229. package/dist/widgets/types.d.ts +28 -0
  230. package/dist/widgets/types.d.ts.map +1 -0
  231. package/dist/widgets/types.js +2 -0
  232. package/dist/widgets/types.js.map +1 -0
  233. package/package.json +116 -0
@@ -0,0 +1,13 @@
1
+ export { SandboxComponent } from '../components/sandbox-component';
2
+ export { SandboxIframe } from '../components/sandbox-iframe';
3
+ export { SandboxIframeCached } from '../components/sandbox-iframe-cached';
4
+ export { PerformanceWrapper } from '../components/performance-wrapper';
5
+ export { sandboxPluginConfig } from '../sandbox-config';
6
+ export type { SandboxComponentData, SandboxComponentProps, SandboxInputMode, SandboxCode, SandboxIframeProps, SandboxMessage, ConverterResult, } from '../types/sandbox-types';
7
+ export type { PluginDependencies, PluginDesignSystem, PluginUtils, DesignSystemFont, DesignSystemColor, DesignSystemSpacing, } from '@codefluss/base-types';
8
+ export type { PluginConfig, PropertyDefinition, PropertyType, PropertyCategory, PropertyControlType, PropertyValidation, PluginMeta, } from '@codefluss/base-types';
9
+ export { default as sandboxLocales } from '../locales';
10
+ export { generateAutoResizeScript } from '../utils/auto-resize-script';
11
+ export { browserCache, createServerCache, calculateHash, SandboxCache, type CacheConfig, } from '../lib/sandbox-cache';
12
+ export { default } from '../sandbox-config';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,YAAY,EACX,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,eAAe,GACf,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACX,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACV,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,KAAK,WAAW,GAChB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { SandboxComponent } from '../components/sandbox-component';
2
+ export { SandboxIframe } from '../components/sandbox-iframe';
3
+ export { SandboxIframeCached } from '../components/sandbox-iframe-cached';
4
+ export { PerformanceWrapper } from '../components/performance-wrapper';
5
+ export { sandboxPluginConfig } from '../sandbox-config';
6
+ export { default as sandboxLocales } from '../locales';
7
+ export { generateAutoResizeScript } from '../utils/auto-resize-script';
8
+ export { browserCache, createServerCache, calculateHash, SandboxCache, } from '../lib/sandbox-cache';
9
+ export { default } from '../sandbox-config';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAmCxD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EACN,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,GAEZ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file-utils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-utils.test.d.ts","sourceRoot":"","sources":["../../../src/frameworks/__tests__/file-utils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,408 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { normalizePath, getDirectory, getFilename, getExtension, isDirectory, joinPath, validateFilePath, generateFileTree, flattenFileTree, getFilesInDirectory, getUniqueFilePath, applyFileOperation, batchApplyOperations, createEmptyFile, } from '../file-utils';
3
+ describe('Path utilities', () => {
4
+ describe('normalizePath', () => {
5
+ it('should add leading slash', () => {
6
+ expect(normalizePath('App.tsx')).toBe('/App.tsx');
7
+ expect(normalizePath('src/App.tsx')).toBe('/src/App.tsx');
8
+ });
9
+ it('should preserve leading slash', () => {
10
+ expect(normalizePath('/App.tsx')).toBe('/App.tsx');
11
+ expect(normalizePath('/src/App.tsx')).toBe('/src/App.tsx');
12
+ });
13
+ it('should handle empty string', () => {
14
+ expect(normalizePath('')).toBe('/');
15
+ });
16
+ });
17
+ describe('getDirectory', () => {
18
+ it('should extract directory from file path', () => {
19
+ expect(getDirectory('/src/components/Button.tsx')).toBe('/src/components');
20
+ expect(getDirectory('/src/App.tsx')).toBe('/src');
21
+ });
22
+ it('should return / for root files', () => {
23
+ expect(getDirectory('/App.tsx')).toBe('/');
24
+ expect(getDirectory('/index.html')).toBe('/');
25
+ });
26
+ it('should handle paths without leading slash', () => {
27
+ expect(getDirectory('src/App.tsx')).toBe('/src');
28
+ });
29
+ });
30
+ describe('getFilename', () => {
31
+ it('should extract filename from path', () => {
32
+ expect(getFilename('/src/App.tsx')).toBe('App.tsx');
33
+ expect(getFilename('/styles.css')).toBe('styles.css');
34
+ });
35
+ it('should work with nested paths', () => {
36
+ expect(getFilename('/src/components/ui/Button.tsx')).toBe('Button.tsx');
37
+ });
38
+ it('should handle paths without leading slash', () => {
39
+ expect(getFilename('App.tsx')).toBe('App.tsx');
40
+ });
41
+ });
42
+ describe('getExtension', () => {
43
+ it('should extract file extension', () => {
44
+ expect(getExtension('/App.tsx')).toBe('.tsx');
45
+ expect(getExtension('/styles.css')).toBe('.css');
46
+ expect(getExtension('/package.json')).toBe('.json');
47
+ });
48
+ it('should handle files without extension', () => {
49
+ expect(getExtension('/README')).toBe('');
50
+ expect(getExtension('/Dockerfile')).toBe('');
51
+ });
52
+ it('should handle multiple dots', () => {
53
+ expect(getExtension('/component.test.tsx')).toBe('.tsx');
54
+ });
55
+ });
56
+ describe('isDirectory', () => {
57
+ it('should return true for paths without extension', () => {
58
+ expect(isDirectory('/src')).toBe(true);
59
+ expect(isDirectory('/components')).toBe(true);
60
+ });
61
+ it('should return false for files with extension', () => {
62
+ expect(isDirectory('/App.tsx')).toBe(false);
63
+ expect(isDirectory('/styles.css')).toBe(false);
64
+ });
65
+ });
66
+ describe('joinPath', () => {
67
+ it('should join path segments', () => {
68
+ expect(joinPath('/src', 'components', 'Button.tsx')).toBe('/src/components/Button.tsx');
69
+ expect(joinPath('/', 'App.tsx')).toBe('/App.tsx');
70
+ });
71
+ it('should handle empty segments', () => {
72
+ expect(joinPath('/src', '', 'App.tsx')).toBe('/src/App.tsx');
73
+ });
74
+ it('should normalize result', () => {
75
+ expect(joinPath('src', 'App.tsx')).toBe('/src/App.tsx');
76
+ });
77
+ });
78
+ describe('validateFilePath', () => {
79
+ it('should accept valid paths', () => {
80
+ expect(validateFilePath('/App.tsx')).toBe(true);
81
+ expect(validateFilePath('src/App.tsx')).toBe(true);
82
+ expect(validateFilePath('/components/ui/Button.tsx')).toBe(true);
83
+ });
84
+ it('should reject empty paths', () => {
85
+ expect(validateFilePath('')).toBe(false);
86
+ expect(validateFilePath(' ')).toBe(false);
87
+ });
88
+ it('should reject directory traversal', () => {
89
+ expect(validateFilePath('../etc/passwd')).toBe(false);
90
+ expect(validateFilePath('/../../etc/passwd')).toBe(false);
91
+ });
92
+ it('should reject invalid characters', () => {
93
+ expect(validateFilePath('/App<>.tsx')).toBe(false);
94
+ expect(validateFilePath('/App|.tsx')).toBe(false);
95
+ expect(validateFilePath('/App?.tsx')).toBe(false);
96
+ });
97
+ it('should reject paths without filename', () => {
98
+ expect(validateFilePath('/')).toBe(false);
99
+ expect(validateFilePath('/src/')).toBe(false);
100
+ });
101
+ });
102
+ });
103
+ describe('File tree operations', () => {
104
+ describe('generateFileTree', () => {
105
+ it('should generate tree from flat files', () => {
106
+ const files = {
107
+ '/App.tsx': { code: '' },
108
+ '/src/Button.tsx': { code: '' },
109
+ '/src/Input.tsx': { code: '' },
110
+ '/styles.css': { code: '' },
111
+ };
112
+ const tree = generateFileTree(files);
113
+ expect(tree).toHaveLength(3);
114
+ expect(tree[0].name).toBe('App.tsx');
115
+ expect(tree[0].type).toBe('file');
116
+ expect(tree[1].name).toBe('src');
117
+ expect(tree[1].type).toBe('directory');
118
+ expect(tree[1].children).toHaveLength(2);
119
+ });
120
+ it('should handle nested directories', () => {
121
+ const files = {
122
+ '/src/components/ui/Button.tsx': { code: '' },
123
+ '/src/components/forms/Input.tsx': { code: '' },
124
+ };
125
+ const tree = generateFileTree(files);
126
+ expect(tree).toHaveLength(1);
127
+ expect(tree[0].children).toHaveLength(1);
128
+ expect(tree[0].children[0].children).toHaveLength(2);
129
+ });
130
+ it('should sort files alphabetically', () => {
131
+ const files = {
132
+ '/zebra.tsx': { code: '' },
133
+ '/alpha.tsx': { code: '' },
134
+ '/beta.tsx': { code: '' },
135
+ };
136
+ const tree = generateFileTree(files);
137
+ expect(tree[0].name).toBe('alpha.tsx');
138
+ expect(tree[1].name).toBe('beta.tsx');
139
+ expect(tree[2].name).toBe('zebra.tsx');
140
+ });
141
+ });
142
+ describe('flattenFileTree', () => {
143
+ it('should flatten tree to paths', () => {
144
+ const tree = [
145
+ { path: '/App.tsx', name: 'App.tsx', type: 'file' },
146
+ {
147
+ path: '/src',
148
+ name: 'src',
149
+ type: 'directory',
150
+ children: [
151
+ {
152
+ path: '/src/Button.tsx',
153
+ name: 'Button.tsx',
154
+ type: 'file',
155
+ },
156
+ ],
157
+ },
158
+ ];
159
+ const paths = flattenFileTree(tree);
160
+ expect(paths).toEqual(['/App.tsx', '/src', '/src/Button.tsx']);
161
+ });
162
+ it('should handle deep nesting', () => {
163
+ const tree = [
164
+ {
165
+ path: '/src',
166
+ name: 'src',
167
+ type: 'directory',
168
+ children: [
169
+ {
170
+ path: '/src/components',
171
+ name: 'components',
172
+ type: 'directory',
173
+ children: [
174
+ {
175
+ path: '/src/components/Button.tsx',
176
+ name: 'Button.tsx',
177
+ type: 'file',
178
+ },
179
+ ],
180
+ },
181
+ ],
182
+ },
183
+ ];
184
+ const paths = flattenFileTree(tree);
185
+ expect(paths).toEqual(['/src', '/src/components', '/src/components/Button.tsx']);
186
+ });
187
+ });
188
+ describe('getFilesInDirectory', () => {
189
+ const files = {
190
+ '/App.tsx': { code: '' },
191
+ '/src/Button.tsx': { code: '' },
192
+ '/src/Input.tsx': { code: '' },
193
+ '/src/components/Card.tsx': { code: '' },
194
+ '/styles.css': { code: '' },
195
+ };
196
+ it('should get files in root directory', () => {
197
+ const result = getFilesInDirectory(files, '/');
198
+ expect(result).toEqual(['/App.tsx', '/styles.css']);
199
+ });
200
+ it('should get files in specific directory', () => {
201
+ const result = getFilesInDirectory(files, '/src');
202
+ expect(result).toEqual(['/src/Button.tsx', '/src/Input.tsx']);
203
+ });
204
+ it('should get files recursively', () => {
205
+ const result = getFilesInDirectory(files, '/src', true);
206
+ expect(result).toEqual([
207
+ '/src/Button.tsx',
208
+ '/src/Input.tsx',
209
+ '/src/components/Card.tsx',
210
+ ]);
211
+ });
212
+ it('should return empty array for non-existent directory', () => {
213
+ const result = getFilesInDirectory(files, '/nonexistent');
214
+ expect(result).toEqual([]);
215
+ });
216
+ });
217
+ describe('getUniqueFilePath', () => {
218
+ const files = {
219
+ '/App.tsx': { code: '' },
220
+ '/App-1.tsx': { code: '' },
221
+ };
222
+ it('should return original path if unique', () => {
223
+ expect(getUniqueFilePath(files, '/New.tsx')).toBe('/New.tsx');
224
+ });
225
+ it('should add counter for duplicate names', () => {
226
+ expect(getUniqueFilePath(files, '/App.tsx')).toBe('/App-2.tsx');
227
+ });
228
+ it('should handle files without extension', () => {
229
+ const filesWithoutExt = {
230
+ '/README': { code: '' },
231
+ };
232
+ expect(getUniqueFilePath(filesWithoutExt, '/README')).toBe('/README-1');
233
+ });
234
+ });
235
+ });
236
+ describe('File operations', () => {
237
+ describe('applyFileOperation', () => {
238
+ it('should add new file', () => {
239
+ const files = {
240
+ '/App.tsx': { code: 'old' },
241
+ };
242
+ const result = applyFileOperation(files, {
243
+ type: 'add',
244
+ path: '/Button.tsx',
245
+ content: 'new content',
246
+ });
247
+ expect(result['/Button.tsx']).toEqual({ code: 'new content' });
248
+ expect(result['/App.tsx']).toEqual({ code: 'old' });
249
+ });
250
+ it('should throw when adding duplicate file', () => {
251
+ const files = {
252
+ '/App.tsx': { code: '' },
253
+ };
254
+ expect(() => applyFileOperation(files, {
255
+ type: 'add',
256
+ path: '/App.tsx',
257
+ content: '',
258
+ })).toThrow('File already exists');
259
+ });
260
+ it('should update existing file', () => {
261
+ const files = {
262
+ '/App.tsx': { code: 'old' },
263
+ };
264
+ const result = applyFileOperation(files, {
265
+ type: 'update',
266
+ path: '/App.tsx',
267
+ content: 'new',
268
+ });
269
+ expect(result['/App.tsx']).toEqual({ code: 'new' });
270
+ });
271
+ it('should throw when updating non-existent file', () => {
272
+ const files = {};
273
+ expect(() => applyFileOperation(files, {
274
+ type: 'update',
275
+ path: '/App.tsx',
276
+ content: '',
277
+ })).toThrow('File not found');
278
+ });
279
+ it('should delete file', () => {
280
+ const files = {
281
+ '/App.tsx': { code: '' },
282
+ '/Button.tsx': { code: '' },
283
+ };
284
+ const result = applyFileOperation(files, {
285
+ type: 'delete',
286
+ path: '/App.tsx',
287
+ });
288
+ expect(result['/App.tsx']).toBeUndefined();
289
+ expect(result['/Button.tsx']).toBeDefined();
290
+ });
291
+ it('should throw when deleting non-existent file', () => {
292
+ const files = {};
293
+ expect(() => applyFileOperation(files, {
294
+ type: 'delete',
295
+ path: '/App.tsx',
296
+ })).toThrow('File not found');
297
+ });
298
+ it('should rename file', () => {
299
+ const files = {
300
+ '/App.tsx': { code: 'content' },
301
+ };
302
+ const result = applyFileOperation(files, {
303
+ type: 'rename',
304
+ path: '/App.tsx',
305
+ newPath: '/Main.tsx',
306
+ });
307
+ expect(result['/App.tsx']).toBeUndefined();
308
+ expect(result['/Main.tsx']).toEqual({ code: 'content' });
309
+ });
310
+ it('should throw when renaming to existing file', () => {
311
+ const files = {
312
+ '/App.tsx': { code: '' },
313
+ '/Main.tsx': { code: '' },
314
+ };
315
+ expect(() => applyFileOperation(files, {
316
+ type: 'rename',
317
+ path: '/App.tsx',
318
+ newPath: '/Main.tsx',
319
+ })).toThrow('File already exists');
320
+ });
321
+ it('should normalize paths', () => {
322
+ const files = {
323
+ '/App.tsx': { code: '' },
324
+ };
325
+ const result = applyFileOperation(files, {
326
+ type: 'add',
327
+ path: 'Button.tsx',
328
+ content: '',
329
+ });
330
+ expect(result['/Button.tsx']).toBeDefined();
331
+ });
332
+ });
333
+ describe('batchApplyOperations', () => {
334
+ it('should apply multiple operations in order', () => {
335
+ const files = {
336
+ '/App.tsx': { code: 'old' },
337
+ };
338
+ const result = batchApplyOperations(files, [
339
+ { type: 'add', path: '/Button.tsx', content: 'button' },
340
+ { type: 'update', path: '/App.tsx', content: 'new' },
341
+ { type: 'add', path: '/Input.tsx', content: 'input' },
342
+ ]);
343
+ expect(result['/App.tsx']).toEqual({ code: 'new' });
344
+ expect(result['/Button.tsx']).toEqual({ code: 'button' });
345
+ expect(result['/Input.tsx']).toEqual({ code: 'input' });
346
+ });
347
+ it('should handle dependent operations', () => {
348
+ const files = {
349
+ '/App.tsx': { code: '' },
350
+ };
351
+ const result = batchApplyOperations(files, [
352
+ { type: 'rename', path: '/App.tsx', newPath: '/Main.tsx' },
353
+ { type: 'update', path: '/Main.tsx', content: 'updated' },
354
+ ]);
355
+ expect(result['/App.tsx']).toBeUndefined();
356
+ expect(result['/Main.tsx']).toEqual({ code: 'updated' });
357
+ });
358
+ });
359
+ describe('createEmptyFile', () => {
360
+ it('should create React TSX component', () => {
361
+ const file = createEmptyFile('/Button.tsx');
362
+ expect(file.code).toContain('export default function Button()');
363
+ expect(file.code).toContain('<div>');
364
+ });
365
+ it('should create React JSX component', () => {
366
+ const file = createEmptyFile('/Button.jsx');
367
+ expect(file.code).toContain('export default function Button()');
368
+ });
369
+ it('should create Vue component', () => {
370
+ const file = createEmptyFile('/Button.vue');
371
+ expect(file.code).toContain('<template>');
372
+ expect(file.code).toContain('<script setup lang="ts">');
373
+ expect(file.code).toContain('<style scoped>');
374
+ });
375
+ it('should create Svelte component', () => {
376
+ const file = createEmptyFile('/Button.svelte');
377
+ expect(file.code).toContain('<script lang="ts">');
378
+ expect(file.code).toContain('<style>');
379
+ });
380
+ it('should create TypeScript file', () => {
381
+ const file = createEmptyFile('/utils.ts');
382
+ expect(file.code).toContain('export {};');
383
+ });
384
+ it('should create HTML file', () => {
385
+ const file = createEmptyFile('/index.html');
386
+ expect(file.code).toContain('<!DOCTYPE html>');
387
+ expect(file.code).toContain('<html lang="en">');
388
+ });
389
+ it('should create empty CSS file', () => {
390
+ const file = createEmptyFile('/styles.css');
391
+ expect(file.code).toBe('');
392
+ });
393
+ it('should create JSON file', () => {
394
+ const file = createEmptyFile('/config.json');
395
+ expect(file.code).toContain('{');
396
+ expect(file.code).toContain('}');
397
+ });
398
+ it('should create Markdown file', () => {
399
+ const file = createEmptyFile('/README.md');
400
+ expect(file.code).toContain('# README.md');
401
+ });
402
+ it('should create empty file for unknown extension', () => {
403
+ const file = createEmptyFile('/unknown.xyz');
404
+ expect(file.code).toBe('');
405
+ });
406
+ });
407
+ });
408
+ //# sourceMappingURL=file-utils.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-utils.test.js","sourceRoot":"","sources":["../../../src/frameworks/__tests__/file-utils.test.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACN,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,kBA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AEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACtC,MAAM,IAAI,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;YAE3C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACzD,MAAM,IAAI,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;YAE7C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=sandpack-wrapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandpack-wrapper.test.d.ts","sourceRoot":"","sources":["../../../src/frameworks/__tests__/sandpack-wrapper.test.tsx"],"names":[],"mappings":"AAQA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,147 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { describe, expect, it, vi } from 'vitest';
3
+ import { render, screen } from '@testing-library/react';
4
+ import '@testing-library/jest-dom';
5
+ import { SandpackWrapper, SandpackPreview } from '../sandpack-wrapper';
6
+ vi.mock('@codesandbox/sandpack-react', () => ({
7
+ SandpackProvider: ({ children }) => (_jsx("div", { "data-testid": "sandpack-provider", children: children })),
8
+ SandpackLayout: ({ children }) => (_jsx("div", { "data-testid": "sandpack-layout", children: children })),
9
+ SandpackCodeEditor: () => _jsx("div", { "data-testid": "sandpack-code-editor" }),
10
+ SandpackPreview: () => _jsx("div", { "data-testid": "sandpack-preview" }),
11
+ SandpackConsole: () => _jsx("div", { "data-testid": "sandpack-console" }),
12
+ SandpackFileExplorer: () => _jsx("div", { "data-testid": "sandpack-file-explorer" }),
13
+ }));
14
+ describe('SandpackWrapper', () => {
15
+ const mockFiles = {
16
+ '/App.tsx': { code: 'export default function App() { return <div>Test</div>; }' },
17
+ };
18
+ it('should render without crashing', async () => {
19
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles }));
20
+ await screen.findByTestId('sandpack-provider');
21
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
22
+ });
23
+ it('should show loading fallback initially', () => {
24
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles }));
25
+ expect(screen.getByText('Loading code editor...')).toBeInTheDocument();
26
+ });
27
+ it('should render file explorer when showFileExplorer is true', async () => {
28
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, showFileExplorer: true }));
29
+ await screen.findByTestId('sandpack-file-explorer');
30
+ expect(screen.getByTestId('sandpack-file-explorer')).toBeInTheDocument();
31
+ });
32
+ it('should not render file explorer when showFileExplorer is false', async () => {
33
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, showFileExplorer: false }));
34
+ await screen.findByTestId('sandpack-provider');
35
+ expect(screen.queryByTestId('sandpack-file-explorer')).not.toBeInTheDocument();
36
+ });
37
+ it('should render console when showConsole is true', async () => {
38
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, showConsole: true }));
39
+ await screen.findByTestId('sandpack-console');
40
+ expect(screen.getByTestId('sandpack-console')).toBeInTheDocument();
41
+ });
42
+ it('should not render console when showConsole is false', async () => {
43
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, showConsole: false }));
44
+ await screen.findByTestId('sandpack-provider');
45
+ expect(screen.queryByTestId('sandpack-console')).not.toBeInTheDocument();
46
+ });
47
+ it('should always render code editor', async () => {
48
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles }));
49
+ await screen.findByTestId('sandpack-code-editor');
50
+ expect(screen.getByTestId('sandpack-code-editor')).toBeInTheDocument();
51
+ });
52
+ it('should always render preview', async () => {
53
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles }));
54
+ await screen.findByTestId('sandpack-preview');
55
+ expect(screen.getByTestId('sandpack-preview')).toBeInTheDocument();
56
+ });
57
+ it('should accept custom className', async () => {
58
+ const { container } = render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, className: "custom-class" }));
59
+ await screen.findByTestId('sandpack-layout');
60
+ const layout = container.querySelector('[data-testid="sandpack-layout"]');
61
+ expect(layout).toHaveClass('custom-class');
62
+ });
63
+ it('should handle different frameworks', async () => {
64
+ const frameworks = ['react', 'vue', 'svelte', 'vanilla'];
65
+ for (const framework of frameworks) {
66
+ const { unmount } = render(_jsx(SandpackWrapper, { framework: framework, files: mockFiles }));
67
+ await screen.findByTestId('sandpack-provider');
68
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
69
+ unmount();
70
+ }
71
+ });
72
+ it('should use template files when no custom files provided', async () => {
73
+ render(_jsx(SandpackWrapper, { framework: "react" }));
74
+ await screen.findByTestId('sandpack-provider');
75
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
76
+ });
77
+ });
78
+ describe('SandpackPreview', () => {
79
+ const mockFiles = {
80
+ '/App.tsx': { code: 'export default function App() { return <div>Test</div>; }' },
81
+ };
82
+ it('should render without crashing', async () => {
83
+ render(_jsx(SandpackPreview, { framework: "react", files: mockFiles }));
84
+ await screen.findByTestId('sandpack-provider');
85
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
86
+ });
87
+ it('should show loading fallback initially', () => {
88
+ render(_jsx(SandpackPreview, { framework: "react", files: mockFiles }));
89
+ expect(screen.getByText('Loading code editor...')).toBeInTheDocument();
90
+ });
91
+ it('should render preview only (no editor)', async () => {
92
+ render(_jsx(SandpackPreview, { framework: "react", files: mockFiles }));
93
+ await screen.findByTestId('sandpack-preview');
94
+ expect(screen.getByTestId('sandpack-preview')).toBeInTheDocument();
95
+ expect(screen.queryByTestId('sandpack-code-editor')).not.toBeInTheDocument();
96
+ expect(screen.queryByTestId('sandpack-file-explorer')).not.toBeInTheDocument();
97
+ expect(screen.queryByTestId('sandpack-console')).not.toBeInTheDocument();
98
+ });
99
+ it('should accept custom className', async () => {
100
+ const { container } = render(_jsx(SandpackPreview, { framework: "react", files: mockFiles, className: "preview-class" }));
101
+ await screen.findByTestId('sandpack-preview');
102
+ const preview = container.querySelector('[data-testid="sandpack-preview"]');
103
+ expect(preview).toHaveClass('preview-class');
104
+ });
105
+ it('should handle different themes', async () => {
106
+ const themes = ['light', 'dark', 'auto'];
107
+ for (const theme of themes) {
108
+ const { unmount } = render(_jsx(SandpackPreview, { framework: "react", files: mockFiles, theme: theme }));
109
+ await screen.findByTestId('sandpack-provider');
110
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
111
+ unmount();
112
+ }
113
+ });
114
+ it('should use template files when no custom files provided', async () => {
115
+ render(_jsx(SandpackPreview, { framework: "react" }));
116
+ await screen.findByTestId('sandpack-provider');
117
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
118
+ });
119
+ });
120
+ describe('Component props', () => {
121
+ const mockFiles = {
122
+ '/App.tsx': { code: 'test' },
123
+ };
124
+ it('should accept all SandpackWrapper props', async () => {
125
+ render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, activeFile: "/App.tsx", theme: "dark", showFileExplorer: true, showConsole: true, showLineNumbers: true, showInlineErrors: true, showTabs: true, closableTabs: true, height: 600, className: "custom" }));
126
+ await screen.findByTestId('sandpack-provider');
127
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
128
+ });
129
+ it('should accept all SandpackPreview props', async () => {
130
+ render(_jsx(SandpackPreview, { framework: "react", files: mockFiles, theme: "dark", height: 400, className: "preview" }));
131
+ await screen.findByTestId('sandpack-provider');
132
+ expect(screen.getByTestId('sandpack-provider')).toBeInTheDocument();
133
+ });
134
+ it('should apply custom height', async () => {
135
+ const { container } = render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, height: 800 }));
136
+ await screen.findByTestId('sandpack-layout');
137
+ const layout = container.querySelector('[data-testid="sandpack-layout"]');
138
+ expect(layout).toHaveStyle({ height: '800px' });
139
+ });
140
+ it('should handle string height', async () => {
141
+ const { container } = render(_jsx(SandpackWrapper, { framework: "react", files: mockFiles, height: "100vh" }));
142
+ await screen.findByTestId('sandpack-layout');
143
+ const layout = container.querySelector('[data-testid="sandpack-layout"]');
144
+ expect(layout).toHaveStyle({ height: '100vh' });
145
+ });
146
+ });
147
+ //# sourceMappingURL=sandpack-wrapper.test.js.map