fix: Keep the notification popup visible / centered (#2702)

- Closes: #2693
This commit is contained in:
Dermot Duffy
2026-08-22 08:36:42 -07:00
committed by GitHub
parent 2f74889bcb
commit 0aebf3c484
10 changed files with 498 additions and 9 deletions
+30
View File
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest';
import { getShadowRootHost } from '../../src/utils/shadow-root';
// @vitest-environment jsdom
describe('getShadowRootHost', () => {
it('should return the host of the shadow root the element lives in', () => {
const host = document.createElement('div');
host.attachShadow({ mode: 'open' });
const element = document.createElement('span');
host.shadowRoot?.append(element);
expect(getShadowRootHost(element)).toBe(host);
});
it('should return null for an element in the light DOM', () => {
const element = document.createElement('span');
document.body.append(element);
try {
expect(getShadowRootHost(element)).toBeNull();
} finally {
element.remove();
}
});
it('should return null for an element that is not connected', () => {
expect(getShadowRootHost(document.createElement('span'))).toBeNull();
});
});