Commit 77e039c8 authored by Björn Bartels's avatar Björn Bartels

PATLAB-7 update helper, config and templating tests

parent d7ce4d84
<html>
<body>
<div class="code-example"><pre><code class="html"><span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"galaxy"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"planet"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"earth"</span>&gt;</span>
some markup...
<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"sun"</span>&gt;</span>
more markup...
<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
</code></pre></div> </body>
</html>
{{#code}}
<section class="galaxy">
<div class="planet">
<h1 id="earth">
some markup...
</h1>
</div>
<span id="sun">
more markup...
</span>
</section>
{{/code}}
......@@ -227,5 +227,18 @@ describe('Patternlibrary instanciation and configuration:', function() {
});
describe('Patternlibrary.reset()', function() {
it('should clear all pattern-, category- and user data', function () {
var p = new Patternlibrary.Patternlibrary();
p.data.someKey = 'some value';
p.reset();
expect(p.data).not.to.have.a.key('someKey');
expect(p.data.patterns).to.be.a('object');
expect(p.data.categories).to.be.a('object');
expect(Object.keys(p.data.patterns).length).to.equal(0);
expect(Object.keys(p.data.categories).length).to.equal(0);
});
});
});
......@@ -10,6 +10,23 @@ const CLEAN_UP = !true;
describe('Patternlibrary basic templating:', function() {
describe('Patternlibrary.layout', function() {
it('retrieves the default GUI layout if none is set (yet)', function(){
var p = new Patternlibrary.Patternlibrary();
var layout = p.layout;
expect(p.layout).to.be.a('function');
expect(layout).to.be.a('function');
p.handlebars.registerPartial('docs-htmlhead', '<head>');
p.handlebars.registerPartial('body', '<body>');
p.handlebars.registerPartial('docs-htmlclose', '<close>');
var rendered = layout({});
expect(rendered).to.contain('<head>');
expect(rendered).to.contain('<body>');
expect(rendered).to.contain('<close>');
});
it('assings a handlebars default layout "{{> body}}" from an empty template name string', function() {
var p = new Patternlibrary.Patternlibrary();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment