summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__/templateBlock.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/__tests__/templateBlock.js')
-rw-r--r--lib/models/__tests__/templateBlock.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/models/__tests__/templateBlock.js b/lib/models/__tests__/templateBlock.js
index b8c426e..597b672 100644
--- a/lib/models/__tests__/templateBlock.js
+++ b/lib/models/__tests__/templateBlock.js
@@ -17,7 +17,6 @@ describe('TemplateBlock', function() {
expect(templateBlock.getParse()).toBeTruthy();
expect(templateBlock.getEndTag()).toBe('endsayhello');
expect(templateBlock.getBlocks().size).toBe(0);
- expect(templateBlock.getShortcuts().size).toBe(0);
expect(templateBlock.getExtensionName()).toBe('BlocksayhelloExtension');
// Check result of applying block
@@ -32,6 +31,37 @@ describe('TemplateBlock', function() {
});
});
+ describe('getShortcuts', function() {
+ it('must return undefined if no shortcuts', function() {
+ var templateBlock = TemplateBlock.create('sayhello', function(block) {
+ return '<p>Hello, World!</p>';
+ });
+
+ expect(templateBlock.getShortcuts()).not.toBeDefined();
+ });
+
+ it('must return complete shortcut', function() {
+ var templateBlock = TemplateBlock.create('sayhello', {
+ process: function(block) {
+ return '<p>Hello, World!</p>';
+ },
+ shortcuts: {
+ parsers: ['markdown'],
+ start: '$',
+ end: '-'
+ }
+ });
+
+ var shortcut = templateBlock.getShortcuts();
+
+ expect(shortcut).toBeDefined();
+ expect(shortcut.getStart()).toEqual('$');
+ expect(shortcut.getEnd()).toEqual('-');
+ expect(shortcut.getStartTag()).toEqual('sayhello');
+ expect(shortcut.getEndTag()).toEqual('endsayhello');
+ });
+ });
+
describe('toNunjucksExt()', function() {
pit('must create a valid nunjucks extension', function() {
var templateBlock = TemplateBlock.create('sayhello', function(block) {