mirror of
https://github.com/openstf/stf
synced 2025-10-06 12:00:08 +02:00
Adding tests for controllers.
This commit is contained in:
parent
a0efad0ecf
commit
69875574d0
5 changed files with 24 additions and 15 deletions
|
@ -1,6 +1,4 @@
|
||||||
module.exports = function ShellCtrl($scope, gettext) {
|
module.exports = function ShellCtrl($scope) {
|
||||||
// TODO: implement multiple devices
|
|
||||||
// $scope.results = []
|
|
||||||
$scope.result = null
|
$scope.result = null
|
||||||
|
|
||||||
$scope.referenceUrl = '/#!/help/shell'
|
$scope.referenceUrl = '/#!/help/shell'
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
describe('ShellCtrl', function () {
|
describe('ShellCtrl', function () {
|
||||||
|
|
||||||
beforeEach(angular.mock.module(require('./').name));
|
beforeEach(angular.mock.module(require('./').name))
|
||||||
|
|
||||||
var scope, ctrl;
|
var scope, ctrl
|
||||||
|
|
||||||
beforeEach(inject(function ($rootScope, $controller) {
|
beforeEach(inject(function ($rootScope, $controller) {
|
||||||
scope = $rootScope.$new();
|
scope = $rootScope.$new()
|
||||||
ctrl = $controller('ShellCtrl', {$scope: scope});
|
ctrl = $controller('ShellCtrl', {$scope: scope})
|
||||||
}));
|
}))
|
||||||
|
|
||||||
it('should ...', inject(function () {
|
it('should have a reference url', inject(function () {
|
||||||
expect(1).toEqual(1);
|
expect(scope.referenceUrl).toEqual('/#!/help/shell')
|
||||||
|
}))
|
||||||
|
|
||||||
}));
|
it('should clear the results', inject(function () {
|
||||||
|
scope.result = ['result']
|
||||||
|
scope.run('clear')
|
||||||
|
expect(scope.result).toBe(null)
|
||||||
|
expect(scope.data).toBe('')
|
||||||
|
expect(scope.command).toBe('')
|
||||||
|
}))
|
||||||
|
|
||||||
});
|
})
|
||||||
|
|
|
@ -21,7 +21,9 @@ module.exports = function LogsCtrl($scope, LogcatService) {
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onbeforeunload = function () {
|
window.onbeforeunload = function () {
|
||||||
$scope.control.stopLogcat()
|
if ($scope.control) {
|
||||||
|
$scope.control.stopLogcat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.clear = function () {
|
$scope.clear = function () {
|
||||||
|
|
|
@ -14,7 +14,8 @@ html
|
||||||
body(ng-app='app', ng-cloak).bg-1.fill-height
|
body(ng-app='app', ng-cloak).bg-1.fill-height
|
||||||
div(ng-controller='LayoutCtrl', basic-mode, admin-mode, landscape).fill-height
|
div(ng-controller='LayoutCtrl', basic-mode, admin-mode, landscape).fill-height
|
||||||
.pane-top(fa-pane).fill-height
|
.pane-top(fa-pane).fill-height
|
||||||
.pane-top-bar(fa-pane, pane-id='menu', pane-anchor='north', pane-size='44px', pane-min='44px', pane-max='44px', pane-handle='')
|
.pane-top-bar(fa-pane, pane-id='menu', pane-anchor='north', pane-size='44px',
|
||||||
|
pane-min='44px', pane-max='44px', pane-handle='')
|
||||||
div(ng-include='"menu.jade"')
|
div(ng-include='"menu.jade"')
|
||||||
|
|
||||||
.pane-center(fa-pane, pane-id='main', pane-anchor='center').fill-height
|
.pane-center(fa-pane, pane-id='main', pane-anchor='center').fill-height
|
||||||
|
|
|
@ -63,7 +63,8 @@ module.exports = function (config) {
|
||||||
|
|
||||||
// Start these browsers, currently available:
|
// Start these browsers, currently available:
|
||||||
// Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS, IE
|
// Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS, IE
|
||||||
browsers: ['PhantomJS'],
|
browsers: ['Chrome'],
|
||||||
|
//browsers: ['PhantomJS'],
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
require('karma-jasmine'),
|
require('karma-jasmine'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue