From 64d8f259dcdc824c57317579caf06d4fc51910b7 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 14 Dec 2017 00:17:16 +0400 Subject: [PATCH] cleanup tests --- configs/client-config_test.js | 1 + configs/standalone.js | 17 +- plugins/c9.core/c9_test.js | 2 +- plugins/c9.core/ext_test.js | 2 +- plugins/c9.core/http-xhr_test.js | 2 +- plugins/c9.core/settings_test.js | 4 +- plugins/c9.core/util_test.js | 2 +- plugins/c9.fs/fs.cache.xml_test.js | 12 +- plugins/c9.fs/fs_test.js | 29 +- plugins/c9.fs/net_test.js | 3 +- plugins/c9.fs/proc_test.js | 5 +- plugins/c9.ide.ace.gotoline/gotoline_test.js | 4 +- .../c9.ide.ace.statusbar/statusbar_test.js | 3 +- plugins/c9.ide.ace/ace_test.js | 7 +- plugins/c9.ide.clipboard/clipboard_test.js | 2 +- plugins/c9.ide.collab/collab_test.js | 2 +- plugins/c9.ide.console/console_test.js | 7 +- plugins/c9.ide.dialog.common/error_test.js | 2 +- plugins/c9.ide.dialog/dialog_test.js | 2 +- plugins/c9.ide.editors/document_test.js | 2 +- plugins/c9.ide.editors/editor_test.js | 2 +- plugins/c9.ide.editors/editors_test.js | 2 +- plugins/c9.ide.editors/metadata_test.js | 14 +- plugins/c9.ide.editors/tab_test.js | 2 +- plugins/c9.ide.editors/tabmanager_test.js | 4 +- plugins/c9.ide.editors/undomanager_test.js | 2 +- .../c9.ide.find.infiles/findinfiles_test.js | 9 +- .../c9.ide.find.replace/findreplace_test.js | 70 ++-- plugins/c9.ide.find/find.nak_test.js | 6 +- plugins/c9.ide.immediate/immediate_test.js | 6 +- plugins/c9.ide.keys/commands_test.js | 2 +- .../architect_resolver_test.js | 362 +++++------------ .../server/jsonalyzer_server_test.js | 371 +++++------------- plugins/c9.ide.panels/panels_test.js | 3 +- .../c9.ide.preferences/preferences_test.js | 5 +- plugins/c9.ide.run.build/build_test.js | 6 +- plugins/c9.ide.run.build/gui_test.js | 6 +- plugins/c9.ide.run.debug/breakpoints_test.js | 3 +- plugins/c9.ide.run.debug/callstack_test.js | 27 +- .../debuggers/debugger_test.js | 10 +- plugins/c9.ide.run.debug/variables_test.js | 16 +- plugins/c9.ide.run.debug/watches_test.js | 25 +- plugins/c9.ide.run/output_test.js | 4 +- plugins/c9.ide.run/run_test.js | 6 +- plugins/c9.ide.save/autosave_test.js | 4 +- plugins/c9.ide.save/save_test.js | 10 +- .../c9.ide.terminal.monitor/monitor_test.js | 17 +- plugins/c9.ide.terminal/predict_echo_test.js | 4 +- plugins/c9.ide.terminal/terminal_test.js | 4 +- .../threewaymerge_test.js | 2 +- plugins/c9.ide.tree/tree_test.js | 5 +- plugins/c9.ide.ui/docklayout_test.js | 2 +- plugins/c9.ide.ui/menus_test.js | 2 +- plugins/c9.ide.ui/ui_test.js | 2 +- plugins/c9.ide.upload/upload_manager_test.js | 3 +- plugins/c9.ide.upload/upload_progress_test.js | 4 +- plugins/c9.ide.upload/upload_test.js | 4 +- plugins/c9.ide.watcher/watcher_test.js | 3 +- plugins/c9.ide.welcome/welcome_test.js | 4 +- plugins/c9.vfs.server/vfs_wrapper_test.js | 1 + .../run-client-integration.phantom.js | 17 +- 61 files changed, 410 insertions(+), 751 deletions(-) diff --git a/configs/client-config_test.js b/configs/client-config_test.js index 45f74285..86c06200 100755 --- a/configs/client-config_test.js +++ b/configs/client-config_test.js @@ -32,6 +32,7 @@ describe("client config consistency", function() { }).concat( fs.readdirSync(root + "/configs/ide").map(function(n) { return "ide/" + n }) ).forEach(function(name) { + if (!/\.js$/.test(name)) return; it("should not have missing plugins in config " + name, function(next) { fetchClientOptions(function(err, clientOptions) { if (err) return next(); diff --git a/configs/standalone.js b/configs/standalone.js index fd27207f..191ac427 100644 --- a/configs/standalone.js +++ b/configs/standalone.js @@ -45,16 +45,18 @@ module.exports = function(config, optimist) { .describe("useBrowserCache", "Use window.caches api if available for faster loading, requires https://") .describe("secure", "path to file containing ssl certificate (can be generated using scripts/create-cert.sh)"); } - + + require("./utils/ssl")(config, optimist); + var argv = optimist.argv; if (argv.help) return null; - + var testing = argv.t; var baseProc = path.normalize(testing ? __dirname + "/../plugins/c9.fs/mock" : argv.w || (__dirname + "/../")); - + // if (testing && !argv["setting-path"]) // argv["setting-path"] = "/tmp/.c9"; @@ -112,15 +114,6 @@ module.exports = function(config, optimist) { console.log("or use -a username:password to setup HTTP authentication\n"); } - if (argv.secure) { - var certPath = path.isAbsolute(argv.secure) ? argv.secure : path.join(__dirname, "..", argv.secure); - var key = require("fs").readFileSync(certPath, "utf8"); - config.secure = { - key: key.match(/^(-+BEGIN RSA PRIVATE KEY[\s\S]*END RSA PRIVATE KEY-+)/m)[0], - cert: key.match(/^(-+BEGIN CERTIFICATE[\s\S]*END CERTIFICATE-+)/m)[0], - }; - } - var plugins = [ { packagePath: "connect-architect/connect", diff --git a/plugins/c9.core/c9_test.js b/plugins/c9.core/c9_test.js index 70ada261..d2a8efb5 100644 --- a/plugins/c9.core/c9_test.js +++ b/plugins/c9.core/c9_test.js @@ -84,6 +84,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.core/ext_test.js b/plugins/c9.core/ext_test.js index 25bc929e..008663d4 100644 --- a/plugins/c9.core/ext_test.js +++ b/plugins/c9.core/ext_test.js @@ -213,6 +213,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.core/http-xhr_test.js b/plugins/c9.core/http-xhr_test.js index 8b925c2f..347de2bf 100644 --- a/plugins/c9.core/http-xhr_test.js +++ b/plugins/c9.core/http-xhr_test.js @@ -31,6 +31,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.core/settings_test.js b/plugins/c9.core/settings_test.js index 13642a5d..5d7834c1 100644 --- a/plugins/c9.core/settings_test.js +++ b/plugins/c9.core/settings_test.js @@ -18,6 +18,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.core/ext", "plugins/c9.core/http-xhr", "plugins/c9.ide.ui/lib_apf", @@ -27,7 +28,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) debug: true }, "plugins/c9.ide.ui/ui", - "plugins/c9.core/api", { consumes: ["settings"], provides: [], @@ -108,6 +108,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.core/util_test.js b/plugins/c9.core/util_test.js index efa980fa..5e4f9be7 100644 --- a/plugins/c9.core/util_test.js +++ b/plugins/c9.core/util_test.js @@ -71,6 +71,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.fs/fs.cache.xml_test.js b/plugins/c9.fs/fs.cache.xml_test.js index 7be5eef8..4ced93b8 100644 --- a/plugins/c9.fs/fs.cache.xml_test.js +++ b/plugins/c9.fs/fs.cache.xml_test.js @@ -1,13 +1,11 @@ /*global describe it before*/ -"use blacklist"; "use client"; -require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], - function (architect, chai, baseProc, events) { +require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], + function (architect, chai, baseProc) { var expect = chai.expect; - var EventEmitter = events.EventEmitter; - + expect.setupArchitectTest([ { packagePath: "plugins/c9.core/c9", @@ -21,7 +19,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], "plugins/c9.core/ext", "plugins/c9.core/settings", "plugins/c9.core/util", - "plugins/c9.core/api", "plugins/c9.ide.ui/ui", "plugins/c9.ide.ui/lib_apf", "plugins/c9.fs/fs.cache.xml", @@ -33,6 +30,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["fs.cache", "fs", "proc", "watcher"], provides: [], @@ -845,6 +843,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.fs/fs_test.js b/plugins/c9.fs/fs_test.js index bc07c64e..102a0163 100644 --- a/plugins/c9.fs/fs_test.js +++ b/plugins/c9.fs/fs_test.js @@ -9,7 +9,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], expect.setupArchitectTest([ "plugins/c9.core/http-xhr", "plugins/c9.core/ext", - "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -17,6 +16,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["fs"], @@ -49,12 +49,13 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], describe('fs.readFile()', function() { it("should read the text file", function(done) { - fs.readFile("/file.txt", "utf8", function(err, body) { + var xhr = fs.readFile("/file.txt", "utf8", function(err, body) { if (err) throw err.message; expect(body).equal("This is a simple file!\n"); expect(body.length).equal(23); done(); }); + expect(xhr.abort).to.ok; }); it("should error with ENOENT on missing files", function(done) { fs.readFile("/badfile.json", "utf8", function(err, body) { @@ -63,9 +64,29 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); it("should error with EISDIR on directories", function(done) { + var called; + fs.once("userError", function() { + if (called) + done(); + }); fs.readFile("/", "utf8", function(err, body) { expect(err).property("code").equal("EISDIR"); - done(); + called = true; + }); + }); + it("should not emit userError if error is handled", function(done) { + function onError() { + fs.off("userError", onError); + done(new Error("userError emitted")); + } + fs.on("userError", onError); + fs.readFile("/", "utf8", function(err, body) { + expect(err).property("code").equal("EISDIR"); + setTimeout(function() { + fs.off("userError", onError); + done(); + }); + return false; }); }); }); @@ -545,6 +566,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.fs/net_test.js b/plugins/c9.fs/net_test.js index 894f6487..dc4520f5 100644 --- a/plugins/c9.fs/net_test.js +++ b/plugins/c9.fs/net_test.js @@ -20,6 +20,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["net", "proc"], @@ -71,6 +72,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.fs/proc_test.js b/plugins/c9.fs/proc_test.js index 0b31314d..62059b1c 100644 --- a/plugins/c9.fs/proc_test.js +++ b/plugins/c9.fs/proc_test.js @@ -20,6 +20,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["proc", "c9"], provides: [], @@ -158,6 +159,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc }); }); - onload && onload(); + register(); } -}); \ No newline at end of file +}); diff --git a/plugins/c9.ide.ace.gotoline/gotoline_test.js b/plugins/c9.ide.ace.gotoline/gotoline_test.js index d50089fd..30bcd6e0 100644 --- a/plugins/c9.ide.ace.gotoline/gotoline_test.js +++ b/plugins/c9.ide.ace.gotoline/gotoline_test.js @@ -23,7 +23,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) packagePath: "plugins/c9.core/settings", settings: { user: { general: { animateui: true }}} }, - "plugins/c9.core/api.js", "plugins/c9.ide.ui/lib_apf", "plugins/c9.ide.ui/anims", "plugins/c9.ide.ui/menus", @@ -52,6 +51,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/fs", // Mock plugins @@ -183,6 +183,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.ace.statusbar/statusbar_test.js b/plugins/c9.ide.ace.statusbar/statusbar_test.js index fb2610bf..ee4ab438 100644 --- a/plugins/c9.ide.ace.statusbar/statusbar_test.js +++ b/plugins/c9.ide.ace.statusbar/statusbar_test.js @@ -25,7 +25,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -180,6 +179,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.ace/ace_test.js b/plugins/c9.ide.ace/ace_test.js index 64215954..a499cfa8 100644 --- a/plugins/c9.ide.ace/ace_test.js +++ b/plugins/c9.ide.ace/ace_test.js @@ -26,7 +26,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) settings: "default", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -51,6 +50,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/fs", "plugins/c9.ide.dialog/dialog", @@ -450,6 +450,9 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) done(); }); it('should allow setting behavioursEnabled', function(done) { + editor.setOption("syntax", "javascript"); + expect(editor.ace.session.$mode.$id).to.equal("ace/mode/javascript"); + editor.setOption("behavioursEnabled", false); doc.value = "test"; render(); @@ -552,6 +555,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.clipboard/clipboard_test.js b/plugins/c9.ide.clipboard/clipboard_test.js index 8976a461..ec87a480 100644 --- a/plugins/c9.ide.clipboard/clipboard_test.js +++ b/plugins/c9.ide.clipboard/clipboard_test.js @@ -70,6 +70,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.collab/collab_test.js b/plugins/c9.ide.collab/collab_test.js index a06fed5f..e921be19 100644 --- a/plugins/c9.ide.collab/collab_test.js +++ b/plugins/c9.ide.collab/collab_test.js @@ -24,7 +24,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.core/ext", "plugins/c9.core/http-xhr", "plugins/c9.core/util", - "plugins/c9.core/api.js", "plugins/c9.ide.ui/lib_apf", { packagePath: "plugins/c9.core/settings", @@ -49,6 +48,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc diff --git a/plugins/c9.ide.console/console_test.js b/plugins/c9.ide.console/console_test.js index b2857bb8..bdaf1da5 100644 --- a/plugins/c9.ide.console/console_test.js +++ b/plugins/c9.ide.console/console_test.js @@ -26,7 +26,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -53,6 +52,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -87,9 +87,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], describe('console', function() { before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); - document.documentElement.style.paddingBottom = "200px"; cnsl.once("ready", function() { @@ -379,6 +376,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.dialog.common/error_test.js b/plugins/c9.ide.dialog.common/error_test.js index a6bc20a9..c54a7c3c 100644 --- a/plugins/c9.ide.dialog.common/error_test.js +++ b/plugins/c9.ide.dialog.common/error_test.js @@ -61,6 +61,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); } - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.dialog/dialog_test.js b/plugins/c9.ide.dialog/dialog_test.js index 9bb411dc..169f05b2 100644 --- a/plugins/c9.ide.dialog/dialog_test.js +++ b/plugins/c9.ide.dialog/dialog_test.js @@ -71,6 +71,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); } - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/document_test.js b/plugins/c9.ide.editors/document_test.js index 87ffa696..9f8f2f08 100644 --- a/plugins/c9.ide.editors/document_test.js +++ b/plugins/c9.ide.editors/document_test.js @@ -89,6 +89,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/editor_test.js b/plugins/c9.ide.editors/editor_test.js index fdc3b041..0e8009a1 100644 --- a/plugins/c9.ide.editors/editor_test.js +++ b/plugins/c9.ide.editors/editor_test.js @@ -134,6 +134,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/editors_test.js b/plugins/c9.ide.editors/editors_test.js index 644e19d5..0a5ec4a4 100644 --- a/plugins/c9.ide.editors/editors_test.js +++ b/plugins/c9.ide.editors/editors_test.js @@ -77,6 +77,6 @@ require(["lib/architect/architect", "lib/chai/chai", "events"], function (archit }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/metadata_test.js b/plugins/c9.ide.editors/metadata_test.js index d00d2f0a..4da6aa1c 100644 --- a/plugins/c9.ide.editors/metadata_test.js +++ b/plugins/c9.ide.editors/metadata_test.js @@ -1,4 +1,4 @@ -/*global describe it before after bar*/ +/*global describe it before after bar apf*/ "use client"; @@ -26,7 +26,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -53,6 +52,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }, "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/proc", { packagePath: "plugins/c9.fs/fs", @@ -84,14 +84,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], var metadata = imports.metadata; var question = imports["dialog.question"]; - function countEvents(count, expected, done) { - if (count == expected) - done(); - else - throw new Error("Wrong Event Count: " - + count + " of " + expected); - } - expect.html.setConstructor(function(tab) { if (typeof tab == "object") return tab.pane.aml.getPage("editor::" + tab.editorType).$ext; @@ -447,6 +439,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/tab_test.js b/plugins/c9.ide.editors/tab_test.js index 716296f1..d4a63e70 100644 --- a/plugins/c9.ide.editors/tab_test.js +++ b/plugins/c9.ide.editors/tab_test.js @@ -113,6 +113,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/tabmanager_test.js b/plugins/c9.ide.editors/tabmanager_test.js index 78502f97..cba04ce5 100644 --- a/plugins/c9.ide.editors/tabmanager_test.js +++ b/plugins/c9.ide.editors/tabmanager_test.js @@ -24,7 +24,6 @@ require(["lib/architect/architect", "lib/chai/chai"], packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -48,6 +47,7 @@ require(["lib/architect/architect", "lib/chai/chai"], }, "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -593,6 +593,6 @@ require(["lib/architect/architect", "lib/chai/chai"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.editors/undomanager_test.js b/plugins/c9.ide.editors/undomanager_test.js index 346c8c33..086e3a1e 100644 --- a/plugins/c9.ide.editors/undomanager_test.js +++ b/plugins/c9.ide.editors/undomanager_test.js @@ -141,6 +141,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.find.infiles/findinfiles_test.js b/plugins/c9.ide.find.infiles/findinfiles_test.js index 89ef9db4..d858f3b2 100644 --- a/plugins/c9.ide.find.infiles/findinfiles_test.js +++ b/plugins/c9.ide.find.infiles/findinfiles_test.js @@ -31,7 +31,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], packagePath: "plugins/c9.core/settings", settings: { user: { general: { animateui: true }}} }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -73,6 +72,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }, "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/fs", { @@ -111,7 +111,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); describe("open", function() { - it('should open a pane with just an editor', function(done) { + it("should open searchresults tab", function(done) { findinfiles.toggle(); tabs.open({ path: "/file.txt", focus: true }, function(err, tab) { expect(tabs.getTabs()).length.is.gte(1); @@ -126,8 +126,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], if (!onload.remain) { describe("unload", function() { - - it('should open a pane with just an editor', function(done) { + it('should unload find in files plugin', function(done) { findinfiles.unload(); done(); }); @@ -142,6 +141,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.find.replace/findreplace_test.js b/plugins/c9.ide.find.replace/findreplace_test.js index ae18c11c..536a99a8 100644 --- a/plugins/c9.ide.find.replace/findreplace_test.js +++ b/plugins/c9.ide.find.replace/findreplace_test.js @@ -26,7 +26,6 @@ require(["lib/architect/architect", "lib/chai/chai", "text!plugins/c9.ide.layout packagePath: "plugins/c9.core/settings", settings: { user: { general: { animateui: true }}} }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -57,8 +56,9 @@ require(["lib/architect/architect", "lib/chai/chai", "text!plugins/c9.ide.layout "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/fs", - + { consumes: ["ui"], provides: ["layout"], @@ -102,38 +102,36 @@ require(["lib/architect/architect", "lib/chai/chai", "text!plugins/c9.ide.layout setup: main } ], architect); - + function main(options, imports, register) { var tabs = imports.tabManager; var settings = imports.settings; var findreplace = imports.findreplace; var commands = imports.commands; - + var Range = require("ace/range").Range; - + var txtFind, txtReplace; - + function getTabHtml(tab) { return tab.pane.aml.getPage("editor::" + tab.editorType).$ext; } - + expect.html.setConstructor(function(tab) { if (typeof tab == "object") return getTabHtml(tab); }); - + describe('ace', function() { this.timeout(10000); - + before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); tabs.getPanes()[0].focus(); - + document.body.style.marginBottom = "33%"; done(); }); - + describe("open", function() { var ace, tab; it('should open a pane with just an editor', function(done) { @@ -157,63 +155,63 @@ require(["lib/architect/architect", "lib/chai/chai", "text!plugins/c9.ide.layout for (var i = 0; i < 100; i++) { str.push("a " + i + " b " + (i % 10)); } - + tab.editor.focus(); ace.setValue(str.join("\n")); - + ace.selection.setRange(new Range(0, 0, 0, 1)); commands.exec("find"); - + txtFind = findreplace.getElement("txtFind").ace; txtReplace = findreplace.getElement("txtReplace").ace; - + expect(txtFind.getValue()).equal("a"); - + tab.editor.focus(); ace.selection.setRange(new Range(0, 4, 0, 7)); - + commands.exec("find"); expect(txtFind.getValue()).equal("b 0"); - - ace.once("changeSelection", function() { + + ace.once("changeSelection", function() { expect(ace.selection.getRange().end.row).equal(10); done(); }); setTimeout(function() { - findreplace.findNext(); + findreplace.findNext(); }, 100); }); it('should find again and again', function() { commands.exec("findnext"); expect(ace.selection.getRange().end.row).equal(20); - + ace.selection.setRange(new Range(0, 0, 0, 7)); - + commands.exec("findnext"); expect(ace.selection.getRange().start.column).equal(0); - + var kb = txtFind.keyBinding.$handlers[1].commands; var prev = kb["Shift-Return"]; var next = kb["Return"]; - + ace.selection.setRange(new Range(10, 5, 10, 5)); txtFind.execCommand(next); expect(ace.selection.getRange()).to.deep.equal(new Range(10, 5, 10, 8)); - + txtReplace.setValue("b 0"); findreplace.replace(); expect(ace.selection.getRange()).to.deep.equal(new Range(20, 5, 20, 8)); findreplace.replace(true); expect(ace.selection.getRange()).to.deep.equal(new Range(10, 5, 10, 8)); - + ace.selection.setRange(new Range(10, 8, 10, 8)); txtFind.execCommand(prev); expect(ace.selection.getRange()).to.deep.equal(new Range(10, 5, 10, 8)); - + ace.selection.setRange(new Range(10, 7, 10, 7)); txtFind.execCommand(next); expect(ace.selection.getRange()).to.deep.equal(new Range(20, 5, 20, 8)); - + ace.selection.setRange(new Range(20, 7, 20, 7)); txtFind.execCommand(prev); expect(ace.selection.getRange()).to.deep.equal(new Range(10, 5, 10, 8)); @@ -248,7 +246,7 @@ require(["lib/architect/architect", "lib/chai/chai", "text!plugins/c9.ide.layout txtReplace.execCommand(prev); expect(txtReplace.getValue()).equal("baz"); txtReplace.execCommand(prev); - expect(txtReplace.getValue()).equal("bar"); + expect(txtReplace.getValue()).equal("bar"); }); it('should replace all in selection', function(done) { var range = new Range(5, 2, 7, 1); @@ -276,17 +274,17 @@ require(["lib/architect/architect", "lib/chai/chai", "text!plugins/c9.ide.layout done(); }); }); - + if (!onload.remain) { after(function(done) { tabs.unload(); - + document.body.style.marginBottom = ""; done(); }); } }); - - onload && onload(); + + register(); } -}); \ No newline at end of file +}); diff --git a/plugins/c9.ide.find/find.nak_test.js b/plugins/c9.ide.find/find.nak_test.js index 0163dd88..7fde730d 100644 --- a/plugins/c9.ide.find/find.nak_test.js +++ b/plugins/c9.ide.find/find.nak_test.js @@ -25,7 +25,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.ide.ui/lib_apf", "plugins/c9.ide.ui/ui", "plugins/c9.core/settings", - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.find/find", basePath: baseProc @@ -42,6 +41,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/fs", "plugins/c9.fs/proc", @@ -117,7 +117,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], it('should search for a token', function(done) { find.findFiles(options1, function(err, results, data) { - Assert.equal(!err, true); + if (err) throw err; expect(results).to.match(/Found 8 matches in 4 files/); var lines = results.split("\n"); Assert.equal(lines.length, 16); @@ -361,6 +361,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.immediate/immediate_test.js b/plugins/c9.ide.immediate/immediate_test.js index 01d9f130..d72e1641 100644 --- a/plugins/c9.ide.immediate/immediate_test.js +++ b/plugins/c9.ide.immediate/immediate_test.js @@ -54,7 +54,6 @@ require(["lib/architect/architect", "lib/chai/chai"], ] }}} }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -118,6 +117,7 @@ require(["lib/architect/architect", "lib/chai/chai"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.keys/commands", { packagePath: "plugins/c9.ide.run/run", @@ -154,8 +154,6 @@ require(["lib/architect/architect", "lib/chai/chai"], describe('immediate', function() { before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); window.bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; window.bar.$ext.style.position = "fixed"; @@ -206,6 +204,6 @@ require(["lib/architect/architect", "lib/chai/chai"], // }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.keys/commands_test.js b/plugins/c9.ide.keys/commands_test.js index 8e8d9d98..ad6aa182 100644 --- a/plugins/c9.ide.keys/commands_test.js +++ b/plugins/c9.ide.keys/commands_test.js @@ -94,6 +94,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.language.javascript.tern/architect_resolver_test.js b/plugins/c9.ide.language.javascript.tern/architect_resolver_test.js index 90d92197..4b87c092 100644 --- a/plugins/c9.ide.language.javascript.tern/architect_resolver_test.js +++ b/plugins/c9.ide.language.javascript.tern/architect_resolver_test.js @@ -3,296 +3,116 @@ "use client"; -require(["lib/architect/architect", "lib/chai/chai", "plugins/c9.ide.language/complete_util", "assert"], function (architect, chai, util, complete) { - var expect = chai.expect; - var assert = require("assert"); - - util.setStaticPrefix("/static"); - - expect.setupArchitectTest(window.plugins = [ - { - packagePath: "plugins/c9.core/c9", - workspaceId: "ubuntu/ip-10-35-77-180", - startdate: new Date(), - debug: true, - hosted: true, - local: false, - davPrefix: "/", - staticPrefix: "/static" - }, - - "plugins/c9.core/ext", - "plugins/c9.core/http-xhr", - "plugins/c9.core/util", - "plugins/c9.ide.ui/lib_apf", - { - packagePath: "plugins/c9.core/settings", - testing: true - }, - "plugins/c9.core/api.js", - { - packagePath: "plugins/c9.ide.ui/ui", - staticPrefix: "plugins/c9.ide.ui" - }, - "plugins/c9.ide.editors/document", - "plugins/c9.ide.editors/undomanager", - { - packagePath: "plugins/c9.ide.editors/editors", - defaultEditor: "ace" - }, - "plugins/c9.ide.editors/editor", - "plugins/c9.ide.editors/tabmanager", - "plugins/c9.ide.ui/focus", - "plugins/c9.ide.editors/pane", - "plugins/c9.ide.editors/tab", - { - packagePath: "plugins/c9.ide.ace/ace", - staticPrefix: "plugins/c9.ide.layout.classic" - }, - { - packagePath: "plugins/c9.ide.language/language", - workspaceDir: "/" - }, - "plugins/c9.ide.language.core/keyhandler", - "plugins/c9.ide.language/worker_util_helper", - "plugins/c9.ide.language.core/complete", - "plugins/c9.ide.language.core/tooltip", - "plugins/c9.ide.language.core/marker", - "plugins/c9.ide.language.generic/generic", - "plugins/c9.ide.language.css/css", - "plugins/c9.ide.language.javascript/javascript", - "plugins/c9.ide.language.javascript.infer/jsinfer", - { - packagePath: "plugins/c9.ide.language.javascript.tern/tern", - defs: [], - plugins: [ - { - name: "doc_comment", - path: "tern/plugin/doc_comment", - enabled: true, - hidden: true, - }, - { - name: "node", - path: "tern/plugin/node", - enabled: true, - hidden: false, - }, - { - name: "requirejs", - path: "tern/plugin/requirejs", - enabled: true, - hidden: false, - }, - { - name: "architect_resolver", - path: "./architect_resolver_worker", - enabled: true, - hidden: true, - }, - ], - }, - "plugins/c9.ide.language.javascript.tern/architect_resolver", - "plugins/c9.ide.keys/commands", - "plugins/c9.fs/proc", - "plugins/c9.vfs.client/vfs_client", - "plugins/c9.vfs.client/endpoint", - "plugins/c9.ide.auth/auth", - "plugins/c9.fs/fs", - "plugins/c9.ide.ui/menus", - { - packagePath: "plugins/c9.ide.immediate/immediate", - staticPrefix: "plugins/c9.ide.layout.classic" - }, - "plugins/c9.ide.language.javascript.immediate/immediate", - "plugins/c9.ide.immediate/evaluator", - "plugins/c9.ide.immediate/evaluators/browserjs", - "plugins/c9.ide.console/console", - "plugins/c9.ide.ace.statusbar/statusbar", - "plugins/c9.ide.ace.gotoline/gotoline", - - { - consumes: [ - "tabManager", - "ace", - "Document", - "language.keyhandler", - "language.complete", - "language" - ], - provides: [], - setup: main - } - ], architect); - - function main(options, imports, register) { +require(["plugins/c9.ide.language/test_base"], function(base) { + base.setup(function(err, imports, helpers) { var tabs = imports.tabManager; var ace = imports.ace; var Document = imports.Document; var language = imports.language; var complete = imports["language.complete"]; - util.setStaticPrefix("/static"); - complete.$setShowDocDelay(50); + var chai = require("lib/chai/chai"); + var expect = chai.expect; + var assert = require("assert"); - var timer; - after(function() { clearTimeout(timer); }); - - function getTabHtml(tab) { - return tab.pane.aml.getPage("editor::" + tab.editorType).$ext; - } - - function afterCompleteOpen(callback, delay) { - clearTimeout(timer); - timer = setTimeout(function() { - var el = document.getElementsByClassName("ace_autocomplete")[0]; - if (!el || el.style.display === "none") - return afterCompleteOpen(callback, 100); - timer = setTimeout(function() { - callback(el); - }, 5); - }, delay || 5); - } - - function afterCompleteDocOpen(callback, delay) { - timer = setTimeout(function() { - var el = document.getElementsByClassName("code_complete_doc_text")[0]; - if (!el || el.style.display === "none") - return afterCompleteDocOpen(callback); - timer = setTimeout(function() { - callback(el); - }, 5); - }, delay || 5); - } - - function isCompleterOpen() { - var el = document.getElementsByClassName("ace_autocomplete")[0]; - return el && el.style.display === "none"; - } - - expect.html.setConstructor(function(tab) { - if (typeof tab == "object") - return getTabHtml(tab); - }); - - describe('ace', function() { - this.timeout(20000); + describe("architect_resolver", function() { + var jsTab; + var jsSession; + + // Setup + beforeEach(setup); before(function(done) { - window.bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; - window.bar.$ext.style.position = "fixed"; - window.bar.$ext.style.left = "20px"; - window.bar.$ext.style.right = "20px"; - window.bar.$ext.style.bottom = "20px"; - window.bar.$ext.style.height = "33%"; - - document.body.style.marginBottom = "33%"; - - tabs.once("ready", function() { - tabs.getPanes()[0].focus(); + setup(function() { + // Trigger intialization + jsTab.editor.ace.onTextInput("m"); + helpers.afterCompleteOpen(function(el) { + setup(done); + }); + }); + }); + + function setup(done) { + tabs.getTabs().forEach(function(tab) { + tab.close(true); + }); + // tab.close() isn't quite synchronous, wait for it :( + complete.closeCompletionBox(); + setTimeout(function() { + tabs.openFile("/plugins/c9.dummy/architect_test_dummy.js", function(err, tab) { + jsTab = tab; + jsSession = jsTab.document.getSession().session; + expect(jsSession).to.not.equal(null); + setTimeout(function() { + complete.closeCompletionBox(); + jsTab.editor.ace.selection.setSelectionRange({ start: { row: 15, column: 17 }, end: { row: 15, column: 17 }}); + jsTab.editor.ace.renderer.scrollCursorIntoView(); + done(); + }); + }); + }, 100); + } + + it('shows an inference completer popup for a local architect module', function(done) { + jsTab.editor.ace.onTextInput("my"); + helpers.afterCompleteOpen(function(el) { + expect.html(el).text(/myplugin/); done(); }); }); - describe("architect_resolver", function() { - var jsTab; - var jsSession; - - // Setup - beforeEach(setup); - - before(function(done) { - setup(function() { - // Trigger intialization - jsTab.editor.ace.onTextInput("m"); - afterCompleteOpen(function(el) { - setup(done); - }); - }); + it('shows a completer popup for a non-local architect module', function(done) { + jsTab.editor.ace.onTextInput("P"); + helpers.afterCompleteOpen(function(el) { + expect.html(el).text(/Plugin/); + done(); }); - - function setup(done) { - tabs.getTabs().forEach(function(tab) { - tab.close(true); - }); - // tab.close() isn't quite synchronous, wait for it :( - complete.closeCompletionBox(); - setTimeout(function() { - tabs.openFile("/plugins/c9.dummy/architect_test_dummy.js", function(err, tab) { - jsTab = tab; - jsSession = jsTab.document.getSession().session; - expect(jsSession).to.not.equal(null); - setTimeout(function() { - complete.closeCompletionBox(); - jsTab.editor.ace.selection.setSelectionRange({ start: { row: 15, column: 17 }, end: { row: 15, column: 17 }}); - done(); - }); - }); - }, 500); - } - - it('shows an inference completer popup for a local architect module', function(done) { - jsTab.editor.ace.onTextInput("my"); - afterCompleteOpen(function(el) { - expect.html(el).text(/myplugin/); - done(); - }); + }); + + it('shows a documentation popup for non-local architect functions', function(done) { + jsTab.editor.ace.onTextInput("Plugin"); + jsTab.editor.ace.onTextInput("."); + helpers.afterCompleteDocOpen(function(el) { + expect.html(el).text(/so bogus/); + done(); }); - - it('shows an completer popup for a non-local architect module', function(done) { - jsTab.editor.ace.onTextInput("P"); - afterCompleteOpen(function(el) { - expect.html(el).text(/Plugin/); - done(); - }); + }); + + it('shows a completion indirect import references', function(done) { + jsTab.editor.ace.onTextInput("Plugin;\nPlugin"); + jsTab.editor.ace.onTextInput("."); + helpers.afterCompleteDocOpen(function(el) { + expect.html(el).text(/so bogus/); + done(); }); - - it('shows a documentation popup for non-local architect functions', function(done) { - jsTab.editor.ace.onTextInput("Plugin"); - jsTab.editor.ace.onTextInput("."); - afterCompleteDocOpen(function(el) { - expect.html(el).text(/so bogus/); - done(); - }); + }); + + it('shows types for a non-local architect function', function(done) { + jsTab.editor.ace.onTextInput("Plugin"); + jsTab.editor.ace.onTextInput("."); + helpers.afterCompleteDocOpen(function(el) { + expect.html(el).text(/s : string/); + done(); }); - - it('shows a completion indirect import references', function(done) { - jsTab.editor.ace.onTextInput("Plugin;\nPlugin"); - jsTab.editor.ace.onTextInput("."); - afterCompleteDocOpen(function(el) { - expect.html(el).text(/so bogus/); - done(); - }); + }); + + it('shows a documentation popup for modules', function(done) { + jsTab.editor.ace.onTextInput("Pl"); + helpers.afterCompleteDocOpen(function(el) { + expect.html(el).text(/dummy[\s\S]*documentation/); + assert(!el.textContent.match(/\*/)); + done(); }); - - it('shows types for a non-local architect function', function(done) { - jsTab.editor.ace.onTextInput("Plugin"); - jsTab.editor.ace.onTextInput("."); - afterCompleteDocOpen(function(el) { - expect.html(el).text(/s : string/); - done(); - }); - }); - - it('shows a documentation popup for modules', function(done) { - jsTab.editor.ace.onTextInput("Pl"); - afterCompleteDocOpen(function(el) { - expect.html(el).text(/dummy[\s\S]*documentation/); - assert(!el.textContent.match(/\*/)); - done(); - }); - }); - - it('shows module name completions for imports', function(done) { - jsTab.editor.ace.onTextInput('main.consumes = ["u'); - afterCompleteOpen(function(el) { - expect.html(el).text(/ui/); - done(); - }); + }); + + it('shows module name completions for imports', function(done) { + jsTab.editor.ace.onTextInput('main.consumes = ["u'); + helpers.afterCompleteOpen(function(el) { + expect.html(el).text(/ui/); + done(); }); }); }); - - onload && onload(); - } + + }); }); diff --git a/plugins/c9.ide.language.jsonalyzer/server/jsonalyzer_server_test.js b/plugins/c9.ide.language.jsonalyzer/server/jsonalyzer_server_test.js index ec2122f6..f064da50 100644 --- a/plugins/c9.ide.language.jsonalyzer/server/jsonalyzer_server_test.js +++ b/plugins/c9.ide.language.jsonalyzer/server/jsonalyzer_server_test.js @@ -2,290 +2,131 @@ "use client"; -require(["lib/architect/architect", "lib/chai/chai", "plugins/c9.ide.language/complete_util", "ace/test/assertions"], function (architect, chai, util, complete) { - var expect = chai.expect; - var assert = require("ace/test/assertions"); - - util.setStaticPrefix("/static"); - - expect.setupArchitectTest([ - { - packagePath: "plugins/c9.core/c9", - workspaceId: "ubuntu/ip-10-35-77-180", - startdate: new Date(), - debug: true, - hosted: true, - local: false, - davPrefix: "/", - staticPrefix: "/static" - }, - - "plugins/c9.core/ext", - "plugins/c9.core/http-xhr", - "plugins/c9.core/util", - "plugins/c9.ide.ui/lib_apf", - { - packagePath: "plugins/c9.core/settings", - testing: true - }, - "plugins/c9.core/api.js", - { - packagePath: "plugins/c9.ide.ui/ui", - staticPrefix: "plugins/c9.ide.ui" - }, - "plugins/c9.ide.editors/document", - "plugins/c9.ide.editors/undomanager", - { - packagePath: "plugins/c9.ide.editors/editors", - defaultEditor: "ace" - }, - "plugins/c9.ide.editors/editor", - "plugins/c9.ide.editors/tabmanager", - "plugins/c9.ide.ui/focus", - "plugins/c9.ide.editors/pane", - "plugins/c9.ide.editors/tab", - { - packagePath: "plugins/c9.ide.ace/ace", - staticPrefix: "plugins/c9.ide.layout.classic" - }, - { - packagePath: "plugins/c9.ide.language/language", - workspaceDir: "/" - }, - "plugins/c9.ide.language/worker_util_helper", - "plugins/c9.ide.language.core/keyhandler", - "plugins/c9.ide.language.core/complete", - "plugins/c9.ide.language.core/tooltip", - "plugins/c9.ide.language.core/marker", - "plugins/c9.ide.language.generic/generic", - "plugins/c9.ide.language.css/css", - "plugins/c9.ide.language.javascript/javascript", - "plugins/c9.ide.language.javascript.infer/jsinfer", - "plugins/c9.ide.keys/commands", - "plugins/c9.fs/proc", - "plugins/c9.vfs.client/vfs_client", - "plugins/c9.vfs.client/endpoint", - "plugins/c9.ide.auth/auth", - "plugins/c9.fs/fs", - "plugins/c9.ide.ui/menus", - { - packagePath: "plugins/c9.ide.immediate/immediate", - staticPrefix: "plugins/c9.ide.layout.classic" - }, - "plugins/c9.ide.language.javascript.immediate/immediate", - "plugins/c9.ide.immediate/evaluator", - "plugins/c9.ide.immediate/evaluators/browserjs", - "plugins/c9.ide.console/console", - "plugins/c9.ide.ace.statusbar/statusbar", - "plugins/c9.ide.ace.gotoline/gotoline", - "plugins/c9.ide.save/save", - { - packagePath: "plugins/c9.ide.language.jsonalyzer/jsonalyzer", - bashBin: "bash", - useCollab: false, - useSend: true, - homeDir: "~", - workspaceDir: "/fake_root/", - }, - "plugins/c9.ide.language.jsonalyzer/mock_collab", - // "plugins/c9.ide.language.jsonalyzer/architect_resolver", - - { - consumes: [ - "tabManager", - "ace", - "Document", - "language.keyhandler", - "language.complete", - "language" - ], - provides: [], - setup: main - } - ], architect); - - function main(options, imports, register) { +require(["plugins/c9.ide.language/test_base"], function(base) { + base.setup(function(err, imports, helpers) { var tabs = imports.tabManager; var ace = imports.ace; var Document = imports.Document; var language = imports.language; var complete = imports["language.complete"]; - util.setStaticPrefix("/static"); - complete.$setShowDocDelay(50); + var chai = require("lib/chai/chai"); + var expect = chai.expect; + var assert = require("assert"); - function getTabHtml(tab) { - return tab.pane.aml.getPage("editor::" + tab.editorType).$ext; - } - - function afterCompleteOpen(callback) { - setTimeout(function() { - var el = document.getElementsByClassName("ace_autocomplete")[0]; - if (!el || el.style.display === "none") - return setTimeout(function() { - afterCompleteOpen(callback); - }, 1000); - setTimeout(function() { - callback(el); - }, 50); - }, 50); - } - - function afterCompleteDocOpen(callback) { - setTimeout(function() { - var el = document.getElementsByClassName("code_complete_doc_text")[0]; - if (!el || el.style.display === "none") - return afterCompleteDocOpen(callback); - setTimeout(function() { - callback(el); - }, 50); - }, 50); - } - - function isCompleterOpen() { - var el = document.getElementsByClassName("ace_autocomplete")[0]; - return el && el.style.display === "none"; - } - - expect.html.setConstructor(function(tab) { - if (typeof tab == "object") - return getTabHtml(tab); - }); - - describe('ace', function() { - this.timeout(30000); + describe("analysis", function() { + var tab; + var session; + var worker; + before(function(done) { - window.bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; - window.bar.$ext.style.position = "fixed"; - window.bar.$ext.style.left = "20px"; - window.bar.$ext.style.right = "20px"; - window.bar.$ext.style.bottom = "20px"; - window.bar.$ext.style.height = "33%"; - - document.body.style.marginBottom = "33%"; - - tabs.on("ready", function() { - tabs.getPanes()[0].focus(); + language.getWorker(function(err, result) { + worker = result; done(); }); }); - describe("analysis", function() { - var tab; - var session; - var worker; - - before(function(done) { - language.getWorker(function(err, result) { - worker = result; - done(); - }); + // Setup + beforeEach(function(done) { + tabs.getTabs().forEach(function(tab) { + tab.close(true); }); - - // Setup - beforeEach(function(done) { - tabs.getTabs().forEach(function(tab) { - tab.close(true); - }); - // tab.close() isn't quite synchronous, wait for it :( - complete.closeCompletionBox(); - setTimeout(function() { - tabs.openFile("/test_broken.sh", function(err, _tab) { - if (err) return done(err); - tab = _tab; - session = tab.document.getSession().session; - expect(session).to.not.equal(null); - setTimeout(function() { - complete.closeCompletionBox(); - done(); - }); + // tab.close() isn't quite synchronous, wait for it :( + complete.closeCompletionBox(); + setTimeout(function() { + tabs.openFile("/test_broken.sh", function(err, _tab) { + if (err) return done(err); + tab = _tab; + session = tab.document.getSession().session; + expect(session).to.not.equal(null); + setTimeout(function() { + complete.closeCompletionBox(); + done(); }); }); }); - - it("shows syntax error markers for shell scripts", function beginTest(done) { - // Wait for analysis to complete - if (!session.getAnnotations().length) - return session.once("changeAnnotation", beginTest.bind(null, done)); + }); + + it("shows syntax error markers for shell scripts", function beginTest(done) { + // Wait for analysis to complete + if (!session.getAnnotations().length) + return session.once("changeAnnotation", beginTest.bind(null, done)); - expect(session.getAnnotations()).to.have.length(1); - done(); - }); - - it("shows syntax error markers for php scripts", function(done) { - tabs.openFile("/test_broken.php", function(err, _tab) { - tab = _tab; - tabs.focusTab(tab); - session = tab.document.getSession().session; - - session.on("changeAnnotation", testAnnos); - testAnnos(); - - function testAnnos() { - if (!session.getAnnotations().length) - return; - session.off("changeAnnotation", testAnnos); - done(); - } - }); - }); - - it("shows syntax error markers for go scripts", function(done) { - tabs.openFile("/test_broken.go", function(err, _tab) { - tab = _tab; - tabs.focusTab(tab); - session = tab.document.getSession().session; - - session.on("changeAnnotation", testAnnos); - testAnnos(); - - function testAnnos() { - if (!session.getAnnotations().length) - return; - session.off("changeAnnotation", testAnnos); - done(); - } - }); - }); - - it("shows syntax error markers for ruby scripts", function(done) { - tabs.openFile("/test_broken.rb", function(err, _tab) { - tab = _tab; - tabs.focusTab(tab); - session = tab.document.getSession().session; - - session.on("changeAnnotation", testAnnos); - testAnnos(); - - function testAnnos() { - if (!session.getAnnotations().length) - return; - session.off("changeAnnotation", testAnnos); - done(); - } - }); - }); - - it('does completion without going to the server', function beginTest(done) { - // Wait for analysis to complete - if (!session.getAnnotations().length) - return session.once("changeAnnotation", beginTest.bind(null, done)); - - var callServer; - worker.on("jsonalyzerCallServer", callServer = function() { - assert(false, "Server should not be called"); - }); - afterCompleteOpen(function(el) { - expect.html(el).text(/foo/); - worker.off("jsonalyzerCallServer", callServer); + expect(session.getAnnotations()).to.have.length(1); + done(); + }); + + it.skip("shows syntax error markers for php scripts", function(done) { + tabs.openFile("/test_broken.php", function(err, _tab) { + tab = _tab; + tabs.focusTab(tab); + session = tab.document.getSession().session; + + session.on("changeAnnotation", testAnnos); + testAnnos(); + + function testAnnos() { + if (!session.getAnnotations().length) + return; + session.off("changeAnnotation", testAnnos); done(); - }); - tab.editor.ace.selection.setSelectionRange({ start: { row: 1, column: 1 }, end: { row: 1, column: 1 }}); - complete.deferredInvoke(false, tab.editor.ace); + } }); }); + + it.skip("shows syntax error markers for go scripts", function(done) { + tabs.openFile("/test_broken.go", function(err, _tab) { + tab = _tab; + tabs.focusTab(tab); + session = tab.document.getSession().session; + + session.on("changeAnnotation", testAnnos); + testAnnos(); + + function testAnnos() { + if (!session.getAnnotations().length) + return; + session.off("changeAnnotation", testAnnos); + done(); + } + }); + }); + + it.skip("shows syntax error markers for ruby scripts", function(done) { + tabs.openFile("/test_broken.rb", function(err, _tab) { + tab = _tab; + tabs.focusTab(tab); + session = tab.document.getSession().session; + + session.on("changeAnnotation", testAnnos); + testAnnos(); + + function testAnnos() { + if (!session.getAnnotations().length) + return; + session.off("changeAnnotation", testAnnos); + done(); + } + }); + }); + + it('does completion without going to the server', function beginTest(done) { + // Wait for analysis to complete + if (!session.getAnnotations().length) + return session.once("changeAnnotation", beginTest.bind(null, done)); + + var callServer; + worker.on("jsonalyzerCallServer", callServer = function() { + assert(false, "Server should not be called"); + }); + helpers.afterCompleteOpen(function(el) { + expect.html(el).text(/foo/); + worker.off("jsonalyzerCallServer", callServer); + done(); + }); + tab.editor.ace.selection.setSelectionRange({ start: { row: 1, column: 1 }, end: { row: 1, column: 1 }}); + complete.deferredInvoke(false, tab.editor.ace); + }); }); - - onload && onload(); - } + }); }); diff --git a/plugins/c9.ide.panels/panels_test.js b/plugins/c9.ide.panels/panels_test.js index 172edef2..a9b1bed7 100644 --- a/plugins/c9.ide.panels/panels_test.js +++ b/plugins/c9.ide.panels/panels_test.js @@ -14,7 +14,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], settings: "default", testing: true }, - "plugins/c9.core/api.js", "plugins/c9.ide.ui/lib_apf", "plugins/c9.ide.ui/anims", { @@ -420,6 +419,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.preferences/preferences_test.js b/plugins/c9.ide.preferences/preferences_test.js index e398b06f..88d41f1d 100644 --- a/plugins/c9.ide.preferences/preferences_test.js +++ b/plugins/c9.ide.preferences/preferences_test.js @@ -32,7 +32,6 @@ require([ packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", "plugins/c9.ide.keys/commands", "plugins/c9.ide.keys/editor", { @@ -63,6 +62,7 @@ require([ "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["Plugin", "tabManager", "preferences", "settings", "ui", "util", "commands", "preferences.general"], @@ -89,6 +89,7 @@ require([ this.timeout(20000); before(function(done) { + bar.$ext.style.height = "66%"; document.body.style.marginBottom = "66%"; @@ -187,6 +188,6 @@ require([ } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.build/build_test.js b/plugins/c9.ide.run.build/build_test.js index 88b9fff1..82ef8947 100644 --- a/plugins/c9.ide.run.build/build_test.js +++ b/plugins/c9.ide.run.build/build_test.js @@ -44,7 +44,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }}} } }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -74,6 +73,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }, "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.ide.run/run", staticPrefix: "plugins/c9.ide.run", @@ -187,8 +187,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], describe('build', function() { before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; bar.$ext.style.position = "fixed"; @@ -366,6 +364,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.build/gui_test.js b/plugins/c9.ide.run.build/gui_test.js index 3796601e..a16a9ef9 100644 --- a/plugins/c9.ide.run.build/gui_test.js +++ b/plugins/c9.ide.run.build/gui_test.js @@ -42,7 +42,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], ] }}} }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -66,6 +65,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.ide.run/run", testing: true, @@ -165,8 +165,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], describe('build gui', function() { before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; bar.$ext.style.position = "fixed"; @@ -232,6 +230,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.debug/breakpoints_test.js b/plugins/c9.ide.run.debug/breakpoints_test.js index fc68b715..0555cc35 100644 --- a/plugins/c9.ide.run.debug/breakpoints_test.js +++ b/plugins/c9.ide.run.debug/breakpoints_test.js @@ -43,6 +43,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.run.debug/breakpoints", { packagePath: "plugins/c9.ide.panels/panels", @@ -217,6 +218,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.debug/callstack_test.js b/plugins/c9.ide.run.debug/callstack_test.js index 9aeb827e..92145e2c 100644 --- a/plugins/c9.ide.run.debug/callstack_test.js +++ b/plugins/c9.ide.run.debug/callstack_test.js @@ -1,4 +1,4 @@ -/*global describe it before */ +/*global describe it before bar */ "use client"; @@ -32,10 +32,12 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.run.debug/callstack", + "plugins/c9.ide.run.debug/debugpanel", { - consumes: ["callstack"], + consumes: ["callstack", "layout"], provides: [], setup: main } @@ -43,19 +45,13 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function main(options, imports, register) { var callstack = imports.callstack; - callstack.show(); - var datagrid = callstack.getElement("datagrid"); + var layout = imports.layout; + var datagrid; - function countEvents(count, expected, done) { - if (count == expected) - done(); - else - throw new Error("Wrong Event Count: " - + count + " of " + expected); - } - - describe('breakpoints', function() { + describe('callstack', function() { before(function(done) { + var bar = layout.findParent() + bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; bar.$ext.style.position = "fixed"; bar.$ext.style.top = "75px"; @@ -65,6 +61,9 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], bar.$ext.style.width = "300px"; bar.$ext.style.height = ""; + callstack.show({ html: bar.$ext}); + datagrid = callstack.getElement("datagrid"); + done(); }); @@ -89,6 +88,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.debug/debuggers/debugger_test.js b/plugins/c9.ide.run.debug/debuggers/debugger_test.js index 86f966f0..dc5169b3 100644 --- a/plugins/c9.ide.run.debug/debuggers/debugger_test.js +++ b/plugins/c9.ide.run.debug/debuggers/debugger_test.js @@ -86,6 +86,7 @@ require([ "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.ide.run/run", testing: true, @@ -118,13 +119,12 @@ require([ }, "plugins/c9.ide.run.debug/debuggers/v8/v8debugger", "plugins/c9.ide.run.debug/breakpoints", - "plugins/c9.ide.run.debug/buttons", "plugins/c9.ide.run.debug/callstack", - "plugins/c9.ide.run.debug/immediate", "plugins/c9.ide.run.debug/variables", "plugins/c9.ide.run.debug/watches", //"plugins/c9.ide.run.debug/quickwatch", - + "plugins/c9.ide.run.debug/debuggers/socket", + "plugins/c9.ide.run.debug/debugpanel", { consumes: ["run", "debugger", "fs", "tabManager", "sourcemap", "v8debugger"], provides: [], @@ -154,8 +154,6 @@ require([ describe('debug', function() { before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); document.body.style.marginBottom = "200px"; done(); @@ -424,6 +422,6 @@ require([ // }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.debug/variables_test.js b/plugins/c9.ide.run.debug/variables_test.js index 01f64000..142a3232 100644 --- a/plugins/c9.ide.run.debug/variables_test.js +++ b/plugins/c9.ide.run.debug/variables_test.js @@ -1,4 +1,4 @@ -/*global describe it before */ +/*global describe it before bar */ "use client"; @@ -32,7 +32,10 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.run.debug/variables", + "plugins/c9.ide.run.debug/debugpanel", + "plugins/c9.ide.run.debug/callstack", { consumes: ["variables"], @@ -43,8 +46,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function main(options, imports, register) { var variables = imports.variables; - variables.show(); - var datagrid = variables.getElement("datagrid"); + var datagrid; function countEvents(count, expected, done) { if (count == expected) @@ -56,6 +58,8 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], describe('breakpoints', function() { before(function(done) { + var datagrid = variables.getElement("datagrid"); + bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; bar.$ext.style.position = "fixed"; bar.$ext.style.top = "75px"; @@ -65,6 +69,10 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], bar.$ext.style.width = "300px"; bar.$ext.style.height = ""; + variables.show({ + html: bar.$ext + }); + done(); }); @@ -89,6 +97,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run.debug/watches_test.js b/plugins/c9.ide.run.debug/watches_test.js index c6a062ef..930dcda0 100644 --- a/plugins/c9.ide.run.debug/watches_test.js +++ b/plugins/c9.ide.run.debug/watches_test.js @@ -1,4 +1,4 @@ -/*global describe it before */ +/*global describe it before bar */ "use client"; @@ -49,6 +49,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.ui/menus", "plugins/c9.ide.panels/panels", "plugins/c9.ide.panels/panel", @@ -61,7 +62,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], "plugins/c9.ide.run.debug/breakpoints", "plugins/c9.ide.run.debug/watches", { - consumes: ["panels", "debugger", "watches", "breakpoints"], + consumes: ["panels", "debugger", "watches", "breakpoints", "layout"], provides: [], setup: main } @@ -72,19 +73,9 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], var panels = imports.panels; var breakpoints = imports.breakpoints; var debug = imports.debugger; - - panels.activate("debugger"); - // watches.show(); - var datagrid = watches.getElement("datagrid"); + var layout = imports.layout; + var datagrid; - function countEvents(count, expected, done) { - if (count == expected) - done(); - else - throw new Error("Wrong Event Count: " - + count + " of " + expected); - } - var testDebugger = new EventEmitter(); testDebugger.attach = function () { testDebugger.emit("attached", { breakpoints: breakpoints }); @@ -92,6 +83,10 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], describe('breakpoints', function() { before(function(done) { + layout.findParent(); + panels.activate("debugger"); + var datagrid = watches.getElement("datagrid"); + bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; bar.$ext.style.position = "fixed"; bar.$ext.style.top = "75px"; @@ -130,6 +125,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"], // }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run/output_test.js b/plugins/c9.ide.run/output_test.js index fa6ea70d..9c399cea 100644 --- a/plugins/c9.ide.run/output_test.js +++ b/plugins/c9.ide.run/output_test.js @@ -25,7 +25,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -75,6 +74,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.ace/ace", @@ -177,6 +177,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.run/run_test.js b/plugins/c9.ide.run/run_test.js index 42ffed07..8ee0da2f 100644 --- a/plugins/c9.ide.run/run_test.js +++ b/plugins/c9.ide.run/run_test.js @@ -54,7 +54,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }}} } }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -84,6 +83,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }, "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.ide.run/run", testing: true, @@ -154,8 +154,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], describe('run', function() { before(function(done) { - apf.config.setProperty("allow-select", false); - apf.config.setProperty("allow-blur", false); bar.$ext.style.background = "rgba(220, 220, 220, 0.93)"; bar.$ext.style.position = "fixed"; @@ -411,6 +409,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.save/autosave_test.js b/plugins/c9.ide.save/autosave_test.js index 4ebf113b..70bb4dba 100644 --- a/plugins/c9.ide.save/autosave_test.js +++ b/plugins/c9.ide.save/autosave_test.js @@ -29,7 +29,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -56,6 +55,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }, "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -161,6 +161,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.save/save_test.js b/plugins/c9.ide.save/save_test.js index 052e2e30..d8cb10aa 100644 --- a/plugins/c9.ide.save/save_test.js +++ b/plugins/c9.ide.save/save_test.js @@ -29,7 +29,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "async"], packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -50,6 +49,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "async"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -107,8 +107,10 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "async"], var count = 0; files.slice(0, 3).forEach(function(path, i) { count++; - fs.writeFile(path, path, function() { - tabs.openFile(path, function() { + fs.writeFile(path, path, function(err) { + if (err) return done(err); + tabs.openFile(path, function(err) { + if (err) return done(err); if (--count === 0) done(); }); @@ -473,6 +475,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "async"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.terminal.monitor/monitor_test.js b/plugins/c9.ide.terminal.monitor/monitor_test.js index 48a5f214..b15519b1 100644 --- a/plugins/c9.ide.terminal.monitor/monitor_test.js +++ b/plugins/c9.ide.terminal.monitor/monitor_test.js @@ -23,7 +23,6 @@ require(["lib/architect/architect", "lib/chai/chai", "sinon"], function(architec packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -38,20 +37,6 @@ require(["lib/architect/architect", "lib/chai/chai", "sinon"], function(architec "plugins/c9.ide.editors/tab", "plugins/c9.ide.terminal/terminal", "plugins/c9.ide.terminal.monitor/monitor", - // "plugins/c9.ide.terminal.monitor/message_view", - "plugins/c9.ide.preferences/preferences", - "plugins/c9.ide.ui/forms", - // { - // packagePath: "plugins/c9.fs/proc", - // tmuxName: "cloud9test" - // }, - "plugins/c9.vfs.client/vfs_client", - "plugins/c9.vfs.client/endpoint", - "plugins/c9.ide.auth/auth", - // { - // packagePath: "plugins/c9.fs/fs", - // baseProc: baseProc - // }, { consumes: ["tabManager", "c9", "terminal", "terminal.monitor", "terminal.monitor.message_view"], @@ -224,6 +209,6 @@ require(["lib/architect/architect", "lib/chai/chai", "sinon"], function(architec } - onload && onload(); + register(); } }); diff --git a/plugins/c9.ide.terminal/predict_echo_test.js b/plugins/c9.ide.terminal/predict_echo_test.js index 327352a4..a9850da8 100644 --- a/plugins/c9.ide.terminal/predict_echo_test.js +++ b/plugins/c9.ide.terminal/predict_echo_test.js @@ -25,7 +25,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -50,6 +49,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -561,6 +561,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse } }); - onload && onload(); + register(); } }); diff --git a/plugins/c9.ide.terminal/terminal_test.js b/plugins/c9.ide.terminal/terminal_test.js index e13b3dc8..488826bf 100644 --- a/plugins/c9.ide.terminal/terminal_test.js +++ b/plugins/c9.ide.terminal/terminal_test.js @@ -23,7 +23,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -46,6 +45,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -297,6 +297,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc } }); - onload && onload(); + register(); } }); diff --git a/plugins/c9.ide.threewaymerge/threewaymerge_test.js b/plugins/c9.ide.threewaymerge/threewaymerge_test.js index 3dff5bf9..33cc21da 100644 --- a/plugins/c9.ide.threewaymerge/threewaymerge_test.js +++ b/plugins/c9.ide.threewaymerge/threewaymerge_test.js @@ -34,10 +34,10 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events", "ace "plugins/c9.core/http-xhr", "plugins/c9.core/util", "plugins/c9.core/settings", - "plugins/c9.core/api.js", "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.ide.threewaymerge/threewaymerge", { consumes: ["threewaymerge", "fs"], diff --git a/plugins/c9.ide.tree/tree_test.js b/plugins/c9.ide.tree/tree_test.js index 82a00632..06e111b7 100644 --- a/plugins/c9.ide.tree/tree_test.js +++ b/plugins/c9.ide.tree/tree_test.js @@ -28,7 +28,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], settings: "default", testing: true }, - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -43,6 +42,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", "plugins/c9.fs/fs.cache.xml", "plugins/c9.ide.dialog/dialog", @@ -75,6 +75,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function getDomNode(treeNode) { var r = tree.tree.renderer; + r.scrollCaretIntoView(treeNode); r.$renderChanges(r.$loop.changes); var i = r.provider.getIndexForNode(treeNode); return r.$cellLayer.getDomNodeAtIndex(i); @@ -649,6 +650,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.ui/docklayout_test.js b/plugins/c9.ide.ui/docklayout_test.js index 8718bdff..f1533438 100644 --- a/plugins/c9.ide.ui/docklayout_test.js +++ b/plugins/c9.ide.ui/docklayout_test.js @@ -94,6 +94,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.ui/menus_test.js b/plugins/c9.ide.ui/menus_test.js index 90e7c2dd..9c75fc42 100644 --- a/plugins/c9.ide.ui/menus_test.js +++ b/plugins/c9.ide.ui/menus_test.js @@ -214,6 +214,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.ui/ui_test.js b/plugins/c9.ide.ui/ui_test.js index 828f9e6b..13c46b6c 100644 --- a/plugins/c9.ide.ui/ui_test.js +++ b/plugins/c9.ide.ui/ui_test.js @@ -118,6 +118,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.upload/upload_manager_test.js b/plugins/c9.ide.upload/upload_manager_test.js index c45097b7..43a4495f 100644 --- a/plugins/c9.ide.upload/upload_manager_test.js +++ b/plugins/c9.ide.upload/upload_manager_test.js @@ -20,6 +20,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: "plugins/c9.fs/mock" @@ -214,6 +215,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) }); } - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.upload/upload_progress_test.js b/plugins/c9.ide.upload/upload_progress_test.js index c21edade..68a68b79 100644 --- a/plugins/c9.ide.upload/upload_progress_test.js +++ b/plugins/c9.ide.upload/upload_progress_test.js @@ -22,7 +22,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.ide.ui/focus", "plugins/c9.ide.ui/lib_apf", "plugins/c9.core/settings", - "plugins/c9.core/api", "plugins/c9.ide.ui/anims", { packagePath: "plugins/c9.ide.ui/ui", @@ -44,6 +43,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -109,6 +109,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.upload/upload_test.js b/plugins/c9.ide.upload/upload_test.js index 83b72aa1..ce2e5325 100644 --- a/plugins/c9.ide.upload/upload_test.js +++ b/plugins/c9.ide.upload/upload_test.js @@ -23,7 +23,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.ide.ui/focus", "plugins/c9.ide.ui/lib_apf", "plugins/c9.core/settings", - "plugins/c9.core/api.js", { packagePath: "plugins/c9.ide.ui/ui", staticPrefix: "plugins/c9.ide.ui" @@ -46,6 +45,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { packagePath: "plugins/c9.fs/fs", baseProc: baseProc @@ -123,6 +123,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], } }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.watcher/watcher_test.js b/plugins/c9.ide.watcher/watcher_test.js index 49c387d6..4dcfd31e 100644 --- a/plugins/c9.ide.watcher/watcher_test.js +++ b/plugins/c9.ide.watcher/watcher_test.js @@ -29,6 +29,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["c9", "watcher", "fs"], @@ -186,6 +187,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.ide.welcome/welcome_test.js b/plugins/c9.ide.welcome/welcome_test.js index 920920d3..197a174b 100644 --- a/plugins/c9.ide.welcome/welcome_test.js +++ b/plugins/c9.ide.welcome/welcome_test.js @@ -31,7 +31,6 @@ require([ packagePath: "plugins/c9.core/settings", testing: true }, - "plugins/c9.core/api.js", "plugins/c9.ide.keys/commands", "plugins/c9.ide.keys/editor", { @@ -66,6 +65,7 @@ require([ "plugins/c9.vfs.client/vfs_client", "plugins/c9.vfs.client/endpoint", "plugins/c9.ide.auth/auth", + "plugins/c9.core/api", { consumes: ["tabManager", "welcome"], @@ -124,6 +124,6 @@ require([ }); }); - onload && onload(); + register(); } }); \ No newline at end of file diff --git a/plugins/c9.vfs.server/vfs_wrapper_test.js b/plugins/c9.vfs.server/vfs_wrapper_test.js index 4227346e..faf1c3d6 100644 --- a/plugins/c9.vfs.server/vfs_wrapper_test.js +++ b/plugins/c9.vfs.server/vfs_wrapper_test.js @@ -20,6 +20,7 @@ describe(__filename, function() { var home = vfs({ root: path.normalize(__dirname + "/.."), testing: true, + nopty: true }); wrapper = vfsWrapper(home, { diff --git a/test/client-integration/run-client-integration.phantom.js b/test/client-integration/run-client-integration.phantom.js index fdc867d7..a96ecdd3 100644 --- a/test/client-integration/run-client-integration.phantom.js +++ b/test/client-integration/run-client-integration.phantom.js @@ -153,8 +153,10 @@ page.open(address, function(status) { var count = 0; var failCount = 0; var timeout = null; + var suites = 0; function runTest(name, next) { + suites++; var subtests = 0; var failed = false; @@ -170,11 +172,20 @@ page.open(address, function(status) { log("# %s", name); window.c9Test.run(name, function(errors, out) { + if (errors) console.error(errors); + if (!out.tests || !out.tests.length) { + out.tests = [{ + state: "failed", + error: "test didn't complete" + }]; + } + out.tests.forEach(function(test, i) { count++; - if (test.state == "passed") return log("ok %s %s", count, test.title); - if (test.state == "failed") return fail(count, test); - log("ok %s # SKIP %s", count, test.title); + var index = suites + "." + i; + if (test.state === "passed") return log("ok %s %s", index, test.title); + if (test.state === "failed") return fail(index, test); + log("ok %s # SKIP %s", index, test.title); }); if (failed) {