release: v0.12.0 (#520)

Forty-one commits since v0.11.0. See CHANGELOG.md for the full list and the upgrade notes.
This commit is contained in:
Ralksta
2026-08-23 23:18:14 +02:00
committed by GitHub
parent 2f546f440d
commit 10ec68f493
119 changed files with 6888 additions and 758 deletions

View File

@@ -0,0 +1,37 @@
import { describe, it, expect } from 'vitest';
import { resolveWatermarkOpacity, WATERMARK_DEFAULT_OPACITY } from '../config/schema';
/**
* The lightbox used to divide `watermark.opacity` by 100 while both the docs
* and the admin slider expressed it as a fraction, so a configured 0.9 rendered
* as 0.009 — invisible (#508).
*/
describe('resolveWatermarkOpacity', () => {
it('passes a documented fraction through unchanged', () => {
expect(resolveWatermarkOpacity(0.5)).toBe(0.5);
expect(resolveWatermarkOpacity(0.9)).toBe(0.9);
});
it('reads a value above 1 as a percentage', () => {
expect(resolveWatermarkOpacity(90)).toBe(0.9);
expect(resolveWatermarkOpacity(50)).toBe(0.5);
});
it('treats 1 as fully opaque, not as one percent', () => {
expect(resolveWatermarkOpacity(1)).toBe(1);
});
it('clamps out-of-range values into 0–1', () => {
expect(resolveWatermarkOpacity(400)).toBe(1);
expect(resolveWatermarkOpacity(-2)).toBe(0);
});
it('falls back to the default when unset or not a number', () => {
expect(resolveWatermarkOpacity(undefined)).toBe(WATERMARK_DEFAULT_OPACITY);
expect(resolveWatermarkOpacity(NaN)).toBe(WATERMARK_DEFAULT_OPACITY);
});
it('keeps 0 as fully transparent rather than falling back', () => {
expect(resolveWatermarkOpacity(0)).toBe(0);
});
});