No test coverage existed before this. Adds vitest + jsdom (2 new devDependencies) and a suite that runs entirely without a browser: real Leaflet objects work fine under jsdom for everything this library needs to verify (option/attribute wiring, event forwarding), given a ResizeObserver stub in test/setup.ts (jsdom's only real gap here). - test/core/with-props.test.ts: the WithProps mixin itself, against a fake Leaflet-like class -- attribute<->setter dispatch, get/attribute/default fallback order, event-driven attribute sync-back, positional/recreate/ attach modes, and the generic fire()-patch event forwarding. Child registration (popup/tooltip/layer binding) uses real Popup/Tooltip/Marker instances since #onChildRegister discriminates by instanceof. - test/core/props.test.ts: the codec functions in isolation. - test/components/*.test.ts: grouped smoke tests across all components. - test/integration.test.ts: full tree wiring (map + tile-layer + feature-group + marker + popup). Caught and fixed one real bug along the way: urlProp's "live url getter" from the last refactor was dead code -- neither ImageOverlay nor VideoOverlay actually expose getUrl(). Removed it and the now-pointless getUrl?() from the Sourced interface in shared-props.ts. tsconfig.test.json keeps test/ out of the tsc build (dist/ stays test-free) while still typechecking it; oxlint.config.ts now covers test/ too, with max-classes-per-file relaxed there since testing a class factory means many small one-off element classes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
701 B
TypeScript
30 lines
701 B
TypeScript
import { defineConfig } from 'oxlint';
|
|
|
|
export default defineConfig({
|
|
plugins: ['typescript', 'unicorn', 'oxc'],
|
|
categories: {
|
|
correctness: 'error',
|
|
suspicious: 'warn',
|
|
pedantic: 'warn',
|
|
},
|
|
rules: {
|
|
'eslint/max-lines': 'off',
|
|
'eslint/max-lines-per-function': 'off',
|
|
},
|
|
overrides: [
|
|
{
|
|
// Each test scenario for the WithProps factory needs its own small
|
|
// custom element class -- that's the nature of testing a class factory,
|
|
// not a sign the file should be split up.
|
|
files: ['test/**/*.ts'],
|
|
rules: {
|
|
'eslint/max-classes-per-file': 'off',
|
|
},
|
|
},
|
|
],
|
|
env: {
|
|
builtin: true,
|
|
},
|
|
ignorePatterns: ['dist/'],
|
|
});
|