zpt
Version:
Zenon Page Templates - JS (ZPT-JS)
26 lines (22 loc) • 1.08 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Custom expressions tests</title>
<link rel="stylesheet" href="/node_modules/qunit/qunit/qunit.css">
<script src="http://127.0.0.1:9966/customExpressions.js" defer></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<p>
This test shows how custom expressions can be added to ZPT-JS. We have written a custom expression class, <code>AverageExpression</code>, available using <em>avg:</em>. It returns the arithmetic average of the values in the expression.
</p>
<ol>
<li>aNumber = 5</li>
<li>from1To3 = [1 2 3]</li>
<li>avg: aNumber 1 = (5 + 1) / 2 = 3 = <span id="t1-1" data-content="avg: aNumber 1">(5 + 1) / 2 = 3</span></li>
<li>avg: aNumber 9 from1To3 = (5 + 9 + 1 + 2 + 3) / 5 = 4 = <span id="t1-2" data-content="avg: aNumber 9 from1To3">(5 + 4 + 1 + 2 + 3) / 4 = 4</span></li>
</ol>
</body>
</html>