Skip to content

Commit cf6e0a2

Browse files
committed
Merge pull request #108 from TF2Stadium/v0.4.0-alpha
Version v0.4.0-alpha
2 parents 1b47834 + 0c2e390 commit cf6e0a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1466
-467
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
gulp/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dist/
77
src/assets/
88
src/app/app.config.js
99
Frontend.iml
10+
coverage/

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
## [Unreleased]
4+
5+
## [0.4.0] - 2015-12-26
6+
7+
* Added changelog file.
8+
* Updated angular-material to v1.0.0.
9+
* Allow y-scrolling for short viewports.
10+
* Added websocket disconnection handling.
11+
* Added quotes and noscript warn to splash screen (https://github.com/TF2Stadium/Frontend/issues/87).
12+
* Style: added animation support.
13+
* Notifications: reworked toasts.
14+
* Chat: improved handling of long messages.
15+
* Settings: move logout to new user account section.
16+
* LobbyServie: clean mumble URL to use a valid username (https://github.com/TF2Stadium/QA/issues/18).

bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"angular": "~1.4.7",
1010
"angular-animate": "~1.4.0",
1111
"angular-audio": "~1.7.1",
12-
"angular-material": "1.0.0-rc4",
12+
"angular-material": "1.0.0",
1313
"angular-scroll-glue": "~2.0.6",
1414
"angular-ui-router": "~0.2.15",
1515
"clipboard": "~1.5.3",
16-
"wsevent.js": "~1.0.0"
16+
"wsevent.js": "~1.0.1"
1717
},
1818
"devDependencies": {
1919
"angular-mocks": "~1.4.7"

circle.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
test:
1111
override:
1212
- gulp lint
13-
- gulp test
13+
- gulp test-browsers
1414
deployment:
1515
master:
1616
branch: master

gulp/lint.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ function isFixed(file) {
1313

1414
function runLinter(tryToFix) {
1515
var codePath = path.join(conf.paths.src, 'app');
16-
return gulp.src(path.join(codePath, '**/*.js'))
16+
return gulp.src([path.join(codePath, '**/*.js'),
17+
path.join(conf.paths.test, '**/*.js')])
1718
.pipe($.eslint({ fix: tryToFix }))
1819
.pipe($.eslint.format())
1920
.pipe($.if(isFixed, gulp.dest(codePath)))

gulp/test.js

+50-19
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,58 @@ var karma = require('karma');
99

1010
var $ = require('gulp-load-plugins')();
1111

12+
function runUnitTestsOn(browsers, done) {
13+
var src_files = [];
14+
var src_glob = path.join(conf.paths.src, '/app/**/*.js');
15+
16+
var preprocessors = {};
17+
preprocessors[src_glob] = ['coverage'];
18+
19+
gulp.src(src_glob)
20+
.pipe($.angularFilesort())
21+
.on('data', function (file) {
22+
src_files.push(file.path);
23+
}).on('end', function () {
24+
var server = new karma.Server({
25+
browsers: browsers,
26+
frameworks: ['mocha', 'chai-sinon'],
27+
files:
28+
mainBowerFiles({ includeDev: true })
29+
.concat(
30+
// Note: es5-shim needed to fix some phantomjs issues,
31+
// including no Function.prototype.bind . This can be
32+
// removed (along with the es5-shim dependency) once an
33+
// upgrade to phantomjs2 is complete
34+
'node_modules/es5-shim/es5-shim.js',
35+
src_files,
36+
path.join(conf.paths.test, '/karma/**/*.js')),
37+
singleRun: true,
38+
reporters: ['progress', 'coverage'],
39+
preprocessors: preprocessors
40+
});
41+
42+
server.on('run_complete', function (browsers, results) {
43+
// NB If the argument of done() is not null or not undefined,
44+
// e.g. a string, the next task in a series won't run.
45+
done(results.error ? 'There are test failures' : null);
46+
});
47+
server.start();
48+
});
49+
}
50+
1251
gulp.task('test:unit', function (done) {
13-
var server = new karma.Server({
14-
browsers: ['PhantomJS'],
15-
frameworks: ['mocha', 'chai-sinon'],
16-
files: mainBowerFiles({ includeDev: true }).concat([
17-
'dist/scripts/app-*.js',
18-
'test/karma/**/*.js'
19-
]),
20-
logLevel: 'DEBUG',
21-
singleRun: true
22-
});
23-
24-
server.on('run_complete', function (browsers, results) {
25-
// NB If the argument of done() is not null or not undefined,
26-
// e.g. a string, the next task in a series won't run.
27-
done(results.error ? 'There are test failures' : null);
28-
});
29-
30-
server.start();
52+
runUnitTestsOn(['PhantomJS'], done)
53+
});
54+
55+
gulp.task('test-browsers:unit', function (done) {
56+
runUnitTestsOn(['PhantomJS', 'Firefox', 'Chrome'], done)
3157
});
3258

3359
gulp.task('test', function (cb) {
34-
runSequence('build', 'test:unit', cb);
60+
runSequence('test:unit', cb);
61+
});
62+
63+
64+
gulp.task('test-browsers', function (cb) {
65+
runSequence('test-browsers:unit', cb);
3566
});

package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "GPL-3.0",
55
"repository": "https://github.com/TF2Stadium/Frontend",
66
"readme": "readme.md",
7-
"version": "0.3.3",
7+
"version": "0.4.0",
88
"dependencies": {
99
"del": "~1.2.0",
1010
"uglify-save-license": "~0.4.1",
@@ -41,6 +41,7 @@
4141
"chalk": "^1.1.1",
4242
"concat-stream": "~1.5.0",
4343
"connect-history-api-fallback": "^1.1.0",
44+
"es5-shim": "^4.4.1",
4445
"eslint": "^1.10.1",
4546
"eslint-plugin-angular": "^0.14.0",
4647
"glob": "^6.0.1",
@@ -53,6 +54,9 @@
5354
"http-proxy-middleware": "~0.0.5",
5455
"karma": "^0.13.15",
5556
"karma-chai-sinon": "^0.1.5",
57+
"karma-chrome-launcher": "^0.2.2",
58+
"karma-coverage": "^0.5.3",
59+
"karma-firefox-launcher": "^0.1.7",
5660
"karma-mocha": "^0.2.1",
5761
"karma-phantomjs-launcher": "^0.2.1",
5862
"merge-stream": "~0.1.7",
@@ -61,7 +65,8 @@
6165
"require-dir": "~0.3.0",
6266
"run-sequence": "^1.1.5",
6367
"selenium-webdriver": "^2.48.2",
64-
"sinon": "^1.17.2"
68+
"sinon": "^1.17.2",
69+
"sinon-chai": "^2.8.0"
6570
},
6671
"engines": {
6772
"node": ">=0.10.0"

src/app/app.filter.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
(function () {
22
'use strict';
33

4-
5-
angular.module('tf2stadium')
4+
angular.module('tf2stadium.filters')
65
.filter('capitalize', capitalize)
76
.filter('reverse', reverse)
87
.filter('trusted', trusted)
@@ -14,7 +13,7 @@
1413
/** @ngInject */
1514
function capitalize() {
1615
return function (input) {
17-
if(typeof input === 'undefined' || input === '') {
16+
if (angular.isUndefined(input) || input === '') {
1817
return input;
1918
}
2019
return input.charAt(0).toUpperCase() + input.substr(1).toLowerCase();

src/app/app.module.js

+4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
'use strict';
33

44
angular.module('tf2stadium', [
5+
'tf2stadium.controllers',
56
'tf2stadium.services',
7+
'tf2stadium.filters',
68
'ngAnimate',
79
'ui.router',
810
'ngMaterial',
911
'luegg.directives',
1012
'ngAudio'
1113
]);
1214

15+
angular.module('tf2stadium.controllers', []);
1316
angular.module('tf2stadium.services', []);
17+
angular.module('tf2stadium.filters', []);
1418

1519
})();

src/app/app.notifications.js

+15-58
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,45 @@
22
'use strict';
33

44
angular.module('tf2stadium')
5-
.factory('Notifications', NotificationsFactory)
6-
.controller('NotificationsController', NotificationsController);
5+
.factory('Notifications', NotificationsFactory);
76

87
/** @ngInject */
9-
function NotificationsFactory($mdToast, $document, $timeout, $log, ngAudio) {
8+
function NotificationsFactory($mdToast, $window, $document, $timeout, $log, ngAudio) {
109

1110
var notificationsService = {};
1211

13-
var notifications = {};
14-
var nextId = 0;
15-
1612
var toastDefault = {
1713
templateUrl: 'app/shared/notifications/toast.html',
1814
message: 'Default',
1915
actionMessage: 'OK',
20-
action: function () {
21-
$mdToast.hide();
22-
},
16+
action: function () {},
2317
controller: 'ToastController',
2418
controllerAs: 'toast',
2519
bindToController: true,
2620
error: false,
2721
parent: $document[0].querySelector('#toasts'),
28-
hideDelay: 0
29-
};
30-
31-
notificationsService.add = function (message, level) {
32-
notifications[nextId] = {message: message, level: level};
33-
nextId++;
34-
};
35-
36-
notificationsService.remove = function (id) {
37-
delete notifications[id];
38-
};
39-
40-
notificationsService.clearNotifications = function () {
41-
for (var notificationKey in notifications) {
42-
delete notifications[notificationKey];
43-
}
44-
};
45-
46-
notificationsService.getNotifications = function () {
47-
return notifications;
22+
autoWrap: false,
23+
hideDelay: 5000
4824
};
4925

5026
notificationsService.toast = function (options) {
51-
for (var key in toastDefault) {
52-
if (!options[key]) {
53-
options[key] = toastDefault[key];
54-
}
55-
}
56-
$mdToast.show(options);
27+
$mdToast
28+
.show(angular.extend({}, toastDefault, options))
29+
.then(function (clicked) {
30+
if (clicked === 'ok') {
31+
options.action();
32+
}
33+
});
5734
};
5835

5936
notificationsService.notifyBrowser = function (options) {
60-
61-
if (!('Notification' in window)) {
37+
if (!('Notification' in $window)) {
6238
$log.log('Browser doesn\'t support HTML5 notifications');
6339
return;
6440
}
6541

42+
var Notification = $window.Notification;
43+
6644
if (($document[0].hasFocus() && !options.showAlways) || Notification.permission === 'denied') {
6745
return;
6846
}
@@ -100,25 +78,4 @@
10078

10179
}
10280

103-
/** @ngInject */
104-
function NotificationsController(Notifications) {
105-
106-
var vm = this;
107-
108-
vm.remove = function (id) {
109-
Notifications.remove(id);
110-
};
111-
112-
vm.add = function (message, level) {
113-
Notifications.add(message, level);
114-
};
115-
116-
vm.isEmpty = function () {
117-
return Object.keys(vm.notifications).length < 1;
118-
};
119-
120-
vm.notifications = Notifications.getNotifications();
121-
122-
}
123-
12481
})();

src/app/app.run.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
timeout: 3,
8888
showAlways: true
8989
});
90-
}
90+
},
91+
hideDelay: 0
9192
});
9293
}, 2000);
9394

src/app/pages/lobby/create/header.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function () {
22
'use strict';
33

4-
angular.module('tf2stadium')
4+
angular.module('tf2stadium.controllers')
55
.controller('LobbyCreateHeaderController', LobbyCreateHeaderController);
66

77
/** @ngInject */

src/app/pages/lobby/create/lobby-create.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function () {
22
'use strict';
33

4-
angular.module('tf2stadium')
4+
angular.module('tf2stadium.controllers')
55
.controller('LobbyCreateController', LobbyCreateController);
66

77
/** @ngInject */

src/app/pages/lobby/create/step-format.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ng-repeat="format in lobbyCreate.formats.options | LobbyCreateOptionFilter:'formats':lobbyCreate.searchString | orderBy:'title'"
44
ng-click="lobbyCreate.select(lobbyCreate.formats, format)"
55
ng-if="format.value!='debug' || $root.userProfile.role=='administrator'"
6-
ng-class="{'fade-in-top no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.formats, format)}"
6+
ng-class="{'no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.formats, format)}"
77
ng-style="{'animation-delay': 0.03 * ($index+1) + 's'}">
88
<div class="tile-image" ng-style="{'background-image': 'url(/assets/img/formats/' + format.value + '.jpg),
99
linear-gradient(

src/app/pages/lobby/create/step-league.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
md-colspan="12" md-rowspan="2"
33
ng-repeat="league in lobbyCreate.leagues.options | LobbyCreateOptionFilter:'leagues':lobbyCreate.searchString"
44
ng-click="lobbyCreate.select(lobbyCreate.leagues, league)"
5-
ng-class="{'fade-in-top no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.leagues, league)}"
5+
ng-class="{'no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.leagues, league)}"
66
ng-style="{'animation-delay': 0.03 * ($index+1) + 's'}">
77
<div class="tile-text">
88
<h2>{{::league.title}}</h2>

src/app/pages/lobby/create/step-map.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
md-colspan="{{map.important ? 6 : 6}}" md-rowspan="{{map.important ? 4 : 2}}"
33
ng-repeat="map in lobbyCreate.maps.options | LobbyCreateOptionFilter:'maps':lobbyCreate.searchString"
44
ng-click="lobbyCreate.select(lobbyCreate.maps, map)"
5-
ng-class="{'fade-in-top no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.maps, map)}"
5+
ng-class="{'no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.maps, map)}"
66
ng-style="{'animation-delay': 0.03 * ($index+1) + 's'}">
77
<div class="tile-image" ng-style="{'background-image': 'url(/assets/img/maps/lobby-create/' + map.value + '.jpg)'}"></div>
88
<div class="tile-text">

src/app/pages/lobby/create/wizard-steps.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function () {
22
'use strict';
33

4-
angular.module('tf2stadium')
4+
angular.module('tf2stadium.controllers')
55
.controller('WizardStepsController', WizardStepsController);
66

77
/** @ngInject */

src/app/pages/lobby/list/header.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function () {
22
'use strict';
33

4-
angular.module('tf2stadium')
4+
angular.module('tf2stadium.controllers')
55
.controller('LobbyListHeaderController', LobbyListHeaderController);
66

77
/** @ngInject */

0 commit comments

Comments
 (0)