diff --git a/editor/src/components/canvas/ui-jsx-canvas-bugs.spec.tsx b/editor/src/components/canvas/ui-jsx-canvas-bugs.spec.tsx index 92e358376fe7..fb46578fdadb 100644 --- a/editor/src/components/canvas/ui-jsx-canvas-bugs.spec.tsx +++ b/editor/src/components/canvas/ui-jsx-canvas-bugs.spec.tsx @@ -132,7 +132,7 @@ export var storyboard = ( ) `, { - 'app.js': ` + '/app.js': ` import React from 'react' export default function App(props) { return
@@ -148,7 +148,7 @@ export default function App(props) { id=\\"canvas-container\\" data-testid=\\"canvas-container\\" style=\\"position: absolute\\" - data-utopia-valid-paths=\\"sb sb/scene sb/scene/app\\" + data-utopia-valid-paths=\\"sb sb/scene sb/scene/app sb/scene/app:app-outer-div sb/scene/app:app-outer-div/inner-div\\" data-utopia-root-element-path=\\"sb\\" >
-
-
hello
+
+
+ hello +
@@ -240,7 +245,7 @@ export var storyboard = ( ) `, { - 'app.js': ` + '/app.js': ` import React from 'react' export default function App(props) { return
@@ -256,7 +261,7 @@ export default function App(props) { id=\\"canvas-container\\" data-testid=\\"canvas-container\\" style=\\"position: absolute\\" - data-utopia-valid-paths=\\"storyboard-entity storyboard-entity/scene-1-entity storyboard-entity/scene-1-entity/app-entity storyboard-entity/scene-2-entity storyboard-entity/scene-2-entity/same-file-app-entity storyboard-entity/scene-2-entity/same-file-app-entity:same-file-app-div\\" + data-utopia-valid-paths=\\"storyboard-entity storyboard-entity/scene-1-entity storyboard-entity/scene-1-entity/app-entity storyboard-entity/scene-1-entity/app-entity:app-outer-div storyboard-entity/scene-1-entity/app-entity:app-outer-div/inner-div storyboard-entity/scene-2-entity storyboard-entity/scene-2-entity/same-file-app-entity storyboard-entity/scene-2-entity/same-file-app-entity:same-file-app-div\\" data-utopia-root-element-path=\\"storyboard-entity\\" >
-
hello
+
+ hello +
{ } `, { - 'app.js': ` + '/app.js': ` import { throwError } from './card' export function throwErrorFromCard() { diff --git a/editor/src/components/canvas/ui-jsx-canvas.test-utils.tsx b/editor/src/components/canvas/ui-jsx-canvas.test-utils.tsx index 450653a9d639..dc7dc9c7cd2f 100644 --- a/editor/src/components/canvas/ui-jsx-canvas.test-utils.tsx +++ b/editor/src/components/canvas/ui-jsx-canvas.test-utils.tsx @@ -60,8 +60,13 @@ export interface PartialCanvasProps { } export const dumbResolveFn = (filenames: Array): CurriedResolveFn => { - return (_: ProjectContentTreeRoot) => (importOrigin: string, toImport: string) => - resolveTestFiles(filenames, importOrigin, toImport) + return (_: ProjectContentTreeRoot) => (importOrigin: string, toImport: string) => { + const result = resolveTestFiles(filenames, importOrigin, toImport) + if (!isRight(result)) { + console.error(result.value) + } + return result + } } function resolveTestFiles( @@ -72,7 +77,8 @@ function resolveTestFiles( let normalizedName = normalizeName(importOrigin, toImport) // Partly restoring what `normalizeName` strips away. if (toImport.startsWith('.')) { - normalizedName = path.normalize(`${importOrigin}/${normalizedName}`) + const parsedOrigin = path.parse(importOrigin) + normalizedName = path.normalize(`${parsedOrigin.dir}/${normalizedName}`) } else if (toImport.startsWith('/')) { normalizedName = `/${normalizedName}` } @@ -92,7 +98,9 @@ function resolveTestFiles( case UiFilePath: return right(UiFilePath) default: - return left(`Test error, the dumbResolveFn did not know about this file: ${toImport}`) + return left( + `Test error, the dumbResolveFn did not know about this file: ${toImport}, got ${normalizedName}`, + ) } }