feat(ui): standardize inspector spacing and compact level geometry
This commit is contained in:
@@ -47,3 +47,19 @@ test("viewport controls share one scale without scaling nested controls twice",
|
||||
assert.match(styles, /\.nodedc-segmented\) :is\([^}]+zoom: 1;/);
|
||||
assert.ok(JSON.parse(registrySource).components.find(c=>c.id==='button').domContract.includes('nodedc-viewport-controls'));
|
||||
});
|
||||
|
||||
import { LevelButton } from "../packages/ui-react/dist/index.js";
|
||||
import { levelButtonGeometry } from "../packages/ui-react/dist/levelButtonGeometry.js";
|
||||
test("compact level indicators fit both contrast layers with proportional text and padding", () => {
|
||||
const tiny=levelButtonGeometry({width:32,height:12,radius:4},4);
|
||||
const normal=levelButtonGeometry({width:64,height:24,radius:8},4);
|
||||
assert.equal(tiny.fontSize,'calc(var(--nodedc-font-size-md) * 0.5)');
|
||||
assert.equal(tiny.padding,'calc(0.25rem * 0.5) calc(var(--nodedc-space-2) * 0.5)');
|
||||
assert.equal(normal.fontSize,'calc(var(--nodedc-font-size-md) * 1)');
|
||||
assert.equal(levelButtonGeometry({width:-1,height:NaN},4).width,32);
|
||||
assert.equal(levelButtonGeometry({width:-1,height:NaN},4).height,46);
|
||||
const markup=renderToStaticMarkup(createElement(LevelButton,{value:1,label:'Battery',fillColor:'#ffffff',geometry:{width:32,height:12,radius:4}}));
|
||||
assert.match(markup,/width:32px/);assert.match(markup,/height:12px/);
|
||||
assert.match(markup,/nodedc-level-button__fill/);
|
||||
assert.match(markup,/100/);assert.match(markup,/aria-label="Battery: 100%"/);
|
||||
});
|
||||
|
||||
@@ -59,3 +59,12 @@ test("Foundry Inspector screens consume the semantic selection field", async ()
|
||||
assert.equal((catalog.match(/<InspectorSelectField/g) ?? []).length, 2);
|
||||
assert.match(coreStyles, /\.nodedc-inspector \.nodedc-control-row:has\(\.nodedc-select-anchor\)/);
|
||||
});
|
||||
|
||||
test("Inspector owns form header and centered action footer around its sections",async()=>{
|
||||
const markup=renderToStaticMarkup(createElement(Inspector,{header:'Form fields',footer:'Action',sections:[{id:'surface',label:'Surface',content:'Controls'},{id:'textures',label:'Textures',content:'Slots'}]}));
|
||||
assert.ok(markup.indexOf('nodedc-inspector__header')<markup.indexOf('nodedc-inspector__group'));
|
||||
assert.ok(markup.indexOf('nodedc-inspector__footer')>markup.lastIndexOf('nodedc-inspector__section'));
|
||||
const css=await readFile(new URL('../packages/ui-core/styles.css',import.meta.url),'utf8');
|
||||
assert.match(css,/\.nodedc-inspector__group\s*\{[^}]*gap: var\(--nodedc-space-3\)/);
|
||||
assert.match(css,/\.nodedc-inspector__footer\s*\{[^}]*justify-content: center/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user