Fix the selenium LazyLoadedTabsTests
These tests were broken when we removed Javascript loading from the test base.html during the ngReorg. A minimal set of Javascript and configuration has been re-added. Also note that the loadAngular function from the tech-debt utils service has been moved into the only place it's used to reduce configuration overhead. Partial-Bug: #1475387 Change-Id: If5472e93d7941608479b430512fc79c1fdb3407c
This commit is contained in:
parent
3915c85565
commit
7a3d5be9bc
@ -25,8 +25,7 @@
|
||||
var service = {
|
||||
capitalize: capitalize,
|
||||
humanizeNumbers: humanizeNumbers,
|
||||
truncate: truncate,
|
||||
loadAngular: loadAngular
|
||||
truncate: truncate
|
||||
};
|
||||
|
||||
return service;
|
||||
@ -67,13 +66,6 @@
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
function loadAngular(element) {
|
||||
try {
|
||||
$compile(element)($rootScope);
|
||||
$rootScope.$apply();
|
||||
} catch (err) {}
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
@ -75,26 +75,5 @@
|
||||
toBe(ellipsis);
|
||||
});
|
||||
});
|
||||
|
||||
describe('loadAngular', function () {
|
||||
var rootScope, element;
|
||||
|
||||
beforeEach(function () {
|
||||
element = angular.element('<div>');
|
||||
|
||||
angular.mock.inject(function ($injector) {
|
||||
rootScope = $injector.get('$rootScope');
|
||||
});
|
||||
spyOn(rootScope, '$apply');
|
||||
});
|
||||
|
||||
it('should call a compile and apply ', function () {
|
||||
hzUtils.loadAngular(element);
|
||||
//checks the use of apply function
|
||||
expect(rootScope.$apply).toHaveBeenCalled();
|
||||
//checks the use of compile function
|
||||
expect(element.hasClass('ng-scope')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
@ -305,7 +305,14 @@ horizon.addInitFunction(horizon.modals.init = function() {
|
||||
horizon.modals.addModalInitFunction(function(modal) {
|
||||
horizon.datatables.validate_button($(modal).find(".table_wrapper > form"));
|
||||
});
|
||||
horizon.modals.addModalInitFunction(horizon.utils.loadAngular);
|
||||
|
||||
function loadAngular(element) {
|
||||
try {
|
||||
$compile(element)($rootScope);
|
||||
$rootScope.$apply();
|
||||
} catch (err) {}
|
||||
}
|
||||
horizon.modals.addModalInitFunction(loadAngular);
|
||||
|
||||
// Load modals for ajax-modal links.
|
||||
$document.on('click', '.ajax-modal', function (evt) {
|
||||
|
@ -105,6 +105,7 @@ TEMPLATE_LOADERS = (
|
||||
)
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
WEBROOT = '/'
|
||||
|
||||
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
|
||||
|
||||
|
@ -3,6 +3,100 @@
|
||||
just testing Django templating - no Javascript.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
window.STATIC_URL = '{{ STATIC_URL }}';
|
||||
window.WEBROOT = '{{ WEBROOT }}';
|
||||
</script>
|
||||
<script src='{{ STATIC_URL }}horizon/lib/jquery/jquery.js' type='text/javascript' charset="utf-8"></script>
|
||||
<script src='{{ STATIC_URL }}horizon/lib/jquery/jquery-migrate.js' type='text/javascript' charset="utf-8"></script>
|
||||
<script src="{{ STATIC_URL }}horizon/lib/jquery/jquery.tablesorter.js"></script>
|
||||
|
||||
<script src='{{ STATIC_URL }}horizon/js/horizon.js' type='text/javascript' charset='utf-8'></script>
|
||||
|
||||
<script type='text/javascript' charset='utf-8'>
|
||||
(function (global) {
|
||||
'use strict';
|
||||
|
||||
// make translation info available on client
|
||||
horizon.languageCode = '{{ LANGUAGE_CODE }}';
|
||||
horizon.languageBidi = '{{ LANGUAGE_BIDI }}';
|
||||
horizon.datepickerLocale = '{{ DATEPICKER_LOCALE }}';
|
||||
|
||||
/* Load angular modules extensions list before we include angular/horizon.js */
|
||||
global.horizonPlugInModules = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};
|
||||
|
||||
/* Storage for backend configuration variables which the frontend
|
||||
* should be aware of.
|
||||
*/
|
||||
var conf = horizon.conf;
|
||||
conf.static_url = "{{ STATIC_URL }}";
|
||||
conf.ajax = {
|
||||
queue_limit: {{ HORIZON_CONFIG.ajax_queue_limit|default:"null" }}
|
||||
};
|
||||
conf.auto_fade_alerts = {
|
||||
delay: {{ HORIZON_CONFIG.auto_fade_alerts.delay|default:"3000" }},
|
||||
fade_duration: {{ HORIZON_CONFIG.auto_fade_alerts.fade_duration|default:"1500" }},
|
||||
types: {{ HORIZON_CONFIG.auto_fade_alerts.types|default:"[]"|safe }}
|
||||
};
|
||||
conf.disable_password_reveal =
|
||||
{{ HORIZON_CONFIG.disable_password_reveal|yesno:"true,false" }};
|
||||
conf.spinner_options = {
|
||||
inline: {
|
||||
lines: 10,
|
||||
length: 5,
|
||||
width: 2,
|
||||
radius: 3,
|
||||
color: '#000',
|
||||
speed: 0.8,
|
||||
trail: 50,
|
||||
zIndex: 100
|
||||
},
|
||||
modal: {
|
||||
lines: 10,
|
||||
length: 15,
|
||||
width: 4,
|
||||
radius: 10,
|
||||
color: '#000',
|
||||
speed: 0.8,
|
||||
trail: 50
|
||||
},
|
||||
line_chart: {
|
||||
lines: 10,
|
||||
length: 15,
|
||||
width: 4,
|
||||
radius: 11,
|
||||
color: '#000',
|
||||
speed: 0.8,
|
||||
trail: 50
|
||||
}
|
||||
};
|
||||
|
||||
// minimal cookie store implementation for testing
|
||||
horizon.test_cookies = {};
|
||||
horizon.cookies = {
|
||||
put: function (key, value) { horizon.test_cookies[key] = value; },
|
||||
getRaw: function (key) { return horizon.test_cookies[key]; },
|
||||
get: function (key) { return horizon.test_cookies[key]; }
|
||||
};
|
||||
|
||||
// Call init on DOM ready.
|
||||
$(document).ready(horizon.init);
|
||||
})(this);
|
||||
</script>
|
||||
|
||||
{% include "horizon/_script_i18n.html" %}
|
||||
|
||||
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"></script>
|
||||
<script src="{{ STATIC_URL }}horizon/lib/spin.js"></script>
|
||||
<script src="{{ STATIC_URL }}horizon/lib/spin.jquery.js"></script>
|
||||
|
||||
<script src='{{ STATIC_URL }}horizon/js/horizon.modals.js'></script>
|
||||
<script src='{{ STATIC_URL }}horizon/js/horizon.tables.js'></script>
|
||||
<script src='{{ STATIC_URL }}horizon/js/horizon.tables_inline_edit.js'></script>
|
||||
<script src='{{ STATIC_URL }}horizon/js/horizon.tabs.js'></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{% block sidebar %}
|
||||
|
Loading…
Reference in New Issue
Block a user