Separate files for Document and Input classes
This commit is contained in:
parent
1f1f1f0c1d
commit
9eb3451451
|
@ -60,6 +60,7 @@
|
|||
<li><a href="./tests/flowchart.test.html">Flowchart</a></li>
|
||||
<li><a href="./tests/mocha.test.html">Mocha</a></li>
|
||||
<li><a href="./tests/input.test.html">Input</a></li>
|
||||
<li><a href="./tests/document.test.html">Document</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<h4><a href="./tests/all.test.html">All</a></h4>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
<script type="module" src="./scripts/forum/forum10.test.js"></script>
|
||||
<script type="module" src="./scripts/forum/forum11.test.js"></script>
|
||||
<script type="module" src="./scripts/input.test.js"></script>
|
||||
<script type="module" src="./scripts/document.test.js"></script>
|
||||
<script defer class="mocha-init">
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<head>
|
||||
<title>Document</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
|
||||
<link type="text/css" rel="stylesheet" href="../index.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2><a href="../">DGF Tests</a></h2>
|
||||
<div id="mocha"></div>
|
||||
<div id="scene"></div>
|
||||
</body>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/radash/10.7.0/radash.js"
|
||||
integrity="sha512-S207zKWG3iqXqe6msO7/Mr8X3DzzF4u8meFlokHjGtBPTGUhgzVo0lpcqEy0GoiMUdcoct+H+SqzoLsxXbynzg=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script src="https://unpkg.com/mocha/mocha.js"></script>
|
||||
<script src="https://unpkg.com/chai/chai.js"></script>
|
||||
<script type="module" src="./scripts/document.test.js"></script>
|
||||
<script defer class="mocha-init">
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
});
|
||||
window.should = chai.should();
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
import { Box } from '../../classes/display/box.js';
|
||||
// import { Document } from '../../classes/display/document.js';
|
||||
import { Scene } from '../../classes/display/scene.js';
|
||||
import { mochaRun } from '../../util/helpers.js';
|
||||
|
||||
const rootElement = document.getElementById('scene');
|
||||
const rootBox = new Box('rootBox', rootElement).flex();
|
||||
const scene = window.scene = new Scene('Document test', rootBox);
|
||||
|
||||
scene.withDocument();
|
||||
|
||||
describe('Document', () => {
|
||||
describe('remark', () => {
|
||||
it('can exist', () => {
|
||||
const docFunction = (doc) => doc.remark('Hello');
|
||||
scene.withDocument('Document', docFunction);
|
||||
});
|
||||
it.skip('can include handlebars expressions', () => { });
|
||||
it.skip('updates rendered output when input changes', () => { });
|
||||
});
|
||||
});
|
||||
|
||||
mochaRun();
|
|
@ -20,6 +20,10 @@ describe('Document', () => {
|
|||
const doc = scene.lastDocument;
|
||||
const form1 = doc.lastElement;
|
||||
const dvMap = new Map();
|
||||
/**
|
||||
* Handler callback for form element value updates.
|
||||
* In this case we use a collection of DisplayValues as a straightforward way to render the form element values.
|
||||
*/
|
||||
const updateFieldValueDisplay = ({ name, value }) => {
|
||||
const dv = dvMap.get(name) ?? scene.addDisplayValue(name);
|
||||
dvMap.set(name, dv);
|
||||
|
|
Loading…
Reference in New Issue