Skip to content

Commit

Permalink
Move browser-specific tests to a subdir, refs #63
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Apr 25, 2013
1 parent e7dff62 commit 488cf95
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ bin/*.js
/lib/
/_site/
spec/*.js
spec/browser/*.js
spec/result.xml
server/static/js/*.js
docs_tmp/
Expand Down
16 changes: 15 additions & 1 deletion Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ module.exports = ->
src: ['**.coffee']
dest: 'spec'
ext: '.js'
spec_browser:
options:
bare: true
expand: true
cwd: 'spec/browser'
src: ['**.coffee']
dest: 'spec/browser'
ext: '.js'

# Browser version building
component:
Expand Down Expand Up @@ -66,12 +74,18 @@ module.exports = ->

# BDD tests on Node.js
cafemocha:
src: ['spec/*.coffee']
nodejs:
src: ['spec/*.coffee']
options:
grep: '@browser'
invert: true
reporter: 'dot'

# BDD tests on browser
mocha_phantomjs:
options:
output: 'spec/result.xml'
reporter: 'dot'
all: ['spec/runner.html']

# Coding standards
Expand Down
8 changes: 2 additions & 6 deletions spec/GetElement.coffee → spec/browser/GetElement.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
if typeof process is 'object' and process.title is 'node'
# TODO: Use jsdom to make DOM components work also on Node
return
else
getelement = require 'noflo/components/GetElement.js'
socket = require 'noflo/lib/InternalSocket.js'
getelement = require 'noflo/components/GetElement.js'
socket = require 'noflo/lib/InternalSocket.js'

describe 'GetElement component', ->
c = null
Expand Down
7 changes: 2 additions & 5 deletions spec/ListenDrag.coffee → spec/browser/ListenDrag.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
if typeof process is 'object' and process.title is 'node'
return
else
listenDrag = require 'noflo/components/ListenDrag.js'
socket = require 'noflo/lib/InternalSocket.js'
listenDrag = require 'noflo/components/ListenDrag.js'
socket = require 'noflo/lib/InternalSocket.js'

describe 'ListenDrag component', ->
c = null
Expand Down
7 changes: 2 additions & 5 deletions spec/ListenTouch.coffee → spec/browser/ListenTouch.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
if typeof process is 'object' and process.title is 'node'
return
else
listenTouch = require 'noflo/components/ListenTouch.js'
socket = require 'noflo/lib/InternalSocket.js'
listenTouch = require 'noflo/components/ListenTouch.js'
socket = require 'noflo/lib/InternalSocket.js'

describe 'ListenTouch component', ->
c = null
Expand Down
6 changes: 3 additions & 3 deletions spec/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
<script src="./Callback.js"></script>
<script src="./Kick.js"></script>
<script src="./Gate.js"></script>
<script src="./GetElement.js"></script>
<script src="./ListenTouch.js"></script>
<script src="./ListenDrag.js"></script>
<script src="./Spring.js"></script>
<script src="./browser/GetElement.js"></script>
<script src="./browser/ListenTouch.js"></script>
<script src="./browser/ListenDrag.js"></script>
<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
Expand Down

0 comments on commit 488cf95

Please sign in to comment.