Files
houseplan-card/test/help-behavior.test.mjs
2026-08-13 00:14:51 +03:00

21 lines
859 B
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
helpHasContent,
helpScrollShouldDismiss,
} from '../test-build/help-behavior.js';
test('help is absent unless both visible copy and an accessible name exist', () => {
assert.equal(helpHasContent('Explanation', 'More information'), true);
assert.equal(helpHasContent(' ', 'More information'), false);
assert.equal(helpHasContent('Explanation', ''), false);
assert.equal(helpHasContent(null, 'More information'), false);
});
test('only scrolling the owning dialog outside the floating surface dismisses help', () => {
assert.equal(helpScrollShouldDismiss(true, true), false);
assert.equal(helpScrollShouldDismiss(true, false), false);
assert.equal(helpScrollShouldDismiss(false, true), true);
assert.equal(helpScrollShouldDismiss(false, false), false);
});