Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Rudenko committed Mar 26, 2013
1 parent de571b0 commit 512fea2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/dust/duster.js
Expand Up @@ -286,7 +286,7 @@ dust.emitRelativePartial = function(name, base, chunk, context) {
// Templates are named after their filename.
try {
source = source.replace(
/(^{)(<script[\s\S]*?>[\s\S]*?<\/script\s*>)/gi,
/([^{])(<script[\s\S]*?>[\s\S]*?<\/script\s*>)/gi,
'$1{%whitespace:true}$2{/whitespace}'
);
compiled = dust.compile(source, templateName);
Expand Down
33 changes: 33 additions & 0 deletions test/integration/home.tmpl
@@ -0,0 +1,33 @@
{>base/}

{<content}
<h2>We've also extracted the first paragraph from your site and placed it in home.tmpl:</h2>
<p class="extract">
{content.firstp}
</p>
{%script}
// Single line comment
window.acc = "Horus";
// Single line comment
{/script}
<script>
// Single line comment
window.acc += " Isis";
/*
Multiline comment
*/
</script>
<script class="dog" type="text/javascript">
/*
Multiline comment
*/
window.acc += " Osiris";
// Single line comment
</script>
<script>
// Single line comment
document.write('<p>' + window.acc + '</p>');
// Single line comment
</script>

{/content}
8 changes: 5 additions & 3 deletions test/integration/phantom.coffee
Expand Up @@ -21,8 +21,10 @@ page.open TAG_SERVER_URL, (status) ->
outerHTML = page.evaluate ->
document.documentElement.outerHTML

needle = "Welcome to your first Mobify.js Mobile Page"
status = if !!~outerHTML.indexOf needle then 0 else 1
exit status
needles = [ "Welcome to your first Mobify.js Mobile Page", "Horus Isis Osiris" ]
for needle in needles
if !~outerHTML.indexOf needle then return exit 1

return exit 0

setTimeout mobifyjs_ready, 5000
3 changes: 3 additions & 0 deletions test/integration/server.coffee
Expand Up @@ -11,6 +11,7 @@ preview server runs correctly.
###
Connect = require 'connect'
Fs = require 'fs'

Injector = require '../../src/injector.coffee'
{Project} = require '../../src/project.coffee'
Expand All @@ -34,6 +35,8 @@ PREVIEW_PORT = 1343

# Preview Server
scaffold_ready = () ->

Fs.writeFileSync('test/fixtures-preview/src/tmpl/home.tmpl', Fs.readFileSync('test/integration/home.tmpl'))
project = Project.load 'test/fixtures-preview/project.json'
environment = project.getEnv()
@preview = Preview.createServer environment
Expand Down

0 comments on commit 512fea2

Please sign in to comment.