Test suite removed

This commit is contained in:
mattpass
2020-01-26 14:45:32 +00:00
parent bb4565f231
commit 1dec4ac941
15 changed files with 9 additions and 381 deletions

View File

@@ -154,15 +154,6 @@ h2 {color: rgba(0,198,255,0.7)}
}
},1000);
</script>
<?php if(is_dir('test') && !$ICEcoder['demoMode']) {?>
<div style="float: left; margin-right: 50px">
<h2><?php echo $t['test suite'];?></h2>
<span class="heading"><?php echo $t['Run unit tests'];?></span><br>
<a nohref onclick="top.ICEcoder.filesFrame.contentWindow.frames['testControl'].location.href = 'test'" style="color: #fff; cursor: pointer"><?php echo $t['Run unit tests'];?></a><div id="unitTestResults"></div>
</div>
<?php
;};
?>
<div style="float: left">
<h2><?php echo $t['dev mode'];?> <?php echo $ICEcoder['devMode'] ? "on" : "off";?></h2>
<span class="heading"><?php echo $t['Status'];?>:</span><br>
@@ -193,12 +184,12 @@ CodeMirror.keyMap.ICEcoder = {
// CodeMirror does not honor indentWithTabs = false properly when handling Tab key
// Marijn said that it is by design, so we need to make a workaround of our own
(function(){
// let's back up original insertTab function which actually puts
// let's back up original insertTab function which actually puts
var originalInsertTabFunction = CodeMirror.commands.insertTab;
// and replace it with our own, which branches on whether our ICEcoder.indentWithTabs value is true or false
CodeMirror.commands.insertTab = function(cm){
if (top.ICEcoder.indentWithTabs){
// if it is true, then we should still put there, let's use original function
// if it is true, then we should still put there, let's use original function
return originalInsertTabFunction(cm);
} else {
// otherwise - let's call another handler, insertSoftTab which will do the job
@@ -250,7 +241,7 @@ function createNewCMInstance(num) {
// Keyup
window['cM'+num] .on("keyup", function(thisCM) {top.ICEcoder.cMonKeyUp(thisCM,'cM'+num)});
window['cM'+num+'diff'] .on("keyup", function(thisCM) {top.ICEcoder.cMonKeyUp(thisCM,'cM'+num+'diff')});
// Cursor activity
window['cM'+num] .on("cursorActivity", function(thisCM) {top.ICEcoder.cMonCursorActivity(thisCM,'cM'+num)});
window['cM'+num+'diff'] .on("cursorActivity", function(thisCM) {top.ICEcoder.cMonCursorActivity(thisCM,'cM'+num+'diff')});

View File

@@ -52,8 +52,6 @@ $permColors = $thisPermVal == 777 ? 'background: #800; color: #eee' : 'color: #8
<iframe name="fileControl" src="lib/get-branch.php?location=|&csrf=<?php echo $_SESSION['csrf'];?>" style="display: none"></iframe>
<iframe name="testControl" style="display: none"></iframe>
<iframe name="processControl" style="display: none"></iframe>
<iframe name="pingActive" style="display: none"></iframe>
@@ -61,5 +59,5 @@ $permColors = $thisPermVal == 777 ? 'background: #800; color: #eee' : 'color: #8
<div class="fmDragBox" id="fmDragBox"></div>
</body>
</html>

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "文件",
"Last 10 files..." => "最后10个打开的文件:",
"none" => "[none]",
"test suite" => "测试套件",
"Run unit tests" => "运行单元测试",
"dev mode" => "开发模式",
"Status" => "状态",
"Using" => "使用",
@@ -422,5 +420,5 @@ $text = array(
array(
"Update appears to..." => "更新似乎是成功的"
)
);

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "文件",
"Last 10 files..." => "最後10個打開的文件:",
"none" => "[none]",
"test suite" => "測試套件",
"Run unit tests" => "運行單元測試",
"dev mode" => "開發模式",
"Status" => "狀態",
"Using" => "使用",

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "bestanden",
"Last 10 files..." => "Laatste 10 geopende bestanden:",
"none" => "[none]",
"test suite" => "test suite",
"Run unit tests" => "Voer unit tests uit",
"dev mode" => "Ontwikkelaars modus",
"Status" => "Status",
"Using" => "Gebruikt",
@@ -473,7 +471,7 @@ $text = array(
array(
"Update appears to..." => "Update succesvol uitgevoerd!"
),
"find-in-files" =>
array(
"Enter path to search in" => "Voer het door te zoeken pad in",

View File

@@ -23,8 +23,6 @@ $text = array(
"files" => "files",
"Last 10 files..." => "Last 10 files opened:",
"none" => "[none]",
"test suite" => "test suite",
"Run unit tests" => "Run unit tests",
"dev mode" => "dev mode",
"Status" => "Status",
"Using" => "Using",
@@ -508,7 +506,7 @@ $text = array(
array(
"Update appears to..." => "Update appears to be successful"
),
"find-in-files" =>
array(
"Enter path to search in" => "Enter path to search in",

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "Fichiers",
"Last 10 files..." => "10 derniers fichiers ouverts :",
"none" => "[aucun]",
"test suite" => "Suite de test",
"Run unit tests" => "Lancer les tests unit",
"dev mode" => "Mode dev",
"Status" => "Statuts",
"Using" => "Utilise",
@@ -138,7 +136,7 @@ dans lib/config__settings.php",
"Enter filename to..." => "Saisissez le nom du fichier &agrave; enregistrer sur",
"That file exists..." => "Ce fichier existe d&eacute;j&agrave;, voulez vous l&apos;&eacute;craser ?",
"Saving" => "Sauvegard&eacute;"
),
),
"get-branch" =>
array(

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "Dateien",
"Last 10 files..." => "Die letzten 10 ge&ouml;ffneten Dateien:",
"none" => "[nichts]",
"test suite" => "Test Suite",
"Run unit tests" => "Unittest starten",
"dev mode" => "Entwicklermodus",
"Status" => "Status",
"Using" => "Verwenden",
@@ -269,7 +267,7 @@ $text = array(
"found in" => "Gefunden in",
"Replaced" => "Ersetzen"
),
"plugins-manager" =>
array(
"ICEcoder needs to..." => "ICEcoder muss neu geladen werden, damit das Plugin genutzt werden kann. Jetzt neu laden?",

View File

@@ -23,8 +23,6 @@ $text = array(
"files" => "file",
"Last 10 files..." => "Ultimi 10 file aperti:",
"none" => "[none]",
"test suite" => "prova suite",
"Run unit tests" => "Esegui test di unità",
"dev mode" => "modalit&agrave; sviluppo",
"Status" => "Stato",
"Using" => "Utilizzo",

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "filer",
"Last 10 files..." => "Siste 10 åpne filer:",
"none" => "[none]",
"test suite" => "test suite",
"Run unit tests" => "Kjør unit tests",
"dev mode" => "utvikler modus",
"Status" => "Status",
"Using" => "Brukes",

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "فایل ها",
"Last 10 files..." => "آخرین ۱۰ فایل باز شده",
"none" => "[پوچ]",
"test suite" => "تست سویت",
"Run unit tests" => "اجرای تست های واحد",
"dev mode" => "حالت توسعه دهنده",
"Status" => "وضعیت",
"Using" => "استفاده",

View File

@@ -24,8 +24,6 @@ $text = array(
"files" => "arquivos",
"Last 10 files..." => "&uacute;ltimos 10 arquivos abertos:",
"none" => "[nenhum]",
"test suite" => "su&iacute;te de teste",
"Run unit tests" => "Executar testes unit&atilde;rios",
"dev mode" => "modo desenv.",
"Status" => "Status",
"Using" => "Usando",

View File

@@ -23,8 +23,6 @@ $text = array(
"files" => "archivos",
"Last 10 files..." => "Ultimos 10 archivos abiertos:",
"none" => "[ninguno]",
"test suite" => "modo de pruebas",
"Run unit tests" => "Ejecutar tests unitarios",
"dev mode" => "modo desarrollo",
"Status" => "Estado",
"Using" => "Usando",

View File

@@ -1,285 +0,0 @@
<!DOCTYPE html>
<!-- Automated test suite to test some of the core functionality of ICEcoder including:
Open file, update document, save file, highlight line, add tag wrappers, duplicate line, add line break, comment line, remove line, contract, expand, unlock & lock file manager, open new tab, previous & next tab, switch tab, close tab, get remote file, move and go to line
//-->
<html>
<head>
<title>ICEcoder Test Suite</title>
<meta name="robots" content="noindex, nofollow">
<script src="object-watch.js?microtime=<?php echo microtime(true);?>"></script>
</head>
<script>
ICEcoder=top.ICEcoder;
if(ICEcoder.openFiles.length>0) {ICEcoder.closeAllTabs();}
unitTestResults = top.ICEcoder.content.contentWindow.document.getElementById('unitTestResults');
unitTestResults.innerHTML = "";
</script>
<?php
// Set test file name & location
$testFile = "test-file1.txt";
$testFileFullPath = str_replace("\\","/",dirname($_SERVER['PHP_SELF']))."/".$testFile;
// Delete any existing test file and create a new one
if (file_exists($testFile)) {unlink ($testFile);};
$fh = fopen($testFile, 'w') or die("<script>noCreate='FAIL Could not create test file';console.log(noCreate);unitTestResults.innerHTML = noCreate;</script>");
fwrite($fh, 'initial text');
fclose($fh);
?>
<body onLoad="runTests()">
<script>
function runTests() {
o = {p: 'start'}; // var used to test another var has changed
t = 0; // tries
s = 0; // successful tests
test.openFile(); // start the first test
}
test = {
openFile: function() {
title = "Open file";
o.p = ICEcoder.openFiles[0];
t = 0;
x = setInterval(function() {
wait();
cM = ICEcoder.getcMInstance();
if (cM && "undefined" != typeof ICEcoder.openFiles[0]) {
testResult("+ GOOD",title+". Took "+t+"ms",x);
ICEcoder.serverMessage();
top.ICEcoder.serverQueue("del",0);
test.updateDoc();
} else if (t==1000) {
testResult("- FAIL",title+". Took "+t+"ms",x);
testStopped();
}
o.p = ICEcoder.openFiles[0];
t++;
},1);
result = ICEcoder.openFile('<?php echo $testFileFullPath?>');
},
updateDoc: function() {
title = "Change file contents";
cM.setValue('Updated');
if (cM.getValue()=="Updated") {
testResult("+ GOOD",title);
test.saveFile();
} else {
testResult("+ FAIL",title);
testStopped();
}
},
saveFile: function() {
title = "Save file";
o.p = ICEcoder.savedPoints[0];
t = 0;
x = setInterval(function() {
wait();
cM = ICEcoder.getcMInstance();
if (cM && ICEcoder.savedPoints[0]==cM.changeGeneration()-1) {
testResult("+ GOOD",title+". Took "+t+"ms",x);
test.tagWrapper();
} else if (t==1000) {
testResult("- FAIL",title+". Took "+t+"ms",x);
testStopped();
}
o.p = ICEcoder.savedPoints[0];
t++;
},1);
result = ICEcoder.saveFile();
},
tagWrapper: function() {
title = "Highlight line and add <p> and <div> tag wrappers";
ICEcoder.highlightLine(0);
ICEcoder.tagWrapper('p');
ICEcoder.tagWrapper('div');
if (cM.getValue() == "<div>\n\t<p>Updated</p>\n</div>") {
testResult("+ GOOD",title);
test.lineDupBreakCommentRemove();
} else {
testResult("- FAIL",title);
testStopped();
}
},
lineDupBreakCommentRemove: function() {
title = "Duplicate, add break, comment and remove line";
ICEcoder.duplicateLines(1);
ICEcoder.addLineBreakAtEnd(2);
ICEcoder.lineCommentToggle();
line2 = cM.getLine(2);
ICEcoder.removeLines(2);
line2Now = cM.getLine(2);
if (line2 == "<!-- <p>Updated</p><br>//-->" && line2Now == "</div>") {
testResult("+ GOOD",title);
test.lockUnlockNav();
} else {
testResult("- FAIL",title);
testStopped();
}
},
lockUnlockNav: function() {
title = "Expand/contract and lock/unlock";
ICEcoder.lockUnlockNav();
ICEcoder.changeFilesW('contract');
setTimeout(function(){
lockChanged = top.ICEcoder.lockedNav;
widthChanged = ICEcoder.filesW;
ICEcoder.changeFilesW('expand');
setTimeout(function(){
ICEcoder.lockUnlockNav();
if (ICEcoder.lockedNav != lockChanged && ICEcoder.filesW != widthChanged) {
testResult("+ GOOD",title);
test.newTab();
} else {
testResult("- FAIL",title);
testStopped();
}
},500);
},500);
},
newTab: function() {
title = "Open new tab";
ICEcoder.newTab();
if (ICEcoder.openFiles.length==2) {
testResult("+ GOOD",title);
setTimeout(function(){
test.prevNextTab();
},500);
} else {
testResult("- FAIL",title);
testStopped();
}
},
prevNextTab: function() {
title = "Previous and next tab";
ICEcoder.previousTab();
tPrev = ICEcoder.selectedTab;
setTimeout(function(){
if (tPrev==1) {
ICEcoder.nextTab();
tNext = ICEcoder.selectedTab;
}
},300);
setTimeout(function(){
if (tPrev==1 && tNext==2) {
testResult("+ GOOD",title);
test.switchTab();
} else {
testResult("- FAIL",title);
testStopped();
}
},600);
},
switchTab: function() {
title = "Switch tab";
ICEcoder.switchTab(1);
if (ICEcoder.selectedTab==1) {
testResult("+ GOOD",title);
test.closeTab();
} else {
testResult("- FAIL",title);
testStopped();
}
},
closeTab: function() {
title = "Close tab";
ICEcoder.closeTab(2,false,true);
setTimeout(function() {
if (ICEcoder.openFiles.length==1) {
testResult("+ GOOD",title);
test.getRemoteFile();
} else {
testResult("- FAIL",title);
testStopped();
}
},200);
},
getRemoteFile: function() {
title = "Get remote file";
o.p = ICEcoder.openFiles[1];
t = 0;
x = setInterval(function() {
wait();
cM = ICEcoder.getcMInstance();
if (cM && ICEcoder.openFiles[1]== "/[NEW]") {
testResult("+ GOOD",title+". Took "+t+"ms",x);
setTimeout(function() {
ICEcoder.closeTab(2,false,true);
test.moveGoToLine();
},1000);
} else if (t==1000) {
testResult("- FAIL",title+". Took "+t+"ms",x);
testStopped();
}
o.p = ICEcoder.openFiles[1];
t++;
},1);
result = ICEcoder.getRemoteFile('http://icecoder.net/latest-version');
},
moveGoToLine: function() {
title = "Move and goto line";
cM = ICEcoder.getcMInstance();
cM.setValue('ICEcoder = "awesome";\n<script>\n<\/script>');
ICEcoder.goToLine(1);
line1Text = cM.lineInfo(cM.getCursor().line).text;
setTimeout(function() {
ICEcoder.moveLines('down');
if (cM.getValue() == '<script>\nICEcoder = "awesome";\n<\/script>') {
testResult("+ GOOD",title);
setTimeout(function() {
ICEcoder.closeTab(1,false,true);
console.log('TEST COMPLETE!');
top.ICEcoder.message('Test Complete!\n\nRan '+s+' of '+total+' tests OK.\nSee console for more details.');
},200);
} else {
testResult("- FAIL",title);
testStopped();
}
},200);
}
}
function wait() {
o.watch("p", function (id, oldval, newval) {
if (oldval != newval) {
o.unwatch('p');
return newval;
}
});
}
function testResult(result,output,timer) {
if (result=="+ GOOD") {s++};
displayResults(s);
if (timer) {clearInterval(timer)}
console.log(result+" "+output);
}
function displayResults(successful) {
total = Object.keys(test).length;
unitTestResults.innerHTML = "Ran "+successful+" of "+total+" tests OK";
}
function testStopped() {
unitTestResults.innerHTML += " - Test stopped";
top.ICEcoder.message("Test stopped, see console for details.");
}
</script>
</body>
</html>

View File

@@ -1,54 +0,0 @@
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
// object.watch
if (!Object.prototype.watch) {
Object.defineProperty(Object.prototype, "watch", {
enumerable: false
, configurable: true
, writable: false
, value: function (prop, handler) {
var
oldval = this[prop]
, newval = oldval
, getter = function () {
return newval;
}
, setter = function (val) {
oldval = newval;
return newval = handler.call(this, prop, oldval, val);
}
;
if (delete this[prop]) { // can't watch constants
Object.defineProperty(this, prop, {
get: getter
, set: setter
, enumerable: true
, configurable: true
});
}
}
});
}
// object.unwatch
if (!Object.prototype.unwatch) {
Object.defineProperty(Object.prototype, "unwatch", {
enumerable: false
, configurable: true
, writable: false
, value: function (prop) {
var val = this[prop];
delete this[prop]; // remove accessors
this[prop] = val;
}
});
}