diff --git a/tests/wiring.test.mjs b/tests/wiring.test.mjs index f53ed3f..52217dd 100644 --- a/tests/wiring.test.mjs +++ b/tests/wiring.test.mjs @@ -112,10 +112,34 @@ test('player damage is per projectile with no global cooldown or volley suppress assert.doesNotMatch(source, /volleyId/); }); -test('portrait status cards sit tightly beneath the top HUD', async () => { +test('portrait health sprites sit tightly beneath the top HUD', async () => { const source = await read('src/mobile-hud.js'); - assert.match(source, /\.steam-player-card \{[\s\S]*?top: clamp\(80px, 10\.3vh, 90px\)/); - assert.match(source, /\.steam-enemy-card \{[\s\S]*?top: clamp\(80px, 10\.3vh, 90px\)/); + assert.match(source, /\.steam-player-card,[\s\S]*?\.steam-enemy-card \{[\s\S]*?top: clamp\(80px, 10\.3vh, 90px\)/); + assert.match(source, /background-size: 400% 300%/); + assert.match(source, /background-color: transparent/); assert.match(source, /@media \(min-width: 700px\)[\s\S]*?\.steam-player-card,[\s\S]*?\.steam-enemy-card \{[\s\S]*?top: clamp\(70px, 20vh, 104px\)/); }); + +test('mobile HUD uses uploaded player and enemy health sprite sheets', async () => { + const source = await read('src/mobile-hud.js'); + + assert.match(source, /import playerHealthSrc from '.\/assets\/controller\/player-health\.js'/); + assert.match(source, /import enemyHealthSrc from '.\/assets\/controller\/enemy-health\.js'/); + assert.doesNotMatch(source, /import leftStatusSrc/); + assert.doesNotMatch(source, /import rightControlsSrc/); + assert.match(source, /addHealthPiece\('steam-player-card', playerHealthSrc/); + assert.match(source, /addHealthPiece\('steam-enemy-card', enemyHealthSrc/); + assert.match(source, /const healthFrame = \(current, max\) =>/); + assert.match(source, /const setHealthFrame = \(piece, frame\) =>/); + assert.match(source, /setHealthFrame\(playerHealthPiece, healthFrame\(playerHull, 100\)\)/); + assert.match(source, /setHealthFrame\(enemyHealthPiece, pirate \? healthFrame\(enemyHull, 120\) : 11\)/); + assert.doesNotMatch(source, /steam-bar-fill/); +}); + +test('uploaded top HUD uses its new aspect ratio', async () => { + const source = await read('src/mobile-hud.js'); + + assert.match(source, /\.steam-top \{[\s\S]*?aspect-ratio: 960 \/ 246/); + assert.match(source, /@media \(min-width: 700px\)[\s\S]*?\.steam-top \{[\s\S]*?aspect-ratio: 960 \/ 246/); +});