-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: [#1332] Continues on implementation
- Loading branch information
1 parent
0af09bd
commit 5f29bdd
Showing
12 changed files
with
550 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/happy-dom/src/nodes/html-canvas-element/ImageBitmap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/happy-dom/test/nodes/html-canvas-element/CanvasCaptureMediaStreamTrack.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import HTMLCanvasElement from '../../../src/nodes/html-canvas-element/HTMLCanvasElement.js'; | ||
import Window from '../../../src/window/Window.js'; | ||
import Document from '../../../src/nodes/document/Document.js'; | ||
import { beforeEach, describe, it, expect } from 'vitest'; | ||
import CanvasCaptureMediaStreamTrack from '../../../src/nodes/html-canvas-element/CanvasCaptureMediaStreamTrack.js'; | ||
|
||
describe('CanvasCaptureMediaStreamTrack', () => { | ||
let window: Window; | ||
let document: Document; | ||
let canvas: HTMLCanvasElement; | ||
|
||
beforeEach(() => { | ||
window = new Window(); | ||
document = window.document; | ||
canvas = document.createElement('canvas'); | ||
}); | ||
|
||
describe('get canvas()', () => { | ||
it('Returns the canvas.', () => { | ||
const track = new CanvasCaptureMediaStreamTrack({ kind: 'video', canvas }); | ||
expect(track.canvas).toBe(canvas); | ||
}); | ||
}); | ||
|
||
describe('requestFrame()', () => { | ||
it('Does nothing.', () => { | ||
const track = new CanvasCaptureMediaStreamTrack({ kind: 'video', canvas }); | ||
expect(() => track.requestFrame()).not.toThrow(); | ||
}); | ||
}); | ||
|
||
describe('clone()', () => { | ||
it('Clones the track.', () => { | ||
const track = new CanvasCaptureMediaStreamTrack({ kind: 'video', canvas }); | ||
const clone = track.clone(); | ||
|
||
// MediaStreamTrack | ||
expect(clone).not.toBe(track); | ||
expect(clone.id).not.toBe(track.id); | ||
expect(clone.label).toBe(track.label); | ||
expect(clone.kind).toBe(track.kind); | ||
expect(clone.muted).toBe(track.muted); | ||
expect(clone.readyState).toBe(track.readyState); | ||
expect(clone.getCapabilities()).toEqual(track.getCapabilities()); | ||
expect(clone.getSettings()).toEqual(track.getSettings()); | ||
|
||
// CanvasCaptureMediaStreamTrack | ||
expect(clone.canvas).toBe(track.canvas); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.