-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from tunapanda/feat/full_experience_opts
feat: expose options to enable saving & restoration of user's state
- Loading branch information
Showing
5 changed files
with
137 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe('State management', () => { | ||
beforeEach(() => { | ||
cy.visit('test/state.html'); | ||
}); | ||
|
||
it('should restore previous state with local data', () => { | ||
cy.iframe("#h5p-container-1 iframe.h5p-iframe.h5p-initialized") | ||
.should("be.visible") | ||
.within(() => { | ||
cy.get(".h5p-true-false-answers .h5p-true-false-answer") | ||
.contains("False") | ||
.invoke('attr', 'aria-checked') | ||
.should('eq', 'true'); // no automated selection | ||
|
||
//following should pass | ||
cy.get(".h5p-question-check-answer").click(); | ||
cy.get(".h5p-joubelui-score-bar-star").should("be.visible"); | ||
}); | ||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<html lang="en"> | ||
<head> | ||
<link type="text/css" rel="stylesheet" media="all" href="/dist/styles/h5p.css"/> | ||
<meta charset="utf-8"/> | ||
<title></title> | ||
<script type="text/javascript" src="/dist/main.bundle.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="h5p-container-1"></div> | ||
|
||
<script type="text/javascript"> | ||
new H5PStandalone.H5P(document.getElementById('h5p-container-1'), { | ||
h5pJsonPath: 'full_workspace', | ||
frameJs: '/dist/frame.bundle.js', | ||
frameCss: '/dist/styles/h5p.css', | ||
saveFreq: 3000, | ||
contentUserData: [{ | ||
state: '{"answer":false}' | ||
}] | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |