Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HTMLMediaElement #475

Closed
rudywaltz opened this issue May 13, 2022 · 1 comment · Fixed by #535
Closed

Add support for HTMLMediaElement #475

rudywaltz opened this issue May 13, 2022 · 1 comment · Fixed by #535
Labels
enhancement New feature or request

Comments

@rudywaltz
Copy link
Contributor

Dear @capricorn86 ,
I just start to be familiar with happy DOM, and I would like to use it for testing (jest) my hobby project which is a native web components base audio-player. My first experience was good, but now I'm struggling to test the audio element because it is not implemented here. I try to create my own mock, but I'm not sure how can I overwrite happy-dom on this level, or maybe contribute here somehow.
Can you help me with this, with the implementation/how can I extend it locally or point to some good reference in your codebase how can I implement it directly here?

thank you for your help

@rudywaltz rudywaltz changed the title Add support HTMLMediaElement Add support for HTMLMediaElement May 13, 2022
@capricorn86 capricorn86 added the enhancement New feature or request label May 16, 2022
@capricorn86
Copy link
Owner

capricorn86 commented May 16, 2022

Hi @rudywaltz! 🙂

Any contribution is very welcome!

First off, please read the guidelines for contributions:
https://github.com/capricorn86/happy-dom/blob/master/docs/contributing.md

In order to add a new Node/Element, you need to do the following:

  1. Go to ./packages/happy-dom. This is where the code for Happy DOM lives.
  2. Copy an existing element implementation. E.g. copy src/nodes/html-meta-element to src/nodes/html-media-element.
  3. Rename files, classes and interfaces to follow the new element name (HTMLMediaElement and IHTMLMediaElement)
  4. Update the IHTMLMediaElement interface according to the specs at https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement (it is possible to do a partial implementation if there is too much to implement in the first release).
  5. Implement the functionality according to the specs in HTMLMediaElement.
  6. Add the HTMLMediaElement class as a property to IWindow.ts and Window.ts.
  7. Remove the element class from NonImplemenetedElementClasses.ts.
  8. Create tests for the implementation under test/nodes/html-media-element
  9. Export HTMLMediaElement and IHTMLMediaElement in index.ts.

You can run the tests to verify that your implementation works by running npm test.

rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue May 31, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 10, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 10, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 11, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 26, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 26, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 26, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jun 26, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 9, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 9, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 9, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 9, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 9, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 22, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 23, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Jul 25, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 6, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 6, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 6, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 7, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 7, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 7, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 7, 2022
rudywaltz added a commit to rudywaltz/happy-dom that referenced this issue Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants