zpt
Version:
Zenon Page Templates - JS (ZPT-JS)
80 lines (78 loc) • 4.51 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Building and testing</title>
<script type="text/javascript" src="../lib/zpt.min.js" defer></script>
<script type="text/javascript" src="../js/zpt.js" defer></script>
<script type="text/javascript" src="../lib/syntaxHighlighter/lib.js"></script>
<link rel="stylesheet" type="text/css" href="../docs.css">
<link rel="stylesheet" type="text/css" href="../lib/syntaxHighlighter/theme.css">
</head>
<body>
<div data-use-macro="'page@templates.html'">
<div data-fill-slot="'page-header'">
<h1>ZPT-JS tutorial - Building and testing</h1>
<ul>
<li><a href="#starting">Starting ZPT-JS</a>.</li>
<li><a href="#web">The web of ZPT-JS</a>.</li>
<li><a href="#testing">Testing</a>.</li>
</ul>
</div>
<article data-fill-slot="'article'">
<h2 data-attributes="id 'starting'">Starting ZPT-JS</h2>
<p>
Asumming you have <a href="../download.html">downloaded ZPT-JS</a> before, move to the directory of ZPT-JS and use the next command to install the dependencies of ZPT-JS:
</p>
<pre class="console">
$ npm run install
</pre>
<p>
Then use the next command to initialize a <a href="http://didact.us/beefy/">beefy server</a> (port 9966) to make it easy to test ZPT-JS without browserifying by hand and a <a href="https://www.npmjs.com/package/http-server">HTTP server</a> (port 9000) to serve static files (HTML, CSS and JSON files):
</p>
<pre class="console">
$ npm run start
</pre>
<p>
ZPT-JS uses <a href="http://gruntjs.com/">Grunt</a> as task runner tool. Grunt file uses:
</p>
<ul>
<li><em>grunt-browserify</em>. Build javascript files to be understood for browsers.</li>
<li><em>grunt-contrib-watch</em>. Watch changes of javascript files to invoke <em>browserify</em> automatically.</li>
</ul>
<h2 data-attributes="id 'web'">The web of ZPT-JS</h2>
<p>
Use the next command to initialize a <a href="https://www.npmjs.com/package/http-server">HTTP server</a> (port 9001) to serve static files of the web of ZPT-JS:
</p>
<pre class="console">
$ npm run web
</pre>
<p>
Open <a href="http://localhost:9001">http://localhost:9001</a> with your favourite browser to view the web of ZPT-JS.
</p>
<h2 data-attributes="id 'testing'">Testing</h2>
<p>
ZPT-JS uses <a href="https://qunitjs.com/">QUnit</a> as testing framework. There are some different ways for testing ZPT-JS:
</p>
<ul>
<li>
Open <a href="http://localhost:9000/test/">http://localhost:9000/test/</a> with your favourite browser. Be careful: only related to browser test are run! All tests passed using last versions of Mozilla Firefox (68.0.1, 64-bit) and Chromium (74.0.3729.169, 64-bit). Perhaps some tests fail using other browsers!
</li>
<li>
Test ZPT-JS using console:
<pre class="console">
$ npm run testBrowser // Run the related to browser tests
$ npm run testNode // Run the related to node.js tests
$ npm run test // Run all tests
</pre>
Some tests (<code>errors.html</code>, <code>folderDictionaries.html</code> and <code>folderDictionaries2.html</code>) show this error message several times:
<pre class="console">
Failed to load resource: the server responded with a status of 404 (Not Found)
</pre>
This is due to forced loading errors (<code>errors.html</code>) or errors trying to load <em>folder dictionaries</em> (<code>folderDictionaries.html</code> and <code>folderDictionaries2.html</code>). This is the expected behaviour.
</li>
</ul>
</article>
</div>
</body>
</html>