summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--.jshintignore1
-rw-r--r--.jshintrc11
-rw-r--r--.npmignore2
-rw-r--r--.travis.yml8
-rw-r--r--History.md2
-rw-r--r--component.json2
-rw-r--r--index.js4
-rw-r--r--package.json3
-rw-r--r--test/test.clear.js16
-rw-r--r--test/test.defer.js6
-rw-r--r--test/test.set.js24
12 files changed, 46 insertions, 35 deletions
diff --git a/.gitignore b/.gitignore
index 28f1ba7..fd4f2b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
node_modules
-.DS_Store \ No newline at end of file
+.DS_Store
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..ebec543
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,11 @@
+{
+ // Enforcing options
+ "camelcase": true,
+ "curly": false,
+ "quotmark": "single",
+
+ // Relaxing options
+ "boss": true,
+ "sub": true,
+ "laxbreak": true
+}
diff --git a/.npmignore b/.npmignore
index a806a83..cf940ae 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,3 +1,3 @@
/node_modules/
/examples/
-/test/ \ No newline at end of file
+/test/
diff --git a/.travis.yml b/.travis.yml
index 6212d53..f5eb376 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,5 @@
-script:
- - "npm test"
-
language: node_js
-
node_js:
- - "0.10" \ No newline at end of file
+ - "0.10"
+script:
+ - "npm test"
diff --git a/History.md b/History.md
index 68eeb5f..d966286 100644
--- a/History.md
+++ b/History.md
@@ -11,4 +11,4 @@
* add `FastDom#clear` clears read, write and defer jobs by id
* remove `FastDom#clearRead`
* remove `FastDom#clearWrite`
- * change directory structure by removing `/lib` \ No newline at end of file
+ * change directory structure by removing `/lib`
diff --git a/component.json b/component.json
index 82aa51f..d318c23 100644
--- a/component.json
+++ b/component.json
@@ -12,4 +12,4 @@
"README.md"
],
"license": "MIT"
-} \ No newline at end of file
+}
diff --git a/index.js b/index.js
index 6be22f8..0f657b5 100644
--- a/index.js
+++ b/index.js
@@ -114,7 +114,7 @@
var self = this;
// If we are currently writing, we don't
- // need to scedule a new frame as this
+ // need to schedule a new frame as this
// job will be emptied from the write queue
if (mode === 'writing' && type === 'write') return;
@@ -280,7 +280,7 @@
if (typeof module !== 'undefined' && module.exports) {
module.exports = fastdom;
- } else if (typeof define === "function" && define.amd) {
+ } else if (typeof define === 'function' && define.amd) {
define(function(){ return fastdom; });
} else {
window['fastdom'] = fastdom;
diff --git a/package.json b/package.json
index e4ea0f3..c2e4272 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"version": "0.7.1",
"main": "index.js",
"scripts": {
- "test": "./node_modules/.bin/mocha-phantomjs test/index.html"
+ "test": "jshint . && mocha-phantomjs test/index.html"
},
"homepage": "https://github.com/wilsonpage/fastdom",
"author": {
@@ -18,6 +18,7 @@
"license": "MIT",
"devDependencies": {
"mocha": "~1.12.0",
+ "jshint": "~2.1.0",
"sinon": "~1.7.3",
"chai": "~1.7.2",
"mocha-phantomjs": "~3.1.2"
diff --git a/test/test.clear.js b/test/test.clear.js
index ee60f2e..5194830 100644
--- a/test/test.clear.js
+++ b/test/test.clear.js
@@ -1,7 +1,7 @@
-suite('Clear', function(){
+suite('clear', function(){
- test("Should not run 'read' job if cleared (sync)", function(done) {
+ test('Should not run "read" job if cleared (sync)', function(done) {
var fastdom = new FastDom();
var read = sinon.spy();
@@ -14,7 +14,7 @@ suite('Clear', function(){
});
});
- test("Should fail silently if job not found in queue", function(done) {
+ test('Should fail silently if job not found in queue', function(done) {
var fastdom = new FastDom();
var read = sinon.spy();
var read2 = sinon.spy();
@@ -28,7 +28,7 @@ suite('Clear', function(){
});
});
- test("Should not run 'write' job if cleared (async)", function(done) {
+ test('Should not run "write" job if cleared (async)', function(done) {
var fastdom = new FastDom();
var read = sinon.spy();
var write = sinon.spy();
@@ -44,7 +44,7 @@ suite('Clear', function(){
});
});
- test("Should not run 'write' job if cleared", function(done) {
+ test('Should not run "write" job if cleared', function(done) {
var fastdom = new FastDom();
var write = sinon.spy();
var id = fastdom.write(write);
@@ -57,7 +57,7 @@ suite('Clear', function(){
});
});
- test("Should not run 'defer' job if cleared", function(done) {
+ test('Should not run "defer" job if cleared', function(done) {
var fastdom = new FastDom();
var write = sinon.spy();
var id = fastdom.defer(3, write);
@@ -76,7 +76,7 @@ suite('Clear', function(){
});
});
- test("Should remove reference to the job if cleared", function(done) {
+ test('Should remove reference to the job if cleared', function(done) {
var fastdom = new FastDom();
var write = sinon.spy();
var id = fastdom.defer(2, write);
@@ -94,4 +94,4 @@ suite('Clear', function(){
});
});
-}); \ No newline at end of file
+});
diff --git a/test/test.defer.js b/test/test.defer.js
index c1ae179..3e56a94 100644
--- a/test/test.defer.js
+++ b/test/test.defer.js
@@ -1,7 +1,7 @@
suite('defer', function(){
- test("Should run the job after the specified number of frames", function(done) {
+ test('Should run the job after the specified number of frames', function(done) {
var fastdom = new FastDom();
var job = sinon.spy();
@@ -22,7 +22,7 @@ suite('defer', function(){
});
});
- test("Should call a deferred callback with the given context", function(done) {
+ test('Should call a deferred callback with the given context', function(done) {
var fastdom = new FastDom();
var cb = sinon.spy();
var ctx = { foo: 'bar' };
@@ -33,7 +33,7 @@ suite('defer', function(){
}, ctx);
});
- test("Should remove the reference to the job once run", function(done) {
+ test('Should remove the reference to the job once run', function(done) {
var fastdom = new FastDom();
var callback = sinon.spy();
var id = fastdom.defer(2, callback);
diff --git a/test/test.set.js b/test/test.set.js
index a1dd83c..440848d 100644
--- a/test/test.set.js
+++ b/test/test.set.js
@@ -1,7 +1,7 @@
-suite('Set', function() {
+suite('set', function() {
- test("Should run reads before writes", function(done) {
+ test('Should run reads before writes', function(done) {
var fastdom = new FastDom();
var read = sinon.spy(function() {
@@ -17,7 +17,7 @@ suite('Set', function() {
fastdom.write(write);
});
- test("Should call all reads together, followed by all writes", function(done) {
+ test('Should call all reads together, followed by all writes', function(done) {
var fastdom = new FastDom();
var read1 = sinon.spy();
var read2 = sinon.spy();
@@ -41,7 +41,7 @@ suite('Set', function() {
});
});
- test("Should call a read in the same frame if scheduled inside a read callback", function(done) {
+ test('Should call a read in the same frame if scheduled inside a read callback', function(done) {
var fastdom = new FastDom();
var cb = sinon.spy();
@@ -62,7 +62,7 @@ suite('Set', function() {
});
});
- test("Should call a write in the same frame if scheduled inside a read callback", function(done) {
+ test('Should call a write in the same frame if scheduled inside a read callback', function(done) {
var fastdom = new FastDom();
var cb = sinon.spy();
@@ -83,7 +83,7 @@ suite('Set', function() {
});
});
- test("Should call a read in the *next* frame if scheduled inside a write callback", function(done) {
+ test('Should call a read in the *next* frame if scheduled inside a write callback', function(done) {
var fastdom = new FastDom();
var cb = sinon.spy();
@@ -103,7 +103,7 @@ suite('Set', function() {
});
});
- test("Should call a 'read' callback with the given context", function(done) {
+ test('Should call a "read" callback with the given context', function(done) {
var fastdom = new FastDom();
var cb = sinon.spy();
var ctx = { foo: 'bar' };
@@ -114,7 +114,7 @@ suite('Set', function() {
}, ctx);
});
- test("Should call a 'write' callback with the given context", function(done) {
+ test('Should call a "write" callback with the given context', function(done) {
var fastdom = new FastDom();
var cb = sinon.spy();
var ctx = { foo: 'bar' };
@@ -125,7 +125,7 @@ suite('Set', function() {
}, ctx);
});
- test("Should have empty job hash when batch complete", function(done) {
+ test('Should have empty job hash when batch complete', function(done) {
var fastdom = new FastDom();
fastdom.read(function(){});
@@ -142,7 +142,7 @@ suite('Set', function() {
});
});
- test("Should maintain correct context if single method is registered twice", function(done) {
+ test('Should maintain correct context if single method is registered twice', function(done) {
var fastdom = new FastDom();
var ctx1 = { foo: 'bar' };
var ctx2 = { bar: 'baz' };
@@ -162,7 +162,7 @@ suite('Set', function() {
});
});
- test("Should call a registered onError handler when an error is thrown inside a job", function(done) {
+ test('Should call a registered onError handler when an error is thrown inside a job', function(done) {
var fastdom = new FastDom();
var err1 = { some: 'error1' };
var err2 = { some: 'error2' };
@@ -184,4 +184,4 @@ suite('Set', function() {
done();
});
});
-}); \ No newline at end of file
+});