Permalink
Browse files

Prepared phantom

  • Loading branch information...
1 parent d629843 commit 31c61e132405f7dc0f28860f10aa72d6da3aeb57 @schickling schickling committed May 19, 2013
Showing with 43 additions and 3 deletions.
  1. +9 −0 .travis.yml
  2. +14 −1 Gruntfile.js
  3. +1 −1 demo.html
  4. +3 −1 package.json
  5. +16 −0 spec/test.spec.js
View
9 .travis.yml
@@ -0,0 +1,9 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.7
+ - 0.8
+ - 0.9
+ - 0.10
+before_script:
+ - "sudo npm install -g jasmine-node"
View
15 Gruntfile.js
@@ -22,14 +22,27 @@ module.exports = function (grunt) {
projectRoot: ".",
requirejs: false,
forceExit: true
+ },
+
+ connect: {
+ server: {
+ options: {
+ port: 9000,
+ base: './'
+ }
+ }
}
});
+ grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jasmine-node');
- grunt.registerTask('test', ['jasmine_node']);
+ grunt.registerTask('test', [
+ 'connect:server',
+ 'jasmine_node'
+ ]);
grunt.registerTask('default', ['test']);
};
View
2 demo.html
@@ -225,7 +225,7 @@
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!--<script src="jquery-latest.js"></script>-->
- <script src="jquery.overscroll.js"></script>
+ <script src="src/jquery.overscroll.js"></script>
<script>
$(function(o){
o = $("#overscroll").overscroll({
View
4 package.json
@@ -5,7 +5,9 @@
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.5.2",
- "grunt-jasmine-node": "~0.1.0"
+ "grunt-jasmine-node": "~0.1.0",
+ "grunt-contrib-connect": "~0.2.0",
+ "phantom": "~0.4.2"
},
"scripts": {
"test": "grunt test --verbose"
View
16 spec/test.spec.js
@@ -1,3 +1,19 @@
+var phantom = require('phantom');
+
+phantom.create(function (ph) {
+ return ph.createPage(function (page) {
+ return page.open("http://localhost:9000/demo.html", function (status) {
+ console.log("opened google? ", status);
+ return page.evaluate((function () {
+ return document.title;
+ }), function (result) {
+ console.log('Page title is ' + result);
+ return ph.exit();
+ });
+ });
+ });
+});
+
describe("A suite", function () {
it("contains spec with an expectation", function () {
expect(true).toBe(true);

0 comments on commit 31c61e1

Please sign in to comment.