diff --git a/horizon/static/auth/login/login.module.js b/horizon/static/auth/login/login.module.js index f205df02f8..eb38419a58 100644 --- a/horizon/static/auth/login/login.module.js +++ b/horizon/static/auth/login/login.module.js @@ -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); + } })(); diff --git a/horizon/static/auth/login/login.module.spec.js b/horizon/static/auth/login/login.module.spec.js new file mode 100644 index 0000000000..c237bdac59 --- /dev/null +++ b/horizon/static/auth/login/login.module.spec.js @@ -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/'); + }]) + ); + }); + +})(); diff --git a/horizon/static/auth/login/login.regular.mock.html b/horizon/static/auth/login/login.regular.mock.html new file mode 100644 index 0000000000..3ab996e4e8 --- /dev/null +++ b/horizon/static/auth/login/login.regular.mock.html @@ -0,0 +1,7 @@ +
+

Some help text.

+
+
+
+
+
diff --git a/horizon/static/auth/login/login.spec.js b/horizon/static/auth/login/login.spec.js index f20825fb4b..763808ffe7 100644 --- a/horizon/static/auth/login/login.spec.js +++ b/horizon/static/auth/login/login.spec.js @@ -19,37 +19,19 @@ describe('hzLoginFinder', function() { - var $compile, $rootScope, $timeout; - - var webssoMarkup = - '
' + - '

Some help text.

' + - '
' + - '
' + - '' + - '
' + - '
' + - '
' + - '
' + - '
'; - - var regularMarkup = - '
' + - '

Some help text.

' + - '
' + - '
' + - '
' + - '
' + - '
'; + 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 diff --git a/horizon/static/auth/login/login.websso.mock.html b/horizon/static/auth/login/login.websso.mock.html new file mode 100644 index 0000000000..277474d930 --- /dev/null +++ b/horizon/static/auth/login/login.websso.mock.html @@ -0,0 +1,13 @@ +
+

Some help text.

+
+
+ +
+
+
+
+