Commit dc4eea0d dc4eea0d1381b3deb0d4fa8b85c847e8a5f375d1 by Nicolas Perriault

.jshintignore directives

1 parent ad632762
......@@ -5,4 +5,3 @@ modules/querystring.js
samples
tests/site
tests/testdir
tests/suites
......
......@@ -29,6 +29,7 @@
*/
/*global console phantom require*/
/*jshint maxstatements:30 maxcomplexity:10*/
if (!phantom) {
console.error('CasperJS needs to be executed in a PhantomJS environment http://phantomjs.org/');
......
......@@ -75,6 +75,7 @@ exports.selectXPath = selectXPath;
*/
var Casper = function Casper(options) {
"use strict";
/*jshint maxstatements:30*/
// init & checks
if (!(this instanceof Casper)) {
return new Casper(options);
......
/*global casper*/
/*jshint strict:false*/
function testUA(ua, match) {
casper.test.assertMatch(
ua, match, 'Default user agent matches ' + match
......
/*global casper*/
/*jshint strict:false*/
var fs = require('fs'), testFile = '/tmp/__casper_test_capture.png';
if (fs.exists(testFile) && fs.isFile(testFile)) {
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/index.html', function() {
this.click('a[href="test.html"]');
});
......
/*global casper*/
/*jshint strict:false*/
// skip this test for phantom versions < 1.5
if (phantom.version.major === 1 && phantom.version.minor < 6) {
casper.test.comment('Skipped tests, PhantomJS 1.6 required');
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/index.html', function() {
this.test.assertEquals(this.getHTML('ul li'), 'one', 'Casper.getHTML() retrieves inner HTML by default');
this.test.assertEquals(this.getHTML('ul li', true), '<li>one</li>', 'Casper.getHTML() can retrieve outer HTML');
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/elementattribute.html', function() {
this.test.comment('Casper.getElementAttribute()');
this.test.assertEquals(this.getElementAttribute('.testo','data-stuff'), 'beautiful string', 'Casper.getElementAttribute() works as intended');
......
/*global casper*/
/*jshint strict:false*/
var fs = require('fs');
// FIXME: we're using local url scheme until https://github.com/ariya/phantomjs/pull/288 is
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.evaluate()');
casper.start();
......
/*global casper*/
/*jshint strict:false*/
// events
casper.test.comment("events");
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.exists()');
casper.start('tests/site/index.html', function() {
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.fetchText()');
casper.start('tests/site/index.html', function() {
......
......@@ -35,4 +35,4 @@ casper.then ->
casper.then ->
@test.assertEquals ++step, 13, "last step"
casper.run(-> @test.done())
\ No newline at end of file
casper.run(-> @test.done())
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/form.html', function() {
this.test.comment('Casper.fill()');
this.fill('form[action="result.html"]', {
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/global.html', function() {
this.test.comment('Casper.getGlobal()');
this.test.assertEquals(this.getGlobal('myGlobal'), 'awesome string', 'Casper.getGlobal() can retrieve a remote global variable');
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.headers.get()');
var server = require('webserver').create();
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/page1.html');
casper.thenOpen('tests/site/page2.html');
casper.thenOpen('tests/site/page3.html');
......
/*global casper*/
/*jshint strict:false*/
// Dear curious test reader,
// The on* family of methods is considered deprecated since 0.6.0; please use events instead
......
/*global casper*/
/*jshint strict:false maxstatements:99*/
casper.start('tests/site/mouse-events.html');
casper.then(function() {
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment("page.error event");
var error = {};
......
/*global casper*/
/*jshint strict:false*/
var t = casper.test, current = 0, tests = [
function(settings) {
t.assertEquals(settings, {
......@@ -130,4 +132,4 @@ casper.thenOpen('tests/site/index.html', {
casper.run(function() {
this.removeAllListeners('open');
t.done();
});
\ No newline at end of file
});
......
/*global casper*/
/*jshint strict:false*/
// skip this test for phantom versions < 1.5
if (phantom.version.major === 1 && phantom.version.minor < 6) {
casper.test.comment('Skipped tests, PhantomJS 1.6 required');
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.start()');
casper.start('tests/site/index.html', function() {
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.then()');
casper.start('tests/site/index.html');
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('Casper.viewport()');
casper.start();
......
/*global casper*/
/*jshint strict:false*/
casper.start('tests/site/visible.html', function() {
this.test.comment('Casper.visible()');
this.test.assert(this.visible('#img1'), 'Casper.visible() can detect if an element is visible');
......
/*global casper __utils__*/
/*jshint strict:false*/
var x = require('casper').selectXPath;
casper.test.comment('XPath');
......
/*global casper*/
/*jshint strict:false*/
var cli = require('cli'), t = casper.test;
t.comment('parse(), get(), has()');
......
/*global casper*/
/*jshint strict:false*/
var fs = require('fs');
var x = require('casper').selectXPath;
......
/*global casper*/
/*jshint strict:false*/
var fs = require('fs'), t = casper.test;
// Testing added methods
......@@ -33,4 +35,4 @@ var fs = require('fs'), t = casper.test;
}
})();
t.done();
\ No newline at end of file
t.done();
......
/*global casper*/
/*jshint strict:false*/
/**
* Special test server to test for HTTP status codes
*
......@@ -19,7 +21,7 @@ casper.thenOpen('file://' + phantom.casperPath + '/tests/site/index.html', funct
});
// http protocol
codes = [100, 101, 102, 118, 200, 201, 202, 203, 204, 205, 206, 207, 210,
var codes = [100, 101, 102, 118, 200, 201, 202, 203, 204, 205, 206, 207, 210,
300, 301, 302, 303, 304, 305, 307, 310,
400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
414, 415, 416, 417, 418, 422, 423, 424, 425, 426, 449, 450,
......
/*global casper*/
/*jshint strict:false*/
var t = casper.test;
var createInjector = function(fn, values) {
return require('injector').create(fn, values);
......
/*global casper*/
/*jshint strict:false maxstatements:99*/
var utils = require('utils'),
t = casper.test,
x = require('casper').selectXPath;
......@@ -66,7 +68,7 @@ t.comment('fileExt()');
t.comment('fillBlanks()');
(function() {
testCases = {
var testCases = {
'foo': 'foo ',
' foo bar ': ' foo bar ',
' foo bar ': ' foo bar '
......@@ -79,7 +81,7 @@ t.comment('fillBlanks()');
t.comment('getPropertyPath()');
(function() {
testCases = [
var testCases = [
{
input: utils.getPropertyPath({}, 'a.b.c'),
output: undefined
......@@ -123,7 +125,7 @@ t.comment('isArray()');
t.comment('isClipRect()');
(function() {
testCases = [
var testCases = [
[{}, false],
[{top: 2}, false],
[{top: 2, left: 2, width: 2, height: 2}, true],
......@@ -138,7 +140,7 @@ t.comment('isClipRect()');
t.comment('isHTTPResource()');
(function() {
testCases = [
var testCases = [
[{}, false],
[{url: 'file:///var/www/i.html'}, false],
[{url: 'mailto:plop@plop.com'}, false],
......@@ -201,7 +203,7 @@ t.comment('isWebPage()');
t.comment('isJsFile()');
(function() {
testCases = {
var testCases = {
'': false,
'toto.png': false,
'plop': false,
......@@ -216,7 +218,7 @@ t.comment('isJsFile()');
t.comment('mergeObjects()');
(function() {
testCases = [
var testCases = [
{
obj1: {a: 1}, obj2: {b: 2}, merged: {a: 1, b: 2}
},
......@@ -247,7 +249,7 @@ t.comment('mergeObjects()');
t.comment('unique()');
(function() {
testCases = [
var testCases = [
{
input: [1,2,3],
output: [1,2,3]
......
/*global casper*/
/*jshint strict:false*/
casper.test.comment('phantom.Casper.XUnitExporter');
xunit = require('xunit').create();
var xunit = require('xunit').create();
xunit.addSuccess('foo', 'bar');
casper.test.assertMatch(xunit.getXML(), /<testcase classname="foo" name="bar"/, 'XUnitExporter.addSuccess() adds a successful testcase');
xunit.addFailure('bar', 'baz', 'wrong', 'chucknorriz');
......