Skip to content

Commit

Permalink
Fixed jscs errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmaguo committed May 10, 2016
1 parent 73a5bf8 commit 6753f12
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 32 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ module.exports = function(grunt) {
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> v<%= pkg.version %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
banner: '/*! <%= pkg.name %> v<%= pkg.version %> ' +
'<%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
Expand Down
88 changes: 57 additions & 31 deletions test/angular-poller-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ describe('emguo.poller', function() {
expect(current - poller1.stopTimestamp).to.be.at.most(1);
});

it('should ignore success response if request is sent before stop() is invoked', function() {
it('should ignore success response if request is sent before stop() ' +
'is invoked', function() {
poller2.stop();
$httpBackend.expect('GET', '/admin').respond({ id: 2, name: 'Bob' });

Expand All @@ -181,7 +182,8 @@ describe('emguo.poller', function() {
expect(result1.name).to.equal('Alice');
});

it('should ignore error response if request is sent before stop() is invoked', function() {
it('should ignore error response if request is sent before stop() is ' +
'invoked', function() {
poller1.stop();
$httpBackend.expect('GET', '/users?group=1').respond(
503,
Expand All @@ -204,7 +206,8 @@ describe('emguo.poller', function() {
expect(result2[0].name).to.equal('Alice');
});

it('should stop poller and remove it from poller registry on invoking remove().', function() {
it('should stop poller and remove it from poller registry on invoking ' +
'remove().', function() {
var spy = sinon.spy(poller1, 'stop');
expect(poller.size()).to.equal(2);
poller1.remove();
Expand Down Expand Up @@ -245,7 +248,8 @@ describe('emguo.poller', function() {
expect(result2[0].name).to.equal('Alice');
});

it('should send request every (delay) milliseconds if smart flag is set to false.', function() {
it('should send request every (delay) milliseconds if smart flag is set to ' +
'false.', function() {
poller2.stop();
$httpBackend.expect('GET', '/admin').respond(null);
$httpBackend.expect('GET', '/admin').respond({ id: 3, name: 'Emma' });
Expand All @@ -258,7 +262,8 @@ describe('emguo.poller', function() {
expect(result1.name).to.equal('Emma');
});

it('should only send new request if the previous one is resolved if smart flag is set to true', function() {
it('should only send new request if the previous one is resolved if smart ' +
'flag is set to true', function() {
poller1.stop();
$httpBackend.expect('GET', '/users?group=1').respond([
{ id: 1, name: 'Alice' },
Expand All @@ -273,7 +278,8 @@ describe('emguo.poller', function() {
expect(result2.length).to.equal(3);
});

it('should only get notified of success responses if catchError flag is set to false.', function() {
it('should only get notified of success responses if catchError flag is set ' +
'to false.', function() {
var previousResult = result1;
poller2.stop();
$httpBackend.expect('GET', '/admin').respond(
Expand All @@ -290,7 +296,8 @@ describe('emguo.poller', function() {
expect(result1).to.equal(previousResult);
});

it('should get notified of both success and error responses if catchError flag is set to true.', function() {
it('should get notified of both success and error responses if catchError ' +
'flag is set to true.', function() {
poller1.stop();
$httpBackend.expect('GET', '/users?group=1').respond(
503,
Expand Down Expand Up @@ -350,7 +357,8 @@ describe('emguo.poller', function() {
]
});

$httpBackend.expect('POST', '/admin?param1=1&param2=2', '{"data1":1}').respond({});
$httpBackend.expect('POST', '/admin?param1=1&param2=2', '{"data1":1}')
.respond({});
$httpBackend.flush(1);
});
});
Expand All @@ -371,9 +379,11 @@ describe('emguo.poller', function() {
]
});

$httpBackend.expect('GET', '/admin/123?param1=1&param2=2', undefined, function(headers) {
return headers.header1 === 1;
}).respond([]);
$httpBackend.expect('GET', '/admin/123?param1=1&param2=2', undefined,
function(headers) {
return headers.header1 === 1;
}
).respond([]);
$httpBackend.flush(1);
});

Expand All @@ -391,9 +401,11 @@ describe('emguo.poller', function() {
]
});

$httpBackend.expect('GET', '/users?param1=1&param2=2', undefined, function(headers) {
return headers.header1 === 1;
}).respond([]);
$httpBackend.expect('GET', '/users?param1=1&param2=2', undefined,
function(headers) {
return headers.header1 === 1;
}
).respond([]);
$httpBackend.flush(1);
});

Expand All @@ -412,9 +424,11 @@ describe('emguo.poller', function() {
]
});

$httpBackend.expect('GET', '/admin/123/test?param1=1&param2=2', undefined, function(headers) {
return headers.header1 === 1;
}).respond([]);
$httpBackend.expect('GET', '/admin/123/test?param1=1&param2=2', undefined,
function(headers) {
return headers.header1 === 1;
}
).respond([]);
$httpBackend.flush(1);
});
});
Expand All @@ -436,9 +450,11 @@ describe('emguo.poller', function() {
]
});

$httpBackend.expect('GET', '/admin?param1=1&param2=2', undefined, function(headers) {
return headers.header1 === 1;
}).respond({});
$httpBackend.expect('GET', '/admin?param1=1&param2=2', undefined,
function(headers) {
return headers.header1 === 1;
}
).respond({});
$httpBackend.flush(1);
});

Expand All @@ -461,9 +477,11 @@ describe('emguo.poller', function() {
]
});

$httpBackend.expect('POST', '/admin?param1=1&param2=2', '{"data1":1}', function(headers) {
return headers.header1 === 1;
}).respond({});
$httpBackend.expect('POST', '/admin?param1=1&param2=2', '{"data1":1}',
function(headers) {
return headers.header1 === 1;
}
).respond({});
$httpBackend.flush(1);
});
});
Expand Down Expand Up @@ -669,7 +687,8 @@ describe('emguo.poller PollerConfig', function() {
expect(anotherSpy).to.have.callCount(0);
});

it('should stop all pollers on $routeChangeStart if pollerConfig.stopOn is set to $routeChangeStart.', function() {
it('should stop all pollers on $routeChangeStart if pollerConfig.stopOn is set to ' +
'$routeChangeStart.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
stopOn: '$routeChangeStart'
Expand All @@ -682,7 +701,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should stop all pollers on $routeChangeSuccess if pollerConfig.stopOn is set to $routeChangeSuccess.', function() {
it('should stop all pollers on $routeChangeSuccess if pollerConfig.stopOn is set ' +
'to $routeChangeSuccess.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
stopOn: '$routeChangeSuccess'
Expand All @@ -695,7 +715,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should stop all pollers on $stateChangeStart if pollerConfig.stopOn is set to $stateChangeStart.', function() {
it('should stop all pollers on $stateChangeStart if pollerConfig.stopOn is set ' +
'to $stateChangeStart.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
stopOn: '$stateChangeStart'
Expand All @@ -708,7 +729,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should stop all pollers on $stateChangeSuccess if pollerConfig.stopOn is set to $stateChangeSuccess.', function() {
it('should stop all pollers on $stateChangeSuccess if pollerConfig.stopOn is set ' +
'to $stateChangeSuccess.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
stopOn: '$stateChangeSuccess'
Expand All @@ -721,7 +743,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should reset all pollers on $routeChangeStart if pollerConfig.resetOn is set to $routeChangeStart.', function() {
it('should reset all pollers on $routeChangeStart if pollerConfig.resetOn is set ' +
'to $routeChangeStart.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
resetOn: '$routeChangeStart'
Expand All @@ -734,7 +757,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should reset all pollers on $routeChangeSuccess if pollerConfig.resetOn is set to $routeChangeSuccess.', function() {
it('should reset all pollers on $routeChangeSuccess if pollerConfig.resetOn is set ' +
'to $routeChangeSuccess.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
resetOn: '$routeChangeSuccess'
Expand All @@ -747,7 +771,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should reset all pollers on $stateChangeStart if pollerConfig.resetOn is set to $stateChangeStart.', function() {
it('should reset all pollers on $stateChangeStart if pollerConfig.resetOn is set ' +
'to $stateChangeStart.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
resetOn: '$stateChangeStart'
Expand All @@ -760,7 +785,8 @@ describe('emguo.poller PollerConfig', function() {
expect(spy).to.have.callCount(1);
});

it('should reset all pollers on $stateChangeSuccess if pollerConfig.resetOn is set to $stateChangeSuccess.', function() {
it('should reset all pollers on $stateChangeSuccess if pollerConfig.resetOn is set ' +
'to $stateChangeSuccess.', function() {
module(function($provide) {
$provide.constant('pollerConfig', {
resetOn: '$stateChangeSuccess'
Expand Down

0 comments on commit 6753f12

Please sign in to comment.