specs for lists, single_lines

master
Matt Huntington 10 years ago
parent f401bbc9d3
commit 4ef8a41fb0

@ -2,8 +2,8 @@ var fs = require('fs');
var converter = require('../index.js');
describe("links", function () {
it("should multiply render links", function (done) {
fs.readFile('tests/links.txt', 'utf8',function(err, input){
it("should render links", function (done) {
fs.readFile('tests/input/links.txt', 'utf8',function(err, input){
fs.readFile('tests/output/links.html', 'utf8',function(err, output){
expect(converter(input)+'\n').toBe(output);
done();
@ -11,3 +11,23 @@ describe("links", function () {
});
});
});
describe("lists", function () {
it("should render lists", function (done) {
fs.readFile('tests/input/lists.txt', 'utf8',function(err, input){
fs.readFile('tests/output/lists.html', 'utf8',function(err, output){
expect(converter(input)+'\n').toBe(output);
done();
});
});
});
});
describe("single lines", function (done) {
it("should render paragraphs and headers", function (done) {
fs.readFile('tests/input/single_lines.txt', 'utf8',function(err, input){
fs.readFile('tests/output/single_lines.html', 'utf8',function(err, output){
expect(converter(input)+'\n').toBe(output);
done();
});
});
});
});

@ -1,5 +0,0 @@
var converter = require('../index.js');
var fs = require('fs');
fs.readFile('links.txt', 'utf8',function(err, data){
console.log(converter(data));
});

@ -1,5 +0,0 @@
var converter = require('../index.js');
var fs = require('fs');
fs.readFile('lists.txt', 'utf8',function(err, data){
console.log(converter(data));
});

@ -0,0 +1,37 @@
<ul>
<li>
lines that either directly preceed another line of text
<ul>
<li>
or directly succeed another line of text
</li>
<li>
are rendered as lists
<ul>
<li>
they can also contain links <a href="http://www.google.com">http://www.google.com</a>
<ul>
<li>
you can only forward indent
</li>
<li>
one tab
<ul>
<li>
at a
</li>
</ul>
</li>
<li>
time
</li>
</ul>
</li>
</ul>
</li>
<li>
but you can back indent as much as you'd like
</li>
</ul>
</li>
</ul>

@ -0,0 +1,4 @@
<h1>if the first line contains a line break after it, it is rendered as a header</h1>
<h2>sub headings are single lines that have a line break before and after them, but are not the first line</h2>
<p>This single line contains a period. Therefore, it is rendered as a paragraph. It also contains a link to <a href="http://www.google.com,">http://www.google.com,</a> so that is rendered appropriately.</p>
<h2>sub heading 2</h2>

@ -1,5 +0,0 @@
var converter = require('../index.js');
var fs = require('fs');
fs.readFile('single_lines.txt', 'utf8',function(err, data){
console.log(converter(data));
});
Loading…
Cancel
Save