Skip to content

Commit 80df022

Browse files
authored
Feature/bumping deps (#2)
* Bumping versions. * Upgrading to the new Angular.JS API for promises * Removing bower componenets
1 parent ebaf7b5 commit 80df022

File tree

8 files changed

+98
-15
lines changed

8 files changed

+98
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.idea/
33
.idea-modules/
44
*.iml
5+
bower_components/

bower.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
{
22
"name": "dali",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"authors": [
5-
"Flavian Alexandru <alexandruflavian23@gmail.com>"
5+
"Flavian Alexandru <flavian@outworkers.com>"
66
],
77
"description": "JavaScript mini-framework with re-usable components",
88
"main": "dali.js",
99
"license": "MIT",
10-
"homepage": "https://github.com/websudos/dali",
10+
"homepage": "https://github.com/outworkers/dali",
1111
"dependencies": {
1212
"jsSHA": "2.0.2",
13-
"angular": "1.4.8",
14-
"angular-bootstrap": "1.1.0"
13+
"angular": "1.6.4",
14+
"angular-ui-bootstrap": "2.5.0"
15+
},
16+
"devDevepencies": {
17+
"mocha": "3.4.2"
1518
},
1619
"ignore": [
1720
"**/.*",

conf.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
exports.config = {
2+
3+
framework: 'jasmine',
4+
specs: [
5+
'spec/**/*.js'
6+
],
7+
capabilities: {
8+
browserName: 'chrome'
9+
},
10+
jasmineNodeOpts: {
11+
showColors: true // Use colors in the command line report.
12+
}
13+
};

lib/services/Service.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,39 @@ dali.services.Service.prototype.jsonp = function(route, config) {
120120
return this.request(this.getHttp().jsonp(route, config));
121121
};
122122

123-
124123
dali.services.Service.prototype.request = function(request) {
125124
var deferred = this.q_.defer();
126125

127-
request.success(function(data, status, headers, config) {
128-
deferred.resolve(new dali.http.HttpResponse(data, status, headers, config));
126+
request.then(function(response)) {
127+
deferred.resolve(
128+
new dali.http.HttpResponse(
129+
response.data,
130+
response.statusText,
131+
response.headers,
132+
response.config
133+
)
134+
);
129135

130136
if (this.autoalert_) {
131-
dali.services.AlertService.getInstance().success(status + ":" + data);
137+
dali.services.AlertService
138+
.getInstance()
139+
.success(response.statusText + ":" + response.data);
132140
}
133141

134-
}).error(function(data, status, headers, config) {
135-
deferred.reject(new dali.http.HttpError(data, status, headers, config));
142+
}, function onError(response) {
143+
deferred.reject(
144+
new dali.http.HttpError(
145+
response.data,
146+
response.statusText,
147+
response.headers,
148+
response.config
149+
)
150+
);
136151

137152
if (this.autoalert_) {
138-
dali.services.AlertService.getInstance().error(status + ":" + data);
153+
dali.services.AlertService
154+
.getInstance()
155+
.error(status + ":" + data);
139156
}
140157
});
141158

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "dali",
3+
"version": "1.4.0",
4+
"authors": [
5+
"Flavian Alexandru <flavian@outworkers.com>"
6+
],
7+
"description": "JavaScript mini-framework with re-usable components",
8+
"main": "dali.js",
9+
"license": "MIT",
10+
"homepage": "https://github.com/outworkers/dali",
11+
"dependencies": {
12+
"jsSHA": "2.0.2",
13+
"angular": "1.6.4",
14+
"angular-ui-bootstrap": "2.5.0"
15+
},
16+
"devDevepencies": {
17+
"mocha": "3.4.2"
18+
},
19+
"ignore": [
20+
"**/.*",
21+
"node_modules",
22+
"bower_components",
23+
"test",
24+
"tests"
25+
]
26+
}

spec/lib/services/services-test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
describe("the Service.js HTTP proxy for Angular should", function() {
2+
3+
it('convert successful HTTP resonses to dali lib equivalent', inject(function($q, $http, $rootScope) {
4+
var service = new dali.services.Service();
5+
service.setServices($q, $http, dali.services.AlertService.getInstance());
6+
7+
// your test assertion goes here
8+
var $scope = {};
9+
10+
/* Code Under Test */
11+
service.get('http://localhost/foo');
12+
13+
$httpBackend
14+
.when('GET', 'http://localhost/foo')
15+
.respond(200, { foo: 'bar' });
16+
17+
$httpBackend.flush();
18+
19+
expect($scope.valid).toBe(true);
20+
expect($scope.response).toEqual({ foo: 'bar' });
21+
}));
22+
23+
});

spec/util/util-spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it('should demonstrate using when (200 status)', inject(function($http) {
2+
console.log("test should suceed");
3+
}));

test/util/util-spec.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)