Skip to content

Commit

Permalink
Adds passing tests for sintaxi#228
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethormandy committed Feb 5, 2014
1 parent cb21ee0 commit 94a04e2
Show file tree
Hide file tree
Showing 23 changed files with 237 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/apps/compile/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Example Harp App
==================

This app exposes a lot of the functionality that Harp offers. Browse the code and take a look. Questions may be asked in the #harp IRC channel on irc.freenode.net.
8 changes: 8 additions & 0 deletions test/apps/compile/basic/harp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"globals": {
"brand" : "Kitchen Sink",
"name" : "Brock Whitten",
"email" : "[email protected]",
"uri" : "http://example.com"
}
}
11 changes: 11 additions & 0 deletions test/apps/compile/basic/public/404.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
doctype
html
head
style.
body{
text-align:center;
font-family: "verdana";
}
body
h1 404
h2 Custom, Page Not Found
17 changes: 17 additions & 0 deletions test/apps/compile/basic/public/_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"404":{
"layout": false
},
"feed":{
"layout": false
},
"globals":{
"layout": false
},
"current":{
"layout": false
},
"about": {
"name": "Brock"
}
}
19 changes: 19 additions & 0 deletions test/apps/compile/basic/public/_layout.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
doctype
html
head
link(rel="stylesheet", href="/css/main.css")
link(rel="alternate", type="application/atom+xml", title="#{ brand }", href="#{ uri }/feed.atom")
script.
var showDebug = function(){
document.getElementById('debug').style.display = 'block';
return false;
}
body
#header
h1= brand
include shared/_nav
!= yield
a(href="#", onclick="showDebug()") open debug panel
.well#debug(style="display:none;")
!= partial("shared/_debug")

2 changes: 2 additions & 0 deletions test/apps/compile/basic/public/about.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
h2 About #{ name }
p Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
10 changes: 10 additions & 0 deletions test/apps/compile/basic/public/articles/_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hello-world" : {
"title" : "Hello World",
"date" : "May 2, 2012"
},
"you-half-assed-it" : {
"title" : "You half assed it. That is why your PhoneGap application sucks.",
"date" : "June 6, 2012"
}
}
6 changes: 6 additions & 0 deletions test/apps/compile/basic/public/articles/hello-world.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
h2
a(href="/articles/hello-world") Hello World
h3= date
p Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

//!= partial("../shared/_debug")
4 changes: 4 additions & 0 deletions test/apps/compile/basic/public/articles/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
h2 Articles
each article, slug in public.articles._data
hr
!= partial(slug, article)
1 change: 1 addition & 0 deletions test/apps/compile/basic/public/articles/with spaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo article with spaces
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
h2
a(href="/articles/you-half-assed-it") You Half assed it
h3= date
p Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

//!= partial("../shared/_debug")
1 change: 1 addition & 0 deletions test/apps/compile/basic/public/basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Basic HTML Page</h1>
23 changes: 23 additions & 0 deletions test/apps/compile/basic/public/css/_nav.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#header {

h1 {
font-size: 26px;
font-weight: bold;
}

ul{
list-style-type: none;
padding:0;
li{
display: inline-block;
margin-right: 20px;
a {
padding: 10px 5px;
}
}
li.current a{
background: pink;
}
}

}
23 changes: 23 additions & 0 deletions test/apps/compile/basic/public/css/_partials/_more.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#header {

h1 {
font-size: 26px;
font-weight: bold;
}

ul{
list-style-type: none;
padding:0;
li{
display: inline-block;
margin-right: 20px;
a {
padding: 10px 5px;
}
}
li.current a{
background: pink;
}
}

}
6 changes: 6 additions & 0 deletions test/apps/compile/basic/public/css/_partials/some.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body {
background: red;
&:before {
contents: "Chloi Inc."
}
}
9 changes: 9 additions & 0 deletions test/apps/compile/basic/public/css/main.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import "_nav";

body{
font-family: "Verdana"
}

.well{
background: #eee;
}
2 changes: 2 additions & 0 deletions test/apps/compile/basic/public/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
h2 Home
p Welcome to Harp. This basic app is a domonstration of how harp works. Poke around and enjoy.
5 changes: 5 additions & 0 deletions test/apps/compile/basic/public/shared/_debug.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
h4 globals
pre= JSON.stringify(locals, null, 2)

h4 current
pre= JSON.stringify(current, null, 2)
9 changes: 9 additions & 0 deletions test/apps/compile/basic/public/shared/_nav.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ul
li(class="#{ current.path[0] == 'index' ? 'current' : '' }")
a(href="/") Home
li(class="#{ current.path[0] == 'articles' ? 'current' : '' }")
a(href="/articles") Articles
li(class="#{ current.path[0] == 'about' ? 'current' : '' }")
a(href="/about") About
li
a(href="/feed.atom") RSS
6 changes: 6 additions & 0 deletions test/apps/compile/err/a.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
html
head
title Hi
link(href="b.css" rel="stylesheet" type="text/css")
body
h1 Hello
3 changes: 3 additions & 0 deletions test/apps/compile/err/b.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: $indigo
}
19 changes: 19 additions & 0 deletions test/apps/compile/err/npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink /usr/bin/node
5 error Error: ENOENT, open '/Users/kennethormandy/Sites/kennethormandy/harp/test/apps/compile/err/package.json'
6 error If you need help, you may report this log at:
6 error <http://github.com/isaacs/npm/issues>
6 error or email it to:
6 error <[email protected]>
7 error System Darwin 12.5.0
8 error command "node" "/usr/local/bin/npm" "test"
9 error cwd /Users/kennethormandy/Sites/kennethormandy/harp/test/apps/compile/err
10 error node -v v0.10.18
11 error npm -v 1.3.8
12 error path /Users/kennethormandy/Sites/kennethormandy/harp/test/apps/compile/err/package.json
13 error code ENOENT
14 error errno 34
15 verbose exit [ 34, true ]
43 changes: 43 additions & 0 deletions test/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var should = require("should")
var request = require('request')
var path = require("path")
var fs = require("fs")
var exec = require("child_process").exec
var harp = require("../");

describe("compile", function(){

describe("basic app", function(){
var projectPath = path.join(__dirname, "apps/compile/basic")
var outputPath = path.join(__dirname, "out/compile-basic")

it("should compile", function(done){
harp.compile(projectPath, outputPath, function(error){
should.not.exist(error)
done()
})
})

it("compile should not include files named with underscores", function(done) {
var cssOutputPath = path.join(outputPath, "public/css")
fs.readFile(path.join(cssOutputPath, "/_partials/some.css"), function(err, contents){
should.not.exist(contents)
})
fs.readFile(path.join(cssOutputPath, "/_partials/_more.css"), function(err, contents){
should.not.exist(contents)
})
fs.readFile(path.join(cssOutputPath, "/_nav.css"), function(err, contents){
should.not.exist(contents)
})
done()
})

})

after(function(done){
exec("rm -rf " + path.join(__dirname, "out"), function(){
done()
})
})

})

0 comments on commit 94a04e2

Please sign in to comment.