@micha.bigler/ui-core-micha 2.42.3 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -233,39 +233,36 @@ describe('ScatterReferenceCurve / ScatterReferenceLine (THEME-10)', () => {
233
233
  });
234
234
  });
235
235
 
236
- // CHART-8: minHeight/height/aspect resolution, wired through the actual component.
237
- describe('ScatterChart minHeight/height resolution (CHART-8)', () => {
236
+ // UCM-CHART-12: `size`/`height` resolution, wired through the actual component. Replaces the
237
+ // deleted `minHeight`/`aspect` CHART-8 trio.
238
+ describe('ScatterChart size/height resolution (UCM-CHART-12)', () => {
238
239
  afterEach(() => { cleanup(); vi.clearAllMocks(); });
239
240
 
240
- it('sizes the chart from minHeight alone when neither height nor aspect is set', () => {
241
- renderScatter({ minHeight: 300 });
242
- expect(scatterSpy.mock.calls.at(-1)[0].height).toBe(300);
243
- expect(window.getComputedStyle(screen.getByTestId('scatter-chart-container')).minHeight).toBe('300px');
241
+ it.each([
242
+ ['compact', 240],
243
+ ['standard', 320],
244
+ ['tall', 400],
245
+ ])('resolves size="%s" to %ipx, on both the chart height and the wrapper', (size, px) => {
246
+ renderScatter({ size });
247
+ expect(scatterSpy.mock.calls.at(-1)[0].height).toBe(px);
248
+ expect(window.getComputedStyle(screen.getByTestId('scatter-chart-container')).height).toBe(`${px}px`);
244
249
  });
245
250
 
246
- it('leaves minHeight as a floor and gives the chart no fixed height when aspect is set (no height)', () => {
247
- renderScatter({ minHeight: 320, aspect: 1.8 });
248
- expect(scatterSpy.mock.calls.at(-1)[0].height).toBeUndefined();
249
- const style = window.getComputedStyle(screen.getByTestId('scatter-chart-container'));
250
- expect(style.minHeight).toBe('320px');
251
- expect(style.aspectRatio).toBe('1.8 / 1');
251
+ it('lets height override size entirely, as the documented escape', () => {
252
+ renderScatter({ size: 'tall', height: 280 });
253
+ expect(scatterSpy.mock.calls.at(-1)[0].height).toBe(280);
254
+ expect(window.getComputedStyle(screen.getByTestId('scatter-chart-container')).height).toBe('280px');
252
255
  });
253
256
 
254
- it('caps the wrapper at height when minHeight is larger, closing the dead-space gap', () => {
255
- renderScatter({ minHeight: 420, height: 380 });
256
- expect(scatterSpy.mock.calls.at(-1)[0].height).toBe(380);
257
- expect(window.getComputedStyle(screen.getByTestId('scatter-chart-container')).minHeight).toBe('380px');
257
+ it('throws in dev when a caller still passes minHeight, naming the replacement', () => {
258
+ expect(() => renderScatter({ minHeight: 300 })).toThrow(/size=.*standard.*tall/);
258
259
  });
259
260
 
260
- it('is byte-identical when minHeight equals height', () => {
261
- renderScatter({ minHeight: 320, height: 320 });
262
- expect(scatterSpy.mock.calls.at(-1)[0].height).toBe(320);
263
- expect(window.getComputedStyle(screen.getByTestId('scatter-chart-container')).minHeight).toBe('320px');
261
+ it('throws in dev when a caller still passes aspect, naming the removal', () => {
262
+ expect(() => renderScatter({ aspect: 1.8 })).toThrow(/aspect/);
264
263
  });
265
264
 
266
- it('is unchanged when height is passed alone', () => {
267
- renderScatter({ height: 280 });
268
- expect(scatterSpy.mock.calls.at(-1)[0].height).toBe(280);
269
- expect(window.getComputedStyle(screen.getByTestId('scatter-chart-container')).minHeight).toBe('auto');
265
+ it('throws in dev when a caller still passes margin, naming the removal', () => {
266
+ expect(() => renderScatter({ margin: { top: 1 } })).toThrow(/margin/);
270
267
  });
271
268
  });