Merge "Moving inline html code out of login.spec.js"
This commit is contained in:
commit
3915c85565
@ -16,6 +16,24 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('horizon.auth.login', []);
|
||||
angular
|
||||
.module('horizon.auth.login', [], config);
|
||||
|
||||
config.$inject = [
|
||||
'$provide',
|
||||
'$windowProvider'
|
||||
];
|
||||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* In the config function:
|
||||
* - define constant `horizon.auth.login.basePath` as the
|
||||
* base path for auth login code.
|
||||
*/
|
||||
function config($provide, $windowProvider) {
|
||||
var path = $windowProvider.$get().STATIC_URL + 'auth/login/';
|
||||
$provide.constant('horizon.auth.login.basePath', path);
|
||||
}
|
||||
|
||||
})();
|
||||
|
37
horizon/static/auth/login/login.module.spec.js
Normal file
37
horizon/static/auth/login/login.module.spec.js
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* 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('horizon.auth.login module', function () {
|
||||
it('should be defined', function () {
|
||||
expect(angular.module('horizon.auth.login')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('horizon.auth.login.basePath', function () {
|
||||
beforeEach(module('horizon.auth.login'));
|
||||
|
||||
it('should be defined and set correctly', inject([
|
||||
'horizon.auth.login.basePath', '$window',
|
||||
function (basePath, $window) {
|
||||
expect(basePath).toBeDefined();
|
||||
expect(basePath).toBe($window.STATIC_URL + 'auth/login/');
|
||||
}])
|
||||
);
|
||||
});
|
||||
|
||||
})();
|
7
horizon/static/auth/login/login.regular.mock.html
Normal file
7
horizon/static/auth/login/login.regular.mock.html
Normal file
@ -0,0 +1,7 @@
|
||||
<form>
|
||||
<p id="help_text">Some help text.</p>
|
||||
<fieldset hz-login-finder>
|
||||
<div class="form-group"><input id="id_username"></div>
|
||||
<div class="form-group"><input id="id_password"></div>
|
||||
</fieldset>
|
||||
</form>
|
@ -19,37 +19,19 @@
|
||||
|
||||
describe('hzLoginFinder', function() {
|
||||
|
||||
var $compile, $rootScope, $timeout;
|
||||
|
||||
var webssoMarkup =
|
||||
'<form>' +
|
||||
'<p id="help_text">Some help text.</p>' +
|
||||
'<fieldset hz-login-finder>' +
|
||||
'<div>' +
|
||||
'<select id="id_auth_type">' +
|
||||
'<option value="credentials">Credentials</option>' +
|
||||
'<option value="oidc">OpenID Connect</option>' +
|
||||
'</select>' +
|
||||
'</div>' +
|
||||
'<div class="form-group"><input id="id_username"></div>' +
|
||||
'<div class="form-group"><input id="id_password"></div>' +
|
||||
'</fieldset>' +
|
||||
'</form>';
|
||||
|
||||
var regularMarkup =
|
||||
'<form>' +
|
||||
'<p id="help_text">Some help text.</p>' +
|
||||
'<fieldset hz-login-finder>' +
|
||||
'<div class="form-group"><input id="id_username"></div>' +
|
||||
'<div class="form-group"><input id="id_password"></div>' +
|
||||
'</fieldset>' +
|
||||
'</form>';
|
||||
var $compile, $rootScope, $timeout, webssoMarkup, regularMarkup;
|
||||
|
||||
beforeEach(module('templates'));
|
||||
beforeEach(module('horizon.auth.login'));
|
||||
beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_) {
|
||||
beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, $injector) {
|
||||
$compile = _$compile_;
|
||||
$rootScope = _$rootScope_;
|
||||
$timeout = _$timeout_;
|
||||
var $templateCache = $injector.get('$templateCache');
|
||||
var basePath = $injector.get('horizon.auth.login.basePath');
|
||||
|
||||
webssoMarkup = $templateCache.get(basePath + 'login.websso.mock.html');
|
||||
regularMarkup = $templateCache.get(basePath + 'login.regular.mock.html');
|
||||
|
||||
jasmine.addMatchers({
|
||||
// jquery show is not consistent across different browsers
|
||||
|
13
horizon/static/auth/login/login.websso.mock.html
Normal file
13
horizon/static/auth/login/login.websso.mock.html
Normal file
@ -0,0 +1,13 @@
|
||||
<form>
|
||||
<p id="help_text">Some help text.</p>
|
||||
<fieldset hz-login-finder>
|
||||
<div>
|
||||
<select id="id_auth_type">
|
||||
<option value="credentials">Credentials</option>
|
||||
<option value="oidc">OpenID Connect</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group"><input id="id_username"></div>
|
||||
<div class="form-group"><input id="id_password"></div>
|
||||
</fieldset>
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user