Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test

  • Loading branch information...
commit 512fea2a9e69571f073d3407747dc6e3e0f72220 1 parent de571b0
Roman Rudenko authored
View
2  lib/dust/duster.js
@@ -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);
View
33 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}
View
8 test/integration/phantom.coffee
@@ -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
View
3  test/integration/server.coffee
@@ -11,6 +11,7 @@ preview server runs correctly.
###
Connect = require 'connect'
+Fs = require 'fs'
Injector = require '../../src/injector.coffee'
{Project} = require '../../src/project.coffee'
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.