From ade35ac659f20fc27bb4c87d8511789cc7d05c07 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 7 Jul 2016 22:32:35 +0100 Subject: Handle comments without initials --- test/document-to-html.tests.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index af08050..cc8aff5 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -2,7 +2,9 @@ var assert = require("assert"); var promises = require("../lib/promises"); var documents = require("../lib/documents"); -var DocumentConverter = require("../lib/document-to-html").DocumentConverter; +var documentToHtml = require("../lib/document-to-html"); +var DocumentConverter = documentToHtml.DocumentConverter; +var commentAuthorLabel = documentToHtml.commentAuthorLabel; var test = require("./test")(module); var htmlPaths = require("../lib/html-paths"); var xml = require("../lib/xml"); @@ -612,3 +614,13 @@ function runOfText(text, properties) { var textElement = new documents.Text(text); return new documents.Run([textElement], properties); } + +test('when initials are not blank then comment author label is initials', function() { + assert.equal(commentAuthorLabel({authorInitials: "TP"}), "TP") +}); + +test('when initials are blank then comment author label is blank', function() { + assert.equal(commentAuthorLabel({authorInitials: ""}), "") + assert.equal(commentAuthorLabel({authorInitials: undefined}), "") + assert.equal(commentAuthorLabel({authorInitials: null}), "") +}); -- cgit v1.2.3