@@ -422,6 +422,8 @@ test.describe("Asset Manager V2", () => {
422422 await expect ( page . locator ( "#assetRoleSelect" ) ) . toHaveValue ( "music" ) ;
423423 await page . locator ( "#assetKindImage" ) . check ( ) ;
424424 await expect ( page . locator ( "#assetRoleSelect" ) ) . toHaveValue ( "sprite" ) ;
425+ await expect ( page . locator ( "#assetRoleSelect option" ) ) . toHaveText ( [ "sprite" , "background" , "bezel" , "preview-image" , "ui" ] ) ;
426+ await expect ( page . locator ( "#assetRoleSelect" ) ) . toHaveAttribute ( "title" , "Allowed roles for image: sprite, background, bezel, preview-image, ui" ) ;
425427 await page . locator ( "#pickAssetFileButton" ) . click ( ) ;
426428 const pickerOptions = await page . evaluate ( ( ) => window . __assetManagerV2PickerOptions . at ( - 1 ) ) ;
427429 expect ( pickerOptions . types [ 0 ] . description ) . toBe ( "Image assets" ) ;
@@ -542,7 +544,8 @@ test.describe("Asset Manager V2", () => {
542544 } ) ;
543545 await page . locator ( "#pickAssetFileButton" ) . click ( ) ;
544546 await expect ( page . locator ( "#assetRoleSelect" ) ) . toHaveValue ( "sprite" ) ;
545- await expect ( page . locator ( "#assetIdInput" ) ) . toHaveValue ( "assets.image.sprite.preview" ) ;
547+ await page . locator ( "#assetRoleSelect" ) . selectOption ( "preview-image" ) ;
548+ await expect ( page . locator ( "#assetIdInput" ) ) . toHaveValue ( "assets.image.preview-image.preview" ) ;
546549 await page . locator ( "#addAssetButton" ) . click ( ) ;
547550
548551 await queueAssetFile ( page , {
@@ -693,8 +696,8 @@ test.describe("Asset Manager V2", () => {
693696 } ,
694697 {
695698 deleteTopRight : true ,
696- typeRole : "image:sprite " ,
697- id : "assets.image.sprite .preview" ,
699+ typeRole : "image:preview-image " ,
700+ id : "assets.image.preview-image .preview" ,
698701 textLeftAligned : true ,
699702 hasSeparateDeleteButton : false ,
700703 hasInlineDelete : true ,
@@ -709,8 +712,8 @@ test.describe("Asset Manager V2", () => {
709712 idFontWeight : 500 ,
710713 typeRoleFontWeight : 800 ,
711714 rowGap : 2 ,
712- text : "X\nimage:sprite \nassets.image.sprite .preview" ,
713- tooltip : "id: assets.image.sprite .preview\ntype: image\nkind: png\nrole: sprite \npath: assets/images/preview.png"
715+ text : "X\nimage:preview-image \nassets.image.preview-image .preview" ,
716+ tooltip : "id: assets.image.preview-image .preview\ntype: image\nkind: png\nrole: preview-image \npath: assets/images/preview.png"
714717 }
715718 ] ) ;
716719 const tileLayout = await page . locator ( "#assetList" ) . evaluate ( ( list ) => {
@@ -1267,14 +1270,14 @@ test.describe("Asset Manager V2", () => {
12671270 await expect ( page . locator ( "#returnToWorkspaceButton" ) ) . toBeEnabled ( ) ;
12681271 await expect ( page . locator ( "#workspaceInsertAssetsButton" ) ) . toHaveCount ( 0 ) ;
12691272 await expect ( page . locator ( "#workspaceCopyManifestButton" ) ) . toHaveCount ( 0 ) ;
1270- await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / W o r k s p a c e M a n a g e r V 2 l o a d e d 1 3 v a l i d a t e d a s s e t s f r o m t o o l s \. a s s e t - m a n a g e r - v 2 \. a s s e t s / ) ;
1273+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / W o r k s p a c e M a n a g e r V 2 l o a d e d 1 4 v a l i d a t e d a s s e t s f r o m t o o l s \. a s s e t - m a n a g e r - v 2 \. a s s e t s / ) ;
12711274 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / W o r k s p a c e M a n a g e r V 2 l o a d e d \d + p a l e t t e c o l o r s f r o m a c t i v e p a l e t t e c o n t e x t / ) ;
12721275 const hostContextId = await page . evaluate ( ( ) => new URL ( window . location . href ) . searchParams . get ( "hostContextId" ) ) ;
12731276 const initialAssetCount = await page . evaluate ( ( id ) => {
12741277 const context = JSON . parse ( sessionStorage . getItem ( id ) ) ;
12751278 return Object . keys ( context . tools [ "asset-manager-v2" ] . assets ) . length ;
12761279 } , hostContextId ) ;
1277- expect ( initialAssetCount ) . toBe ( 13 ) ;
1280+ expect ( initialAssetCount ) . toBe ( 14 ) ;
12781281 const workspacePreviewContext = await page . evaluate ( async ( ) => {
12791282 const { WorkspaceBridge } = await import ( "/tools/asset-manager-v2/js/services/WorkspaceBridge.js" ) ;
12801283 return new WorkspaceBridge ( { windowRef : window } ) . readWorkspacePreviewContext ( ) ;
@@ -1313,6 +1316,8 @@ test.describe("Asset Manager V2", () => {
13131316 await page . locator ( "#pickAssetFileButton" ) . click ( ) ;
13141317 await expect ( page . locator ( "#assetIdInput" ) ) . toHaveValue ( "assets.image.sprite.preview" ) ;
13151318 await expect ( page . locator ( "#assetPathInput" ) ) . toHaveValue ( "assets/images/preview.png" ) ;
1319+ await page . locator ( "#assetRoleSelect" ) . selectOption ( "preview-image" ) ;
1320+ await expect ( page . locator ( "#assetIdInput" ) ) . toHaveValue ( "assets.image.preview-image.preview" ) ;
13161321 await page . locator ( "#addAssetButton" ) . click ( ) ;
13171322 await expect ( page . locator ( '#assetPreview [data-preview-type="image"][data-preview-kind="png"] img' ) ) . toHaveAttribute ( "src" , "/games/Asteroids/assets/images/preview.png" ) ;
13181323
@@ -1373,7 +1378,7 @@ test.describe("Asset Manager V2", () => {
13731378 await expect ( page . locator ( "#inspectorOutput" ) ) . toContainText ( "\"type\": \"color\"" ) ;
13741379 await expect ( page . locator ( "#inspectorOutput" ) ) . toContainText ( "\"kind\": \"hex\"" ) ;
13751380 await expect ( page . locator ( "#inspectorOutput" ) ) . toContainText ( "\"name\": \"HUD Blue\"" ) ;
1376- await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K W o r k s p a c e M a n a g e r V 2 s e s s i o n m a n i f e s t n o w h a s 1 7 v a l i d a t e d a s s e t s \. / ) ;
1381+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K W o r k s p a c e M a n a g e r V 2 s e s s i o n m a n i f e s t n o w h a s 1 8 v a l i d a t e d a s s e t s \. / ) ;
13771382
13781383 const storedContext = await page . evaluate ( ( id ) => JSON . parse ( sessionStorage . getItem ( id ) ) , hostContextId ) ;
13791384 expect ( storedContext . documentKind ) . toBe ( "workspace-manifest" ) ;
@@ -1382,7 +1387,8 @@ test.describe("Asset Manager V2", () => {
13821387 expect ( storedContext . workspaceManifest ) . toBeUndefined ( ) ;
13831388 expect ( storedContext . tools [ "asset-browser" ] ) . toBeUndefined ( ) ;
13841389 expect ( storedContext . tools [ "palette-browser" ] ) . toBeUndefined ( ) ;
1385- expect ( Object . keys ( storedContext . tools [ "asset-manager-v2" ] . assets ) ) . toHaveLength ( 17 ) ;
1390+ expect ( Object . keys ( storedContext . tools [ "asset-manager-v2" ] . assets ) ) . toHaveLength ( 18 ) ;
1391+ expect ( storedContext . tools [ "asset-manager-v2" ] . previewImagePath ) . toBe ( "assets/images/preview.png" ) ;
13861392 expect ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.audio.sound.fire" ] ) . toEqual ( {
13871393 path : "assets/audio/fire.wav" ,
13881394 type : "audio" ,
@@ -1404,11 +1410,11 @@ test.describe("Asset Manager V2", () => {
14041410 role : "ui" ,
14051411 source : "asset-manager-v2"
14061412 } ) ;
1407- expect ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.image.sprite .preview" ] ) . toEqual ( {
1413+ expect ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.image.preview-image .preview" ] ) . toEqual ( {
14081414 path : "assets/images/preview.png" ,
14091415 type : "image" ,
14101416 kind : "png" ,
1411- role : "sprite " ,
1417+ role : "preview-image " ,
14121418 source : "asset-manager-v2"
14131419 } ) ;
14141420 expect ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.color.hud.primary-hud.hud-blue" ] ) . toEqual ( {
@@ -1439,7 +1445,8 @@ test.describe("Asset Manager V2", () => {
14391445 const download = await downloadPromise ;
14401446 expect ( download . suggestedFilename ( ) ) . toBe ( "workspace-manager-v2-Asteroids.workspace.manifest.json" ) ;
14411447 const savedManifest = JSON . parse ( await readFile ( await download . path ( ) , "utf8" ) ) ;
1442- expect ( Object . keys ( savedManifest . tools [ "asset-manager-v2" ] . assets ) ) . toHaveLength ( 17 ) ;
1448+ expect ( Object . keys ( savedManifest . tools [ "asset-manager-v2" ] . assets ) ) . toHaveLength ( 18 ) ;
1449+ expect ( savedManifest . tools [ "asset-manager-v2" ] . previewImagePath ) . toBe ( "assets/images/preview.png" ) ;
14431450 expect ( savedManifest . tools [ "asset-manager-v2" ] . assets [ "assets.audio.sound.laser" ] ) . toEqual ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.audio.sound.laser" ] ) ;
14441451 expect ( savedManifest . tools [ "asset-manager-v2" ] . assets [ "assets.color.hud.primary-hud.hud-blue" ] ) . toEqual ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.color.hud.primary-hud.hud-blue" ] ) ;
14451452 expect ( savedManifest . tools [ "vector-map-editor" ] . vectorMapDocument . vectors . map ( ( vector ) => vector . id ) ) . toContain ( "vector.asteroids.ship" ) ;
0 commit comments