Browse Source

Merge "Revert "JSHint integration""

Jenkins 5 years ago
parent
commit
3af84a8afe

+ 0
- 61442
horizon/static/horizon/lib/jshint-2.3.0.js
File diff suppressed because it is too large
View File


+ 0
- 88
horizon/static/horizon/lib/qhint.js View File

@@ -1,88 +0,0 @@
1
-/*! qHint 1.1 | http://gyoshev.mit-license.org */
2
-(function() {
3
-    var qHint =
4
-        window.jsHintTest =
5
-        window.qHint =
6
-            function qHint(name, sourceFile, options, globals) {
7
-                if (sourceFile === undefined || typeof(sourceFile) == "object") {
8
-                    // jsHintTest('file.js', [options])
9
-                    globals = options;
10
-                    options = sourceFile;
11
-                    sourceFile = name;
12
-                }
13
-
14
-                return asyncTest(name, function() {
15
-                    qHint.sendRequest(sourceFile, function(req) {
16
-                        start();
17
-
18
-                        if (req.status == 200) {
19
-                            qHint.validateFile(req.responseText, options, globals);
20
-                        } else {
21
-                            ok(false, "HTTP error " + req.status +
22
-                                      " while fetching " + sourceFile);
23
-                        }
24
-                    });
25
-                });
26
-            };
27
-
28
-    qHint.validateFile = function (source, options, globals) {
29
-        var i, len, err;
30
-
31
-        if (JSHINT(source, options, globals)) {
32
-            ok(true);
33
-            return;
34
-        }
35
-
36
-        for (i = 0, len = JSHINT.errors.length; i < len; i++) {
37
-            err = JSHINT.errors[i];
38
-            if (!err) {
39
-                continue;
40
-            }
41
-
42
-            ok(false, err.reason +
43
-                " on line " + err.line +
44
-                ", character " + err.character);
45
-        }
46
-    };
47
-
48
-    var XMLHttpFactories = [
49
-        function () { return new XMLHttpRequest(); },
50
-        function () { return new ActiveXObject("Msxml2.XMLHTTP"); },
51
-        function () { return new ActiveXObject("Msxml3.XMLHTTP"); },
52
-        function () { return new ActiveXObject("Microsoft.XMLHTTP"); }
53
-    ];
54
-
55
-    function createXMLHTTPObject() {
56
-        for (var i = 0; i < XMLHttpFactories.length; i++) {
57
-            try {
58
-                return XMLHttpFactories[i]();
59
-            } catch (e) {}
60
-        }
61
-        return false;
62
-    }
63
-
64
-    // modified version of XHR script by PPK
65
-    // http://www.quirksmode.org/js/xmlhttp.html
66
-    // attached to qHint to allow substitution / mocking
67
-    qHint.sendRequest = function (url, callback) {
68
-        var req = createXMLHTTPObject();
69
-        if (!req) {
70
-            return;
71
-        }
72
-
73
-        var method = "GET";
74
-        req.open(method,url,true);
75
-        req.onreadystatechange = function () {
76
-            if (req.readyState != 4) {
77
-                return;
78
-            }
79
-
80
-            callback(req);
81
-        };
82
-
83
-        if (req.readyState == 4) {
84
-            return;
85
-        }
86
-        req.send();
87
-    };
88
-})();

+ 0
- 56
horizon/static/horizon/tests/jshint.js View File

