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
8587dee6
Commit
8587dee6
authored
May 13, 2018
by
Björn Bartels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PATLAB-7
added more tests
parent
cc9df755
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
246 additions
and
16 deletions
+246
-16
default.html
gui/src/layouts/default.html
+19
-0
pl-analytics.html
gui/src/partials/pl-analytics.html
+1
-1
gitinfo.js
lib/adapters/gitinfo.js
+11
-10
tests.js
lib/adapters/tests.js
+1
-1
test.js
test/fixtures/adapters/example/partials/atoms/link/test.js
+0
-0
test.20.adapter.js
test/test.20.adapter.js
+120
-4
test.30.handlebars.js
test/test.30.handlebars.js
+0
-0
test.40.markdownit.js
test/test.40.markdownit.js
+47
-0
test.50.utilities.js
test/test.50.utilities.js
+47
-0
test.99.staticpages.js
test/test.99.staticpages.js
+0
-0
No files found.
gui/src/layouts/default.html
View file @
8587dee6
...
...
@@ -23,5 +23,24 @@
</div>
</section>
<!-- Matomo -->
<script
type=
"text/javascript"
>
var
_paq
=
_paq
||
[];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq
.
push
([
"setCookieDomain"
,
"*.demo.patternlibrary.bjoernbartels.earth"
]);
_paq
.
push
([
"setDomains"
,
[
"*.demo.patternlibrary.bjoernbartels.earth"
,
"*.demo.patternlibrary.net"
,
"*.demo.patternlibrary.org"
]]);
_paq
.
push
([
"enableCrossDomainLinking"
]);
_paq
.
push
([
'trackPageView'
]);
_paq
.
push
([
'enableLinkTracking'
]);
(
function
()
{
var
u
=
"//analytics.bjoernbartels.earth/piwik/"
;
_paq
.
push
([
'setTrackerUrl'
,
u
+
'piwik.php'
]);
_paq
.
push
([
'setSiteId'
,
'7'
]);
var
d
=
document
,
g
=
d
.
createElement
(
'script'
),
s
=
d
.
getElementsByTagName
(
'script'
)[
0
];
g
.
type
=
'text/javascript'
;
g
.
async
=
true
;
g
.
defer
=
true
;
g
.
src
=
u
+
'piwik.js'
;
s
.
parentNode
.
insertBefore
(
g
,
s
);
})();
</script>
<noscript><p><img
src=
"//analytics.bjoernbartels.earth/piwik/piwik.php?idsite=7&rec=1"
style=
"border:0;"
alt=
""
/></p></noscript>
<!-- End Matomo Code -->
</body>
</html>
\ No newline at end of file
gui/src/partials/pl-analytics.html
View file @
8587dee6
...
...
@@ -16,4 +16,4 @@
})();
</script>
<noscript><p><img
src=
"//analytics.bjoernbartels.earth/piwik/piwik.php?idsite=7&rec=1"
style=
"border:0;"
alt=
""
/></p></noscript>
<!-- End Matomo Code -->
\ No newline at end of file
<!-- End Matomo Code -->
lib/adapters/gitinfo.js
View file @
8587dee6
...
...
@@ -35,7 +35,7 @@ module.exports.search = function(items, link) {
function
getGitInfo
(
value
,
config
,
pl
)
{
if
(
!
fs
.
existsSync
(
value
))
return
false
;
var
logFormatYaml
=
'- date:
\'
%cd
\'
'
+
'%n'
+
' timestamp: %ct'
+
'%n'
+
...
...
@@ -88,16 +88,17 @@ function getGitInfo(value, config, pl) {
function
processTree
(
tree
,
config
)
{
var
logs
=
{};
for
(
var
i
in
tree
.
log
.
data
)
{
var
obj
=
tree
.
log
.
data
[
i
];
var
logdate
=
obj
.
date
;
if
(
!
logs
[
logdate
])
{
logs
[
logdate
]
=
[];
}
logs
[
logdate
].
push
(
obj
);
if
(
tree
&&
tree
.
log
)
{
for
(
var
i
in
tree
.
log
.
data
)
{
var
obj
=
tree
.
log
.
data
[
i
];
var
logdate
=
obj
.
date
;
if
(
!
logs
[
logdate
])
{
logs
[
logdate
]
=
[];
}
logs
[
logdate
].
push
(
obj
);
}
tree
.
log
.
data
=
logs
;
}
tree
.
log
.
data
=
logs
;
return
tree
;
}
...
...
lib/adapters/tests.js
View file @
8587dee6
...
...
@@ -28,7 +28,7 @@ module.exports.search = function(items, link) {
function
getPatternSpecs
(
value
,
config
,
pl
)
{
if
(
!
fs
.
existsSync
(
value
))
return
false
;
var
sourceFile
=
frontMatter
(
fs
.
readFileSync
(
value
).
toString
());
//
var sourceFile = frontMatter(fs.readFileSync(value).toString());
return
{};
}
...
...
test/fixtures/adapters/example/partials/atoms/link/test.js
0 → 100644
View file @
8587dee6
test/test.20.adapter.js
View file @
8587dee6
...
...
@@ -134,7 +134,7 @@ describe('Patternlibrary instanciation and configuration:', function() {
describe
(
'Patternlibrary "example" adapter:'
,
()
=>
{
let
adapter
=
require
(
'../lib/adapters/example.js'
);
let
patternlibraryOptions
=
{
/*
let patternlibraryOptions = {
verbose : false,
dest : FIXTURES + 'example/build',
root : FIXTURES + 'example/pages/',
...
...
@@ -142,7 +142,8 @@ describe('Patternlibrary instanciation and configuration:', function() {
partials: FIXTURES + 'example/partials/',
testing : true
};
var
p
=
new
Patternlibrary
.
Patternlibrary
(
patternlibraryOptions
);
var p = new Patternlibrary.Patternlibrary(patternlibraryOptions);*/
var
p
=
new
Patternlibrary
.
Patternlibrary
();
it
(
'retrieves example
\'
s source-code from file'
,
function
(
done
)
{
...
...
@@ -241,7 +242,6 @@ describe('Patternlibrary instanciation and configuration:', function() {
'test/fixtures/adapters/example/partials/atoms/link/module.js'
,
{},
(
a
,
b
)
=>
{
console
.
log
(
b
);
expect
(
b
).
to
.
be
.
an
(
'object'
)
.
that
.
is
.
not
.
empty
;
...
...
@@ -272,7 +272,6 @@ describe('Patternlibrary instanciation and configuration:', function() {
'test/fixtures/adapters/example/partials/atoms/link/module_no_defaults.js'
,
{},
(
a
,
b
)
=>
{
console
.
log
(
b
);
expect
(
b
).
to
.
be
.
an
(
'object'
)
.
that
.
is
.
not
.
empty
;
...
...
@@ -283,6 +282,123 @@ describe('Patternlibrary instanciation and configuration:', function() {
);
});
});
describe
(
'Patternlibrary "changelog" adapter:'
,
()
=>
{
let
adapter
=
require
(
'../lib/adapters/changelog.js'
);
var
p
=
new
Patternlibrary
.
Patternlibrary
();
it
(
'retrieves example
\'
s source-code from file'
,
function
(
done
)
{
adapter
(
'test/fixtures/adapters/example/partials/atoms/link/changelog.md'
,
{},
(
a
,
b
)
=>
{
expect
(
b
).
to
.
be
.
a
(
'string'
);
done
();
},
p
);
});
it
(
'returns flase if file is not readable/does not exist'
,
function
(
done
)
{
adapter
(
'test/fixtures/adapters/example/partials/atoms/link/changelog_not_found.md'
,
{},
(
a
,
b
)
=>
{
expect
(
b
).
to
.
equal
(
false
);
done
();
},
p
);
});
it
(
'search method returns empty result'
,
function
()
{
let
result
=
adapter
.
search
();
expect
(
result
).
to
.
be
.
empty
;
});
});
describe
(
'Patternlibrary "tests" adapter:'
,
()
=>
{
let
adapter
=
require
(
'../lib/adapters/tests.js'
);
it
(
'retrieves test-results from test-file'
,
function
(
done
)
{
adapter
(
'test/fixtures/adapters/example/partials/atoms/link/test.js'
,
{},
(
a
,
b
)
=>
{
expect
(
b
).
to
.
be
.
a
(
'object'
);
done
();
}
);
});
it
(
'returns flase if file is not readable/does not exist'
,
function
(
done
)
{
adapter
(
'test/fixtures/adapters/example/partials/atoms/link/test_not_found.js'
,
{},
(
a
,
b
)
=>
{
expect
(
b
).
to
.
equal
(
false
);
done
();
}
);
});
it
(
'search method returns empty result'
,
function
()
{
let
result
=
adapter
.
search
();
expect
(
result
).
to
.
be
.
empty
;
});
});
describe
(
'Patternlibrary "gitinfo" adapter:'
,
()
=>
{
let
adapter
=
require
(
'../lib/adapters/gitinfo.js'
);
var
p
=
new
Patternlibrary
.
Patternlibrary
();
it
(
'retrieves git-info from file'
,
function
(
done
)
{
adapter
(
'test/fixtures/adapters/example/partials/atoms/link/atom-link.html'
,
{},
(
a
,
b
)
=>
{
expect
(
b
).
to
.
be
.
a
(
'object'
);
done
();
},
p
);
});
it
(
'returns flase if file is not readable/does not exist'
,
function
(
done
)
{
adapter
(
'test/fixtures/adapters/example/partials/atoms/link/file_not_found.html'
,
{},
(
a
,
b
)
=>
{
expect
(
b
).
to
.
equal
(
false
);
done
();
},
p
);
});
it
(
'search method returns empty result'
,
function
()
{
let
result
=
adapter
.
search
();
expect
(
result
).
to
.
be
.
empty
;
});
});
...
...
test/test.
9
0.handlebars.js
→
test/test.
3
0.handlebars.js
View file @
8587dee6
File moved
test/test.40.markdownit.js
0 → 100644
View file @
8587dee6
import
Patternlibrary
from
'..'
;
import
equal
from
'assert-dir-equal'
;
import
rimraf
from
'rimraf'
;
import
mkdirp
from
'mkdirp'
;
var
expect
=
require
(
'chai'
).
expect
;
var
$md
=
require
(
'../lib/vendor/markdown-it.js'
);
var
stripHtml
=
require
(
'striptags'
);
describe
(
'Markdown-It plugin helpers'
,
function
()
{
it
(
'renders highlighted code block with given language'
,
function
()
{
let
codeblock
=
[
"```html_example"
,
"
\n
"
,
'<div class="galaxy"><div>'
,
"```"
].
join
(
"
\n
"
);
let
result
=
$md
.
render
(
codeblock
);
console
.
log
(
result
);
expect
(
result
).
to
.
be
.
a
(
'string'
);
});
it
(
'renders highlighted code block with no language'
,
function
()
{
let
codeblock
=
[
"```"
,
"
\n
"
,
'<div class="galaxy"><div>'
,
"```"
].
join
(
"
\n
"
);
let
result
=
$md
.
render
(
codeblock
);
console
.
log
(
result
);
expect
(
result
).
to
.
be
.
a
(
'string'
);
});
it
(
'renders highlighted code block with faulty indicator'
,
function
()
{
let
codeblock
=
[
"```_example"
,
"
\n
"
,
'<div class="galaxy"><div>'
,
"```"
].
join
(
"
\n
"
);
let
result
=
$md
.
render
(
codeblock
);
console
.
log
(
result
);
expect
(
result
).
to
.
be
.
a
(
'string'
);
});
});
\ No newline at end of file
test/test.50.utilities.js
0 → 100644
View file @
8587dee6
import
Patternlibrary
from
'..'
;
import
equal
from
'assert-dir-equal'
;
import
rimraf
from
'rimraf'
;
import
mkdirp
from
'mkdirp'
;
var
expect
=
require
(
'chai'
).
expect
;
var
$md
=
require
(
'../lib/vendor/markdown-it.js'
);
var
stripHtml
=
require
(
'striptags'
);
describe
(
'Markdown-It plugin helpers'
,
function
()
{
it
(
'renders highlighted code block with given language'
,
function
()
{
let
codeblock
=
[
"```html_example"
,
"
\n
"
,
'<div class="galaxy"><div>'
,
"```"
].
join
(
"
\n
"
);
let
result
=
$md
.
render
(
codeblock
);
console
.
log
(
result
);
expect
(
result
).
to
.
be
.
a
(
'string'
);
});
it
(
'renders highlighted code block with no language'
,
function
()
{
let
codeblock
=
[
"```"
,
"
\n
"
,
'<div class="galaxy"><div>'
,
"```"
].
join
(
"
\n
"
);
let
result
=
$md
.
render
(
codeblock
);
console
.
log
(
result
);
expect
(
result
).
to
.
be
.
a
(
'string'
);
});
it
(
'renders highlighted code block with faulty indicator'
,
function
()
{
let
codeblock
=
[
"```_example"
,
"
\n
"
,
'<div class="galaxy"><div>'
,
"```"
].
join
(
"
\n
"
);
let
result
=
$md
.
render
(
codeblock
);
console
.
log
(
result
);
expect
(
result
).
to
.
be
.
a
(
'string'
);
});
});
\ No newline at end of file
test/test.9
0
.staticpages.js
→
test/test.9
9
.staticpages.js
View file @
8587dee6
File moved
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