X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Fmisc%2Flocal.js;h=4b1ea402a059ff63a58fb00a157231601aefcdf5;hb=92c5f414ef8132225bd6677d092335e8b38e5a06;hp=9ca6e1a1cce0bdac0e9f50ef023922b853e148ef;hpb=02b1c284cb1f6d1627bc0912bd831ec2f30fdb45;p=dygraphs.git diff --git a/auto_tests/misc/local.js b/auto_tests/misc/local.js index 9ca6e1a..4b1ea40 100644 --- a/auto_tests/misc/local.js +++ b/auto_tests/misc/local.js @@ -1,3 +1,5 @@ +'use strict'; + var DygraphsLocalTester = function() { this.tc = null; // Selected test case this.name = null; @@ -22,17 +24,16 @@ var DygraphsLocalTester = function() { * In some cases we will still allow warnings to be warnings, however. */ DygraphsLocalTester.prototype.overrideWarn = function() { - // save Dygraph.warn so we can catch warnings. - var originalDygraphWarn = Dygraph.warn; - Dygraph.warn = function(msg) { - // This warning is still + // save console.warn so we can catch warnings. + var originalWarn = console.warn; + console.warn = function(msg) { + // This warning is pervasive enough that we'll let it slide (for now). if (msg == "Using default labels. Set labels explicitly via 'labels' in the options parameter") { - originalDygraphWarn(msg); + originalWarn(msg); return; } throw 'Warnings not permitted: ' + msg; } - Dygraph.prototype.warn = Dygraph.warn; }; DygraphsLocalTester.prototype.processVariables = function() { @@ -76,12 +77,12 @@ DygraphsLocalTester.prototype.createAnchor = function(href, id, text) { var a = document.createElement('a'); a.href = href; a.id = id; - a.innerText = text; + a.textContent = text; return a; } DygraphsLocalTester.prototype.createResultsDiv = function(summary, durationms) { - div = document.createElement('div'); + var div = document.createElement('div'); div.id='results'; var body = document.getElementsByTagName('body')[0]; @@ -147,7 +148,7 @@ DygraphsLocalTester.prototype.postResults = function(summary, durationms) { var tdResult = document.createElement('td'); tdResult.setAttribute('class', 'outcome'); - tdResult.innerText = result.result ? 'pass' : 'fail'; + tdResult.textContent = result.result ? 'pass' : 'fail'; tr.appendChild(tdResult); var tdName = document.createElement('td'); @@ -159,7 +160,7 @@ DygraphsLocalTester.prototype.postResults = function(summary, durationms) { tr.appendChild(tdName); var tdDuration = document.createElement('td'); - tdDuration.innerText = result.duration + ' ms'; + tdDuration.textContent = result.duration + ' ms'; tr.appendChild(tdDuration); if (result.e) { @@ -194,12 +195,12 @@ DygraphsLocalTester.prototype.listTests = function() { var createLink = function(parent, title, url) { var li = createAttached('li', parent); var a = createAttached('a', li); - a.innerHTML = title; + a.textContent = title; a.href = url; return li; } if (this.tc == null) { - description.innerHTML = 'Test cases:'; + description.textContent = 'Test cases:'; var testCases = getAllTestCases(); createLink(list, '(run all tests)', document.URL + '?command=runAllTests'); for (var idx in testCases) { @@ -207,7 +208,7 @@ DygraphsLocalTester.prototype.listTests = function() { createLink(list, entryName, document.URL + '?testCaseName=' + entryName); } } else { - description.innerHTML = 'Tests for ' + name; + description.textContent = 'Tests for ' + name; var names = this.tc.getTestNames(); createLink(list, 'Run All Tests', document.URL + '&command=runAllTests'); for (var idx in names) {