Skip to content

Commit

Permalink
Add some unit test style tests
Browse files Browse the repository at this point in the history
  • Loading branch information
takkaria committed Dec 8, 2015
1 parent c5013a0 commit 0bedd29
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 4 deletions.
2 changes: 2 additions & 0 deletions test/templates/inline_style_link.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
body { color: black; }
p { text-decoration: underline; }
5 changes: 5 additions & 0 deletions test/templates/inline_style_link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<link rel="stylesheet" href="inline_style_link.css">

<body>
<p>Testing</p>
</body>
6 changes: 6 additions & 0 deletions test/templates/inline_style_link.out.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html><head>

</head><body style="color: black;">
<p style="text-decoration: underline;">Testing</p>

</body></html>
8 changes: 8 additions & 0 deletions test/templates/inline_style_tag.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<style>
body { color: black; }
p { text-decoration: underline; }
</style>

<body>
<p>Testing</p>
</body>
6 changes: 6 additions & 0 deletions test/templates/inline_style_tag.out.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html><head>

</head><body style="color: black;">
<p style="text-decoration: underline;">Testing</p>

</body></html>
1 change: 1 addition & 0 deletions test/templates/rewrite_links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="original">Testing</a>
2 changes: 2 additions & 0 deletions test/templates/rewrite_links.out.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<html><head></head><body><a href="original-append">Testing</a>
</body></html>
1 change: 1 addition & 0 deletions test/templates/text_file_alternative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the HTML file
1 change: 1 addition & 0 deletions test/templates/text_file_alternative.out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the text file
1 change: 1 addition & 0 deletions test/templates/text_file_alternative.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the text file
10 changes: 6 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ var fs = require('fs');
var testMap = {
'simple_vars': 'should do simple variable substitution',
'rewrite_links': 'should rewrite links',

'inline_style_tag': 'should inline the contents of style tags',
'inline_style_link': 'should inline CSS from local CSS using <link>',
'text_file_alternative': 'should load the text file alternative instead of textifying the HTML',

'two_vars_content': 'two_vars_content',
'for_loop': 'for_loop',
Expand Down Expand Up @@ -101,10 +103,10 @@ describe("swig-email-templates", function() {
pend.wait(function(err) {
if (err) return cb(err);

assert.strictEqual(actualHtml.trim(), expectedHtml.trim());
if (expectedText) {
if (expectedHtml)
assert.strictEqual(actualHtml.trim(), expectedHtml.trim());
if (expectedText)
assert.strictEqual(actualText.trim(), expectedText.trim());
}
cb();
});
};
Expand Down

0 comments on commit 0bedd29

Please sign in to comment.