-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix after testing with akashacms-example
- Loading branch information
Showing
7 changed files
with
252 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div <% | ||
if (typeof additionalClasses !== 'undefined') { | ||
%>class="author-bio-block <%= additionalClasses %>" <% | ||
} else { | ||
%>class="author-bio-block" <% | ||
} | ||
if (typeof id !== 'undefined' && id) { | ||
%>id="<%= id %>" <% | ||
} | ||
if (typeof style !== 'undefined' && style) { | ||
%>style="<%= style %>" <% | ||
} | ||
%>> | ||
<% | ||
for (let author of authors) { | ||
if (typeof author.bio === 'string') { | ||
%> | ||
<div class="author-bio-block-name"> | ||
<%= author.fullname %> | ||
</div> | ||
<div class="author-bio-block-bio"> | ||
<%- author.bio %> | ||
</div> | ||
<% | ||
} | ||
} | ||
%> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
const akasha = require('akasharender'); | ||
const plugin = require('../index'); | ||
const { assert } = require('chai'); | ||
const cheerio = require('cheerio'); | ||
|
||
const authorconfig = { | ||
default: "boygeorge", | ||
authors: [ | ||
{ | ||
code: "boygeorge", | ||
fullname: "Boy George", | ||
url: "URL" | ||
}, | ||
{ | ||
code: "eltonjohn", | ||
fullname: "Elton John", | ||
url: "URL" | ||
} | ||
] | ||
}; | ||
|
||
const config = new akasha.Configuration(); | ||
config.rootURL("https://example.akashacms.com"); | ||
config.configDir = __dirname; | ||
config.use(require('../index'), authorconfig); | ||
config.setMahabhutaConfig({ | ||
recognizeSelfClosing: true, | ||
recognizeCDATA: true, | ||
decodeEntities: true | ||
}); | ||
config.prepare(); | ||
|
||
describe('default author', function() { | ||
it('should find the default author', async function() { | ||
let html = await plugin.process(` | ||
<authors-byline></authors-byline> | ||
`, {}, authorconfig); | ||
|
||
assert.exists(html, 'result exists'); | ||
assert.isString(html, 'result isString'); | ||
assert.include(html, "Boy George"); | ||
assert.notInclude(html, "Elton John"); | ||
}); | ||
}); | ||
|
||
describe('chosen author', function() { | ||
it('should find the chosen author', async function() { | ||
let html = await plugin.process(` | ||
<authors-byline></authors-byline> | ||
`, { | ||
authors: "eltonjohn" | ||
}, authorconfig); | ||
|
||
assert.exists(html, 'result exists'); | ||
assert.isString(html, 'result isString'); | ||
assert.notInclude(html, "Boy George"); | ||
assert.include(html, "Elton John"); | ||
}); | ||
|
||
}); |
Oops, something went wrong.