Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular test fix #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions generated/browser/js/app.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
'use strict';
window.app = angular.module('FullstackGeneratedApp', ['fsaPreBuilt', 'ui.router', 'ui.bootstrap', 'ngAnimate']);

app.config(function ($urlRouterProvider, $locationProvider) {
// This turns off hashbang urls (/#about) and changes it to something normal (/about)
$locationProvider.html5Mode(true);
// If we go to a URL that ui-router doesn't have registered, go to the "/" url.
$urlRouterProvider.otherwise('/');
// Trigger page refresh when accessing an OAuth route
$urlRouterProvider.when('/auth/:provider', function () {
window.location.reload();
if (!window.KARMA_TESTING) {
app.config(function ($urlRouterProvider, $locationProvider) {
// This turns off hashbang urls (/#about) and changes it to something normal (/about)
$locationProvider.html5Mode(true);
// If we go to a URL that ui-router doesn't have registered, go to the "/" url.
$urlRouterProvider.otherwise('/');
// Trigger page refresh when accessing an OAuth route
$urlRouterProvider.when('/auth/:provider', function () {
window.location.reload();
});
});
});
}

// This app.run is for listening to errors broadcasted by ui-router, usually originating from resolves
app.run(function ($rootScope) {
Expand Down
5 changes: 5 additions & 0 deletions generated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@
"socket.io": "^1.3.4",
"socket.io-client": "^1.3.5",
"supertest": "^0.15.0"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/fullstackacademy/fsg.git"
}
}
4 changes: 4 additions & 0 deletions generated/tests/browser/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// global variables defined here will be accessible in your browser code,
// but only while testing.

window.KARMA_TESTING = true;
1 change: 1 addition & 0 deletions generated/tests/browser/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function (config) {
'node_modules/angular-ui-bootstrap/ui-bootstrap.js',
'node_modules/angular-ui-bootstrap/ui-bootstrap-tpls.js',
'node_modules/socket.io-client/socket.io.js',
'tests/browser/globals.js',
'public/main.js',
'node_modules/sinon/pkg/sinon.js',
'node_modules/angular-mocks/angular-mocks.js',
Expand Down