diff options
author | mattab <matthieu.aubry@gmail.com> | 2016-07-15 05:30:10 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2016-07-15 05:31:51 +0300 |
commit | 9b3fd358d673333407ea5d1eb887e1d63d2fbd10 (patch) | |
tree | cd4492273cb0c67ca0af855f8514d2ec57fd62bd /tests/javascript/index.php | |
parent | ed024096d4b5bd45e8618e6804da09486aca31f1 (diff) |
Load the JS file in the test where it is used, to prevent errors running tests on IE8
jslint not working on IE8 it seems
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 3f80e74f18..938dc085ac 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -77,7 +77,7 @@ testTrackPageViewAsync(); </style> <script src="../../libs/bower_components/jquery/dist/jquery.min.js" type="text/javascript"></script> <script src="assets/qunit.js" type="text/javascript"></script> - <script src="jslint/jslint.js" type="text/javascript"></script> + <script type="text/javascript"> QUnit.config.reorder = false; function _e(id){ @@ -435,7 +435,12 @@ function PiwikTest() { test("JSLint", function() { expect(1); - var src = '<?php + + stop(); + + $.getScript("jslint/jslint.js", function(){ + + var src = '<?php // Once we use JSHint instead of jslint, we could remove a few lines below, // to use instead the feature to disable jshint for the JSON2 block @@ -460,19 +465,23 @@ function PiwikTest() { echo "$contentToJslint"; ?>'; - var result = JSLINT(src); - ok( result, "JSLint did not validate, please check the browser console for the list of jslint errors." ); - if (console && console.log && !result) { - var countOfLinesRemoved = <?php echo getLineCountJsLintStarted($src,$contentRemovedFromPos); ?>; + var result = JSLINT(src); + ok( result, "JSLint validation: please check the browser console for the list of jslint errors." ); + if (console && console.log && !result) { + var countOfLinesRemoved = <?php echo getLineCountJsLintStarted($src,$contentRemovedFromPos); ?>; - // we fix the line numbers so they match to the line numbers in ../../js/piwik.js - JSLINT.errors.forEach( function (item, index) { - item.line += countOfLinesRemoved; - console.log(item); - }); + // we fix the line numbers so they match to the line numbers in ../../js/piwik.js + JSLINT.errors.forEach( function (item, index) { + item.line += countOfLinesRemoved; + console.log(item); + }); + + console.log('JSLINT errors', JSLINT.errors); + } + + start(); + }); - console.log('JSLINT errors', JSLINT.errors); - } }); test("JSON", function() { |