1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 10:39:25 +02:00

- Finally, most of the unit tests now passes (resolving dependencies also).

- Shims now exports angular module name, however some of them clash with the original.
This commit is contained in:
Gunther Brunner 2014-08-21 22:04:19 +09:00
parent e78c7572e1
commit 743f8becd6
96 changed files with 245 additions and 235 deletions

View file

@ -4,16 +4,14 @@ require.ensure([], function (require) {
require('angular-route')
require('angular-touch')
require('angular-gettext')
require('ng-file-upload')
require('angular-hotkeys')
angular.module('app', [
'ngRoute',
'ngTouch',
'gettext',
require('gettext').name,
'angularFileUpload',
'cfp.hotkeys',
require('angular-hotkeys').name,
require('./layout').name,
require('./device-list').name,
require('./control-panes').name,

View file

@ -1,11 +1,5 @@
describe('AdminModeService', function() {
beforeEach(module('stf.admin-mode'));
it('should ...', inject(function(AdminModeService) {
//expect(AdminModeService.doSomething()).toEqual('something');
}));
beforeEach(angular.mock.module(require('./').name));
})

View file

@ -1,6 +1,6 @@
describe('angularDraggabilly', function () {
beforeEach(module('stf.angular-draggabilly'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('angularPackery', function () {
beforeEach(module('stf.angular-packery'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('basicMode', function () {
beforeEach(module('stf.basic-mode'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,10 +1,10 @@
describe('BrowserInfo', function() {
beforeEach(module('stf.browser-info'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(GuestDeviceService) {
it('should ...', inject(function(BrowserInfo) {
//expect(GuestDeviceService.doSomething()).toEqual('something');
//expect(BrowserInfo.doSomething()).toEqual('something');
}));

View file

@ -1,6 +1,6 @@
describe('badgeIcon', function () {
beforeEach(module('stf.badge-icon'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('blurElement', function () {
beforeEach(module('stf.blur-element'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('counter', function () {
beforeEach(module('stf.counter'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('enableAutofill', function () {
beforeEach(module('stf.enable-autofill'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('fallbackImage', function () {
beforeEach(module('stf.fallback-image'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('filterButton', function () {
beforeEach(module('stf.filter-button'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('focusElement', function () {
beforeEach(module('stf.focus-element'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('iconInsideInput', function () {
beforeEach(module('stf.icon-inside-input'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('includeCached', function () {
beforeEach(module('stf.include-cached'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -3,4 +3,5 @@
require('./modals.css')
module.exports = angular.module('stf.modals.common', [
require('ui-bootstrap').name
])

View file

@ -1,6 +1,6 @@
describe('VersionUpdateService', function() {
beforeEach(module('stf.version-update'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(VersionUpdateService) {

View file

@ -1,6 +1,6 @@
describe('FatalMessageService', function() {
beforeEach(module('stf.fatal-message'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(FatalMessageService) {

View file

@ -1,4 +1,7 @@
require('angular-route')
module.exports = angular.module('stf.fatal-message', [
require('stf/common-ui/modals/common').name
require('stf/common-ui/modals/common').name,
'ngRoute'
])
.factory('FatalMessageService', require('./fatal-message-service'))

View file

@ -1,6 +1,6 @@
describe('VersionUpdateService', function() {
beforeEach(module('stf.version-update'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(VersionUpdateService) {

View file

@ -1,10 +1,11 @@
describe('VersionUpdateService', function() {
beforeEach(module('stf.version-update'));
beforeEach(angular.mock.module(require('ui-bootstrap').name));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(VersionUpdateService) {
//expect(FatalMessageService.doSomething()).toEqual('something');
//expect(VersionUpdateService.doSomething()).toEqual('something');
}));

View file

@ -1,6 +1,6 @@
describe('nativeAutocomplete', function () {
beforeEach(module('stf.native-autocomplete'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('ngEnter', function () {
beforeEach(module('stf.ng-enter'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('niceTabs', function () {
beforeEach(module('stf.nice-tabs'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('refreshPage', function () {
beforeEach(module('stf.refresh-page'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('textFocusSelect', function () {
beforeEach(module('stf.text-focus-select'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('tooltips', function () {
beforeEach(module('stf.tooltips'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('FilterStringService', function() {
beforeEach(module('stf.filter-string'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(FilterStringService) {

View file

@ -1,6 +1,6 @@
describe('imageOnload', function () {
beforeEach(module('stf.image-onload'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('KeycodesService', function() {
beforeEach(module('stf.keycodes'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(KeycodesService) {

View file

@ -1,6 +1,6 @@
describe('landscape', function () {
beforeEach(module('stf.landscape'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('logcatTable', function () {
beforeEach(module('stf.logcat-table'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,4 +1,5 @@
module.exports = angular.module('stf.logcat', [
require('stf/filter-string').name
require('stf/filter-string').name,
require('stf/socket').name
])
.factory('LogcatService', require('./logcat-service'))

View file

@ -1,6 +1,6 @@
describe('LogcatService', function() {
beforeEach(module('stf.logcat'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(LogcatService) {

View file

@ -1,6 +1,6 @@
describe('navMenu', function () {
beforeEach(module('stf.nav-menu'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,4 +1,3 @@
module.exports = angular.module('stf.port-forwarding', [
])
.factory('PortForwardingService', require('./port-forwarding-service'))

View file

@ -1,7 +1,6 @@
module.exports = function PortForwardingServiceFactory() {
module.exports = function () {
var service = {}
return service
}

View file

@ -1,9 +1,9 @@
describe('PortForwardingService', function() {
beforeEach(module('stf.port-forwarding'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(PortForwardingService) {
expect(1).toBe(1)
//expect(PortForwardingService.doSomething()).toEqual('something');
}));

View file

@ -1,4 +1,5 @@
require('angular-hotkeys')
module.exports = angular.module('stf.scoped-hotkeys', [
'cfp.hotkeys'
])
.factory('ScopedHotkeysService', require('./scoped-hotkeys-service'))

View file

@ -1,6 +1,6 @@
describe('ScopedHotkeysService', function() {
beforeEach(module('stf.scoped-hotkeys'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(ScopedHotkeysService) {

View file

@ -1,6 +1,6 @@
describe('screenKeyboard', function () {
beforeEach(module('stf.screen-keyboard'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('screenTouch', function () {
beforeEach(module('stf.screen-touch'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,2 +1,4 @@
module.exports = angular.module('stf/settings', [])
module.exports = angular.module('stf/settings', [
require('stf/user').name
])
.factory('SettingsService', require('./settings-service'))

View file

@ -1,3 +1,5 @@
module.exports = angular.module('stf/socket', [
//TODO: Refactor version update out to its own Ctrl
require('stf/common-ui/modals/version-update').name
])
.factory('socket', require('./socket-service'))

View file

@ -2,8 +2,11 @@ var io = require('socket.io')
module.exports = function SocketFactory($rootScope, VersionUpdateService) {
/*globals APPSTATE:false*/
//TODO: Refactor APPSTATE to AppStateConstant
var websocketUrl = APPSTATE && APPSTATE.config &&
APPSTATE.config.websocketUrl ? APPSTATE.config.websocketUrl : ''
var socket = io(APPSTATE.config.websocketUrl, {
var socket = io(websocketUrl, {
reconnection: false
, transports: ['websocket']
})

View file

@ -1,2 +0,0 @@
module.exports = angular.module('stf.sprintf', [])
.filter('sprintf', require('./sprintf-filter'))

View file

@ -1,14 +0,0 @@
module.exports = function sprintfFilter() {
function parse(str) {
var args = [].slice.call(arguments, 1)
var i = 0
return str.replace(/%s/g, function () {
return args[i++]
})
}
return function (input) {
return parse(input, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])
}
}

View file

@ -1,13 +0,0 @@
describe('sprintf', function() {
beforeEach(module('stf.sprintf'));
it('should ...', inject(function($filter) {
var filter = $filter('sprintf');
expect(filter('input')).toEqual('output');
}));
});

View file

@ -1,6 +1,6 @@
describe('textHistory', function () {
beforeEach(module('stf.text-history'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('TimelineService', function() {
beforeEach(module('stf.timeline'));
beforeEach(angular.mock.module(require('./').name));
it('should ...', inject(function(TimelineService) {

View file

@ -1,6 +1,6 @@
describe('timelineMessage', function () {
beforeEach(module('stf.timeline-message'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('timelines', function () {
beforeEach(module('stf.timelines'));
beforeEach(angular.mock.module(require('./').name));
var scope, compile;

View file

@ -1,6 +1,6 @@
describe('ActivityCtrl', function () {
beforeEach(module('stf.activity'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,7 @@
require('./activity.css')
module.exports = angular.module('stf.activity', [
require('gettext').name,
require('stf/common-ui').name,
require('stf/timeline').name
])

View file

@ -1,6 +1,6 @@
describe('AdvancedCtrl', function () {
beforeEach(module('stf.advanced'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,12 +1,12 @@
describe('InputCtrl', function () {
describe('InputAdvancedCtrl', function () {
beforeEach(module('stf.input'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('InputCtrl', {$scope: scope});
ctrl = $controller('InputAdvancedCtrl', {$scope: scope});
}));
it('should ...', inject(function () {

View file

@ -1,12 +1,12 @@
describe('InputCtrl', function () {
describe('MaintenanceCtrl', function () {
beforeEach(module('stf.input'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('InputCtrl', {$scope: scope});
ctrl = $controller('MaintenanceCtrl', {$scope: scope});
}));
it('should ...', inject(function () {

View file

@ -1,6 +1,8 @@
require('./port-forwarding.css')
module.exports = angular.module('stf.port-forwarding', [
require('stf/common-ui/table').name,
require('stf/settings').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put(

View file

@ -1,6 +1,6 @@
describe('PortForwardingCtrl', function () {
beforeEach(module('stf.port-forwarding'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('RunJsCtrl', function () {
beforeEach(module('stf.run-js'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('UsbCtrl', function () {
beforeEach(module('stf.usb'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -2,19 +2,22 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) {
$scope.wifiEnabled = true
var getWifiStatus = function () {
if ($scope.control) {
$scope.control.getWifiStatus().then(function (result) {
$scope.$apply(function () {
$scope.wifiEnabled = (result.lastData === 'wifi_enabled')
})
})
}
}
getWifiStatus()
$scope.toggleWifi = function () {
if ($scope.control) {
$scope.control.setWifiEnabled(!$scope.wifiEnabled)
$scope.wifiEnabled = !$scope.wifiEnabled
$timeout(getWifiStatus, 500)
}
}
}

View file

@ -1,6 +1,6 @@
describe('DeviceSettingsCtrl', function () {
beforeEach(module('stf.device-settings'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -2,7 +2,8 @@ require('./store-account.css')
require('angular-ladda')
module.exports = angular.module('stf.store-account', [
'angular-ladda'
'angular-ladda',
require('stf/common-ui/table').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/automation/store-account/store-account.jade',

View file

@ -40,6 +40,7 @@ module.exports = function StoreAccountCtrl($scope, ngTableParams, $timeout) {
function getAccounts() {
var storeAccountType = $scope.deviceAppStores[$scope.currentAppStore].package
if ($scope.control) {
$scope.control.getAccounts(storeAccountType).then(function (result) {
$scope.$apply(function () {
$scope.accountsList = result.body
@ -47,6 +48,7 @@ module.exports = function StoreAccountCtrl($scope, ngTableParams, $timeout) {
})
})
}
}
getAccounts()

View file

@ -1,6 +1,6 @@
describe('StoreAccountCtrl', function () {
beforeEach(module('stf.store-account'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('CpuCtrl', function () {
beforeEach(module('stf.cpu'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('ClipboardCtrl', function () {
beforeEach(module('stf.clipboard'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -3,7 +3,8 @@ require('./clipboard.css')
require('angular-elastic')
module.exports = angular.module('stf.clipboard', [
'monospaced.elastic'
'monospaced.elastic',
require('gettext').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/dashboard/clipboard/clipboard.jade',

View file

@ -1,6 +1,6 @@
describe('DashboardCtrl', function () {
beforeEach(module('stf.dashboard'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('NavigationCtrl', function () {
beforeEach(module('stf.navigation'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('RemoteDebugCtrl', function () {
beforeEach(module('stf.remote-debug'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,7 +1,8 @@
require('./shell.css')
module.exports = angular.module('stf.shell', [
require('stf/common-ui').name
require('stf/common-ui').name,
require('gettext').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/dashboard/shell/shell.jade',

View file

@ -1,6 +1,6 @@
describe('ShellCtrl', function () {
beforeEach(module('stf.shell'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -4,7 +4,9 @@ module.exports = function ActivitiesCtrl($scope) {
$scope.selectedAction = ''
$scope.selectedCategory = ''
$scope.selectedData = ''
$scope.selectedPackageName = $scope.installation.manifest.package || ''
$scope.selectedPackageName = $scope.installation &&
$scope.installation.manifest && $scope.installation.manifest.package ?
$scope.installation.manifest.package : ''
$scope.selectedActivityName = ''
$scope.activityActions = []

View file

@ -1,6 +1,6 @@
describe('ActivitiesCtrl', function () {
beforeEach(module('stf.activities'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -2,7 +2,8 @@ require('./upload.css')
module.exports = angular.module('stf.upload', [
require('stf/common-ui/tree').name,
require('./activities').name
require('./activities').name,
require('stf/settings').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/dashboard/upload/upload.jade',

View file

@ -1,6 +1,6 @@
describe('UploadCtrl', function () {
beforeEach(module('stf.upload'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -3,8 +3,7 @@ require('./device-control.css')
module.exports = angular.module('device-control', [
require('stf/device').name,
require('stf/control').name,
require('stf/screen').name,
require('stf/sprintf').name
require('stf/screen').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/device-control/device-control.jade',

View file

@ -5,13 +5,14 @@ module.exports = function InfoCtrl($scope, LightboxImageService) {
LightboxImageService.open(title, enhancedPhoto800)
}
var getSdStatus = function () {
if ($scope.control) {
$scope.control.getSdStatus().then(function (result) {
$scope.$apply(function () {
$scope.sdCardMounted = (result.lastData === 'sd_mounted')
})
})
}
}
getSdStatus()
}

View file

@ -1,6 +1,6 @@
describe('InfoCtrl', function () {
beforeEach(module('stf.info'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('InspectCtrl', function () {
beforeEach(module('stf.inspect'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('LogsCtrl', function () {
beforeEach(module('stf.logs'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,6 +1,6 @@
describe('ResourcesCtrl', function () {
beforeEach(module('stf.resources'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,7 +1,8 @@
require('./screenshots.css')
module.exports = angular.module('stf.screenshots', [
require('stf/image-onload').name
require('stf/image-onload').name,
require('stf/settings').name
])
.run(["$templateCache", function ($templateCache) {
$templateCache.put('control-panes/screenshots/screenshots.jade',

View file

@ -1,6 +1,6 @@
describe('ScreenshotsCtrl', function () {
beforeEach(module('stf.screenshots'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -1,10 +1,5 @@
require('se7en-bootstrap-3')
require('angular-bootstrap')
require('angular-borderlayout')
require('./cursor.css')
require('./stf-se7en.css')
require('./small.css')
@ -14,8 +9,8 @@ module.exports = angular.module('layout', [
require('../settings/language').name,
require('stf/landscape').name,
require('stf/basic-mode').name,
'ui.bootstrap',
'fa.directive.borderLayout',
require('ui-bootstrap').name,
require('angular-borderlayout').name,
require('stf/common-ui').name,
require('stf/socket/socket-state').name,
require('stf/browser-info').name

View file

@ -1,6 +1,6 @@
describe('MenuCtrl', function () {
beforeEach(module('stf.menu'));
beforeEach(angular.mock.module(require('./').name));
var scope, ctrl;

View file

@ -14,7 +14,7 @@ module.exports = function (config) {
preprocessors: {
'helpers/**/*.js': ['webpack'],
'../app/**/*.js': ['webpack']
'../**/*.js': ['webpack']
},
exclude: [

View file

@ -1,3 +1,7 @@
require('angular-borderlayout/src/borderLayout.js')
require('angular-borderlayout/src/borderLayout.css')
require('./style.css')
module.exports = {
name: 'fa.directive.borderLayout'
}

View file

@ -1,3 +1,7 @@
require('angular-hotkeys/build/hotkeys.css')
//require('./hotkeys.css')
require('angular-hotkeys/build/hotkeys.js')
module.exports = {
name: 'cfp.hotkeys'
}

View file

@ -2,3 +2,7 @@ require('ladda/dist/ladda-themeless.min.css')
window.Ladda = require('ladda/js/ladda')
require('angular-ladda/src/angular-ladda')
module.exports = {
Ladda: window.Ladda,
name: 'angular-ladda'
}

View file

@ -0,0 +1,5 @@
require('angular-gettext')
module.exports = {
name: 'gettext'
}

View file

@ -1,2 +1,6 @@
require('ng-file-upload/angular-file-upload-html5-shim')
require('ng-file-upload/angular-file-upload')
module.exports = {
name: 'angularFileUpload'
}

View file

@ -0,0 +1,5 @@
require('script!angular-bootstrap/ui-bootstrap-tpls')
module.exports = {
name: 'ui.bootstrap'
}

View file

@ -56,8 +56,7 @@ module.exports = {
{ test: /angular-growl\.js/, loader: 'imports?angular=angular'},
{ test: /oboe-browser\.js/, loader: 'imports?define=>false!exports?oboe'},
{ test: /uuid\.js/, loader: 'imports?require=>undefined'},
{ test: /localforage\.js/, loader: 'script'},
{ test: /ui-bootstrap-tpls\.js/, loader: 'script'},
//{ test: /ui-bootstrap-tpls\.js/, loader: 'script'},
{ test: /dialogs\.js/, loader: 'script'},
{ test: /bluebird\.js/, loader: 'imports?require=>undefined'}
],