Fix eslint errors on the login controller
Moved the login controller to its own spec file. Changed the Login Template to use the correct controller name. Change-Id: I6739d4607adffbfd121af26c72dc3edb7398865f Partially-Implements: blueprint jscs-cleanup
This commit is contained in:
parent
a21329d98a
commit
b05adbb82a
|
@ -16,16 +16,18 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('horizon.auth.login')
|
||||
angular
|
||||
.module('horizon.auth.login')
|
||||
|
||||
/**
|
||||
* @ngdoc hzLoginCtrl
|
||||
* @ngdoc hzLoginController
|
||||
* @description
|
||||
* controller for determining which
|
||||
* authentication method user picked.
|
||||
*/
|
||||
.controller('hzLoginCtrl', function($scope) {
|
||||
$scope.auth_type = 'credentials';
|
||||
.controller('hzLoginController', function() {
|
||||
var vm = this;
|
||||
vm.auth_type = 'credentials';
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Copyright 2015 ThoughtWorks Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License. You may obtain
|
||||
* a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
describe('hzLoginController', function() {
|
||||
var $controller;
|
||||
beforeEach(module('horizon.auth.login'));
|
||||
beforeEach(inject(function(_$controller_) {
|
||||
$controller = _$controller_;
|
||||
}));
|
||||
|
||||
describe('should set auth_type', function() {
|
||||
it('should initialize to credentials', function() {
|
||||
var controller = $controller('hzLoginController');
|
||||
expect(controller.auth_type).toEqual('credentials');
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
|
@ -17,22 +17,6 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
describe('hzLoginCtrl', function() {
|
||||
var $controller;
|
||||
beforeEach(module('horizon.auth.login'));
|
||||
beforeEach(inject(function(_$controller_) {
|
||||
$controller = _$controller_;
|
||||
}));
|
||||
|
||||
describe('$scope.auth_type', function() {
|
||||
it('should initialize to credentials', function() {
|
||||
var scope = {};
|
||||
$controller('hzLoginCtrl', { $scope: scope });
|
||||
expect(scope.auth_type).toEqual('credentials');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('hzLoginFinder', function() {
|
||||
|
||||
var $compile, $rootScope, $timeout;
|
||||
|
@ -99,7 +83,7 @@
|
|||
userInput = element.find("#id_username").parents('.form-group');
|
||||
passwordInput = element.find("#id_password").parents('.form-group');
|
||||
helpText = element.find('#help_text');
|
||||
$rootScope.$digest();
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should not contain auth_type select input', function() {
|
||||
|
@ -128,7 +112,7 @@
|
|||
userInput = element.find("#id_username").parents('.form-group');
|
||||
passwordInput = element.find("#id_password").parents('.form-group');
|
||||
helpText = element.find('#help_text');
|
||||
$rootScope.$digest();
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should contain auth_type select input', function() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block modal_class %}login {% if hide %}modal{% endif %}{% endblock %}
|
||||
|
||||
{% block form_action %}{% url 'login' %}{% endblock %}
|
||||
{% block ng_controller %}hzLoginCtrl{% endblock %}
|
||||
{% block ng_controller %}hzLoginController{% endblock %}
|
||||
{% block autocomplete %}{{ HORIZON_CONFIG.password_autocomplete }}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
|
|
Loading…
Reference in New Issue