Skip to content

Commit

Permalink
feat: add tests for embed button option
Browse files Browse the repository at this point in the history
  • Loading branch information
mimidotuser committed Sep 14, 2021
1 parent bbe0b9f commit 09e8070
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
18 changes: 18 additions & 0 deletions cypress/integration/advance-options.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,22 @@ describe('single', () => {
expect(iframe.contents().find('.h5p-download-button')).to.exist;
});
});

it('should display embed code dialog', () => {

cy.visit('test/advance-options.html');
cy.get('.h5p-iframe').should((iframe) => {

expect(iframe.contents().find('.h5p-actions').find('.h5p-embed')).to.exist;

iframe.contents()
.find('.h5p-actions')
.find('.h5p-embed')
.click();

expect(iframe.contents().find('.h5p-embed-code-container')).to.exist;
expect(iframe.contents().find('.h5p-embed-size')).to.exist;
})

});
});
11 changes: 5 additions & 6 deletions test/advance-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
<div id="h5p-container"></div>

<script type="text/javascript">
const {
H5P
} = H5PStandalone;
new H5P(document.getElementById('h5p-container'), {

new H5PStandalone.H5P(document.getElementById('h5p-container'), {
h5pJsonPath: 'full_workspace',
frameJs: '/dist/frame.bundle.js',
frameCss: '/dist/styles/h5p.css',
frame: true,
copyright: true,
embed: false,
export: true,
downloadUrl: 'test.h5p'
downloadUrl: 'test.h5p',
embed: true,
embedCode: '<iframe width=":w" height=":h" src="https://yourembecode.om" frameBorder="0" scrolling="no"></iframe>',
});
</script>
</body>
Expand Down

0 comments on commit 09e8070

Please sign in to comment.