@@ -1,56 +0,0 @@
1
-horizon.addInitFunction(function () {
2
-  module('Coding Style (jsHint)');
3
-
4
-  test('jsHint', function () {
5
-    expect(0);
6
-
7
-    config = {
8
-      // Warnings reported by JSHint. Suppressing for now...
9
-      '-W080': true, // it's not necessary to initialize to 'undefined'
10
-
11
-      // Proposed set of rules
12
-      //'camelcase' : true,
13
-      'indent': 2,
14
-      'eqeqeq': true,
15
-      //'quotmark': 'single',
16
-      //'maxlen': 80,
17
-      //'trailing': true,
18
-      'curly': true
19
-    };
20
-
21
-    jsHintTest('angular/horizon.js', '/static/horizon/js/angular/horizon.js', config);
22
-    jsHintTest('angular/controllers/dummy.js', '/static/horizon/js/angular/controllers/dummy.js', config);
23
-    jsHintTest('angular/directives/forms.js', '/static/horizon/js/angular/directives/forms.js', config);
24
-
25
-    jsHintTest('horizon.communication.js', '/static/horizon/js/horizon.communication.js', config);
26
-    jsHintTest('horizon.conf.js', '/static/horizon/js/horizon.conf.js', config);
27
-    jsHintTest('horizon.cookies.js', '/static/horizon/js/horizon.cookies.js', config);
28
-    jsHintTest('horizon.d3barchart.js', '/static/horizon/js/horizon.d3barchart.js', config);
29
-    jsHintTest('horizon.d3linechart.js', '/static/horizon/js/horizon.d3linechart.js', config);
30
-    jsHintTest('horizon.d3piechart.js', '/static/horizon/js/horizon.d3piechart.js', config);
31
-    jsHintTest('horizon.firewalls.js', '/static/horizon/js/horizon.firewalls.js', config);
32
-    jsHintTest('horizon.forms.js', '/static/horizon/js/horizon.forms.js', config);
33
-    jsHintTest('horizon.formset_table.js', '/static/horizon/js/horizon.formset_table.js', config);
34
-    jsHintTest('horizon.heattop.js', '/static/horizon/js/horizon.heattop.js', config);
35
-    jsHintTest('horizon.instances.js', '/static/horizon/js/horizon.instances.js', config);
36
-    jsHintTest('horizon.js', '/static/horizon/js/horizon.js', config);
37
-    jsHintTest('horizon.membership.js', '/static/horizon/js/horizon.membership.js', config);
38
-    jsHintTest('horizon.messages.js', '/static/horizon/js/horizon.messages.js', config);
39
-    jsHintTest('horizon.modals.js', '/static/horizon/js/horizon.modals.js', config);
40
-    jsHintTest('horizon.networktopology.js', '/static/horizon/js/horizon.networktopology.js', config);
41
-    jsHintTest('horizon.quota.js', '/static/horizon/js/horizon.quota.js', config);
42
-    jsHintTest('horizon.tables.js', '/static/horizon/js/horizon.tables.js', config);
43
-    jsHintTest('horizon.tables_inline_edit.js', '/static/horizon/js/horizon.tables_inline_edit.js', config);
44
-    jsHintTest('horizon.tabs.js', '/static/horizon/js/horizon.tabs.js', config);
45
-    jsHintTest('horizon.templates.js', '/static/horizon/js/horizon.templates.js', config);
46
-    jsHintTest('horizon.users.js', '/static/horizon/js/horizon.users.js', config);
47
-    jsHintTest('horizon.utils.js', '/static/horizon/js/horizon.utils.js', config);
48
-
49
-    jsHintTest('tests/jshint.js', '/static/horizon/tests/jshint.js', config);
50
-    jsHintTest('tests/messages.js', '/static/horizon/tests/messages.js', config);
51
-    jsHintTest('tests/modals.js', '/static/horizon/tests/modals.js', config);
52
-    jsHintTest('tests/tables.js', '/static/horizon/tests/tables.js', config);
53
-    jsHintTest('tests/templates.js', '/static/horizon/tests/templates.js', config);
54
-  });
55
-});
56
-

+ 0
- 3
horizon/templates/horizon/qunit.html View File

@@ -6,8 +6,6 @@
6 6
     <link rel="stylesheet" href="{{ STATIC_URL }}horizon/lib/qunit/qunit.css" type="text/css" media="screen">
7 7
     <script type="text/javascript" src="{{ STATIC_URL }}horizon/lib/jquery/jquery.min.js"></script>
8 8
     <script type="text/javascript" src="{{ STATIC_URL }}horizon/lib/qunit/qunit.js"></script>
9
-    <script type="text/javascript" src="{{ STATIC_URL }}horizon/lib/jshint-2.3.0.js"></script>
10
-    <script type="text/javascript" src="{{ STATIC_URL }}horizon/lib/qhint.js"></script>
11 9
     {% include "horizon/_conf.html" %}
12 10
 
13 11
     {% comment %}Load test modules here.{% endcomment %}
@@ -15,7 +13,6 @@
15 13
     <script type="text/javascript" src="{{ STATIC_URL }}horizon/tests/modals.js"></script>
16 14
     <script type="text/javascript" src="{{ STATIC_URL }}horizon/tests/templates.js"></script>
17 15
     <script type="text/javascript" src="{{ STATIC_URL }}horizon/tests/tables.js"></script>
18
-    <script type="text/javascript" src="{{ STATIC_URL }}horizon/tests/jshint.js"></script>
19 16
     {% comment %}End test modules.{% endcomment %}
20 17
 
21 18
     {% include "horizon/_scripts.html" %}

+ 2
- 7
horizon/test/tests/selenium.py View File

@@ -20,7 +20,7 @@ from horizon.test import helpers as test
20 20
 class BrowserTests(test.SeleniumTestCase):
21 21
     def test_qunit(self):
22 22
         self.selenium.get("%s%s" % (self.live_server_url, "/qunit/"))
23
-        wait = self.ui.WebDriverWait(self.selenium, 20)
23
+        wait = self.ui.WebDriverWait(self.selenium, 10)
24 24
 
25 25
         def qunit_done(driver):
26 26
             text = driver.find_element_by_id("qunit-testresult").text
@@ -28,9 +28,4 @@ class BrowserTests(test.SeleniumTestCase):
28 28
 
29 29
         wait.until(qunit_done)
30 30
         failed = self.selenium.find_element_by_class_name("failed")
31
-        if int(failed.text) > 0:
32
-            filename = self.selenium.find_element_by_css_selector(
33
-                "#qunit-tests > li.fail span.test-name").text
34
-            message = self.selenium.find_element_by_css_selector(
35
-                "#qunit-tests > li.fail span.test-message").text
36
-            self.fail('%s: %s' % (filename, message))
31
+        self.assertEqual(int(failed.text), 0)

Loading…
Cancel
Save