<!doctype html>

<html>
<head>
    <title>Jasmine Spec Runner</title>

    {% load staticfiles %}
    <link rel="stylesheet" href="{% static 'jasmine-latest/jasmine.css' %}" media="screen">

    {# core files #}
    <script  src="{% static 'jasmine-latest/jasmine.js' %}"></script>
    <script  src="{% static 'jasmine-latest/jasmine-html.js' %}"></script>
    <script  src="{% static 'js/vendor/jasmine-jquery.js' %}"></script>
    <script  src="{% static 'console-runner.js' %}"></script>
    <script  src="{% static 'jasmine.junit_reporter.js' %}"></script>

    {% load compressed %}
    {# static files #}
    {% for url in suite.static_files %}
    <script src="{{ STATIC_URL }}{{ url }}"></script>
    {% endfor %}

    {% compressed_js 'js-test-source' %}

    {# source files #}
    {% for url in suite.js_files %}
    <script src="{{ url }}"></script>
    {% endfor %}


    {# spec files #}
    {% compressed_js 'spec' %}

</head>
<body>

<h1>Jasmine Spec Runner</h1>

<script>
    {% block jasmine %}
    (function() {
        var jasmineEnv = jasmine.getEnv();
        jasmineEnv.updateInterval = 1000;

        var trivialReporter = new jasmine.TrivialReporter()
        jasmineEnv.addReporter(trivialReporter);
        jasmineEnv.addReporter(new jasmine.ConsoleReporter());
        jasmineEnv.addReporter(new jasmine.JUnitXmlReporter('{{ JASMINE_REPORT_DIR }}/'));

        jasmineEnv.specFilter = function(spec) {
            return trivialReporter.specFilter(spec);
        };

        // Additional configuration can be done in this block
        {% block jasmine_extra %}{% endblock %}

        var currentWindowOnload = window.onload;

        window.onload = function() {
            if (currentWindowOnload) {
                currentWindowOnload();
            }
            execJasmine();
        };

        function execJasmine() {
            jasmineEnv.execute();
        }
    })();
    {% endblock %}
</script>

</body>
</html>
