Commit 1acf99f7 authored by Björn Bartels's avatar Björn Bartels 👩🏻
Browse files

PATLAB-7 test for Patternlibrary.init()

parent 91d9d9d9
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -96,7 +96,8 @@ class Patternlibrary {
	/**
	 * Retrieves (handlebars) page template
	 * 
	 * if no layout is set yet, returns the default layout template
	 * if no page template is set yet, returns the default 
	 * gui doc-page template
	 * 
	 * @function layout
	 * @param {object} data - template data
@@ -112,10 +113,11 @@ class Patternlibrary {
    /**
     * Sets and compiles (handlebars) page by page filename
     * 
     * if no name is given an 'empty' layout ('{{> body}}') is set
     * if `page` is a '.md' or '.markdown' file, it is also 
     * passed through the markdown renderer
     * 
     * @param {string} layoutname - the file basename of the layoutfile
     * @var {function} layout - a precompiled (handlebars) template
     * @param {string} page - the file basename of the page-file
     * @var {function} pagetemplate - a precompiled (handlebars) template
     */
    set pagetemplate ( page ) {

+19 −0
Original line number Diff line number Diff line
@@ -250,6 +250,25 @@ describe('Patternlibrary instanciation and configuration:', function() {
	    
	});
	
	describe('Patternlibrary.init()', function() {
		it('should contain no \'handlebars\' instance before first execution', function () {
			expect(Patternlibrary.handlebars).to.be.undefined;
		});
		it('should contain no \'markdowm-it\' instance before first execution', function () {
			expect(Patternlibrary.markdown).to.be.undefined;
		});
		it('should contain a \'handlebars\' instance after instanciation', function () {
	        var p = new Patternlibrary.Patternlibrary();
			expect(p.handlebars).not.to.be.undefined;
			expect(p.handlebars).to.be.a('object');
		});
		it('should contain a \'markdowm-it\' instance after instanciation', function () {
	        var p = new Patternlibrary.Patternlibrary();
			expect(p.markdown).not.to.be.undefined;
			expect(p.markdown).to.be.a('object');
		});
	});
	
	describe('Patternlibrary.adapter()', function() {
	    it('loads built-in adapters', function() {
	        var p = new Patternlibrary.Patternlibrary();