This commit is contained in:
@@ -315,12 +315,12 @@ describe('ScryingPoolStrip', () => {
|
||||
});
|
||||
|
||||
describe('_computeStripWidth()', () => {
|
||||
it('returns 85 for vertical-sm', () => {
|
||||
expect(strip._computeStripWidth('vertical-sm', 3)).toBe(85);
|
||||
it('returns tileWidth + 11 for vertical-sm', () => {
|
||||
expect(strip._computeStripWidth('vertical-sm', 3)).toBe(83 + 8 + 3);
|
||||
});
|
||||
|
||||
it('returns 242 for vertical-md', () => {
|
||||
expect(strip._computeStripWidth('vertical-md', 3)).toBe(242);
|
||||
it('returns tileWidth + 11 for vertical-md', () => {
|
||||
expect(strip._computeStripWidth('vertical-md', 3)).toBe(150 + 8 + 3);
|
||||
});
|
||||
|
||||
it('returns 85 for unknown layout', () => {
|
||||
@@ -465,24 +465,20 @@ describe('ScryingPoolStrip', () => {
|
||||
vi.stubGlobal('document', originalDocument);
|
||||
});
|
||||
|
||||
it('removes video elements and cleans up streams', () => {
|
||||
it('removes video elements without stopping tracks', () => {
|
||||
const mockStream = new MediaStream();
|
||||
const mockTrack = { stop: vi.fn() };
|
||||
const mockVideoElement = {
|
||||
srcObject: mockStream,
|
||||
remove: vi.fn(),
|
||||
};
|
||||
// Add getTracks method to the mock stream
|
||||
mockStream.getTracks = vi.fn().mockReturnValue([mockTrack]);
|
||||
|
||||
vi.stubGlobal('document', {
|
||||
strip.element = {
|
||||
querySelectorAll: vi.fn().mockReturnValue([mockVideoElement]),
|
||||
});
|
||||
};
|
||||
|
||||
strip._cleanupVideoStreams();
|
||||
|
||||
expect(mockStream.getTracks).toHaveBeenCalled();
|
||||
expect(mockTrack.stop).toHaveBeenCalled();
|
||||
// Tracks are NOT stopped — they belong to FoundryVTT's WebRTC system
|
||||
expect(mockVideoElement.srcObject).toBe(null);
|
||||
expect(mockVideoElement.remove).toHaveBeenCalled();
|
||||
});
|
||||
@@ -493,18 +489,18 @@ describe('ScryingPoolStrip', () => {
|
||||
remove: vi.fn(),
|
||||
};
|
||||
|
||||
vi.stubGlobal('document', {
|
||||
strip.element = {
|
||||
querySelectorAll: vi.fn().mockReturnValue([mockVideoElement]),
|
||||
});
|
||||
};
|
||||
|
||||
expect(() => strip._cleanupVideoStreams()).not.toThrow();
|
||||
expect(mockVideoElement.remove).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('handles empty video element list', () => {
|
||||
vi.stubGlobal('document', {
|
||||
strip.element = {
|
||||
querySelectorAll: vi.fn().mockReturnValue([]),
|
||||
});
|
||||
};
|
||||
|
||||
expect(() => strip._cleanupVideoStreams()).not.toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user