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%"/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user