mirror of
https://github.com/zoriya/v10.git
synced 2026-08-14 09:59:44 +00:00
fix(core): skip delay when switching between grouped tooltips (#903)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ef9757cd28
commit
ff8fb3fd36
@@ -58,7 +58,7 @@ describe('TooltipGroupCore', () => {
|
||||
expect(group.shouldSkipDelay()).toBe(false);
|
||||
});
|
||||
|
||||
it('clears skip-delay when a new tooltip opens', () => {
|
||||
it('should skip delay when another tooltip is already open', () => {
|
||||
const group = new TooltipGroupCore({ timeout: 400 });
|
||||
|
||||
group.notifyOpen();
|
||||
@@ -66,15 +66,15 @@ describe('TooltipGroupCore', () => {
|
||||
// A new tooltip opens before timeout expires
|
||||
group.notifyOpen();
|
||||
|
||||
expect(group.shouldSkipDelay()).toBe(false);
|
||||
expect(group.shouldSkipDelay()).toBe(true);
|
||||
});
|
||||
|
||||
it('should not skip delay when a tooltip is currently open', () => {
|
||||
it('should skip delay when a tooltip is currently open', () => {
|
||||
const group = new TooltipGroupCore();
|
||||
|
||||
group.notifyOpen();
|
||||
|
||||
expect(group.shouldSkipDelay()).toBe(false);
|
||||
expect(group.shouldSkipDelay()).toBe(true);
|
||||
});
|
||||
|
||||
it('respects updated timeout via setProps', () => {
|
||||
|
||||
@@ -38,7 +38,7 @@ export class TooltipGroupCore {
|
||||
}
|
||||
|
||||
shouldSkipDelay(): boolean {
|
||||
if (this.#isOpen) return false;
|
||||
if (this.#isOpen) return true;
|
||||
return Date.now() - this.#lastCloseTime < this.#props.timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export class TooltipGroupElement extends MediaElement {
|
||||
timeout = TooltipGroupCore.defaultProps.timeout;
|
||||
|
||||
readonly #core = new TooltipGroupCore();
|
||||
readonly #provider = new ContextProvider(this, { context: tooltipGroupContext });
|
||||
readonly #provider = new ContextProvider(this, { context: tooltipGroupContext, initialValue: this.#core });
|
||||
|
||||
protected override update(_changed: PropertyValues): void {
|
||||
super.update(_changed);
|
||||
|
||||
Reference in New Issue
Block a user