Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
patternlibrary
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
js
patternlibrary
Commits
be096919
Commit
be096919
authored
Mar 20, 2018
by
Björn Bartels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PATLAB-7
update config tests
parent
77e039c8
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
29 deletions
+15
-29
config.js
lib/patternlibrary/config.js
+0
-27
test.01.init-config.js
test/test.01.init-config.js
+15
-2
No files found.
lib/patternlibrary/config.js
View file @
be096919
...
...
@@ -179,32 +179,5 @@ module.exports = function(opts) {
checkStaticPages
(
this
);
// initialises doc page as body-partial and compiled template
/*if (this.options.gui.layout) {
if (this.options.gui.docpage) {
try {
var pagefile = path.join(this.options.root, this.options.basepath, this.options.pattern.docpage);
var pageSource = fs.readFileSync(pagefile);
var page = fm(pageSource.toString());
if (page.attributes.layout != '') {
this.layout = page.attributes.layout;
}
} catch (e) {
throw new Error('Error loading Patternlibrary doc page template file: ' + e.message);
}
// Now create Handlebars templates out of them
this.template = this.handlebars.compile(page.body, {noEscape: true});
// Finally, add the page as a partial called "body", and render the layout template
this.handlebars.registerPartial('body', this.template);
} else {
throw new Error('No path to a doc page template was set in Patternlibrary.config().');
}
} else {
throw new Error('No path to a layout was set in Patternlibrary.config().');
}*/
return
this
;
}
test/test.01.init-config.js
View file @
be096919
...
...
@@ -3,10 +3,11 @@ import Patternlibrary from '..';
var
extend
=
require
(
'deep-extend'
);
var
expect
=
require
(
'chai'
).
expect
;
var
defaults
=
require
(
'../lib/config/defaults'
);
describe
(
'Patternlibrary instanciation and configuration:'
,
function
()
{
describe
(
'Patternlibrary.config()'
,
function
()
{
var
defaults
=
require
(
'../lib/config/defaults'
);
it
(
'merges default and user configuration objects'
,
function
()
{
var
p
=
new
Patternlibrary
.
Patternlibrary
();
...
...
@@ -86,7 +87,9 @@ describe('Patternlibrary instanciation and configuration:', function() {
cfg
.
categoriespath
=
''
;
expect
(
function
()
{
p
.
config
(
cfg
);
}).
to
.
throw
(
Error
);
});
});
describe
(
'Patternlibrary.config() - patterns
\'
options checks'
,
function
()
{
it
(
'throws error if the pattern
\'
s "pattern" option is missing or empty'
,
function
()
{
var
p
=
new
Patternlibrary
.
Patternlibrary
();
var
cfg
=
extend
({},
defaults
);
...
...
@@ -202,9 +205,19 @@ describe('Patternlibrary instanciation and configuration:', function() {
expect
(
function
()
{
p
.
config
(
cfg
);
}).
to
.
throw
(
Error
);
});
});
describe
(
'Patternlibrary.config() - adapter patterns
\'
options checks'
,
function
()
{
});
describe
(
'Patternlibrary.config() - GUI paths
\'
options checks'
,
function
()
{
});
describe
(
'Patternlibrary.config() - static pages paths
\'
options checks'
,
function
()
{
});
describe
(
'Patternlibrary.init()'
,
function
()
{
it
(
'should contain no
\'
handlebars
\'
instance before first execution'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment