2016-06-26 11:53:19 +00:00
|
|
|
/*global describe it before after */
|
|
|
|
|
|
|
|
"use client";
|
|
|
|
|
|
|
|
require([
|
|
|
|
"lib/architect/architect",
|
|
|
|
"lib/chai/chai",
|
|
|
|
"/vfs-root"
|
|
|
|
], function (architect, chai, baseProc) {
|
|
|
|
var expect = chai.expect;
|
|
|
|
|
|
|
|
expect.setupArchitectTest([
|
|
|
|
{
|
|
|
|
packagePath: "plugins/c9.core/c9",
|
|
|
|
workspaceId: "ubuntu/ip-10-35-77-180",
|
|
|
|
startdate: new Date(),
|
|
|
|
debug: true,
|
|
|
|
hosted: true,
|
|
|
|
local: false,
|
|
|
|
davPrefix: "/"
|
|
|
|
},
|
|
|
|
|
|
|
|
"plugins/c9.core/ext",
|
|
|
|
"plugins/c9.core/http-xhr",
|
|
|
|
"plugins/c9.core/util",
|
|
|
|
"plugins/c9.ide.ui/forms",
|
|
|
|
"plugins/c9.ide.ui/lib_apf",
|
|
|
|
"plugins/c9.ide.ui/menus",
|
|
|
|
"plugins/c9.ide.ui/anims",
|
|
|
|
"plugins/c9.ide.threewaymerge/threewaymerge",
|
|
|
|
{
|
|
|
|
packagePath: "plugins/c9.core/settings",
|
|
|
|
testing: true
|
|
|
|
},
|
|
|
|
"plugins/c9.ide.keys/commands",
|
|
|
|
"plugins/c9.ide.keys/editor",
|
|
|
|
{
|
|
|
|
packagePath: "plugins/c9.ide.ui/ui",
|
|
|
|
staticPrefix: "plugins/c9.ide.ui"
|
|
|
|
},
|
|
|
|
"plugins/c9.ide.editors/document",
|
|
|
|
"plugins/c9.ide.editors/undomanager",
|
|
|
|
"plugins/c9.ide.editors/editors",
|
|
|
|
"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",
|
|
|
|
"plugins/c9.ide.terminal/terminal",
|
|
|
|
"plugins/c9.ide.ace/ace",
|
|
|
|
{
|
|
|
|
packagePath: "plugins/c9.ide.preferences/preferences",
|
|
|
|
staticPrefix: "plugins/c9.ide.preferences"
|
|
|
|
},
|
|
|
|
"plugins/c9.ide.preferences/preferencepanel",
|
|
|
|
"plugins/c9.ide.preferences/general",
|
|
|
|
{
|
|
|
|
packagePath: "plugins/c9.fs/fs",
|
|
|
|
baseProc: baseProc
|
|
|
|
},
|
|
|
|
"plugins/c9.fs/proc",
|
|
|
|
"plugins/c9.vfs.client/vfs_client",
|
|
|
|
"plugins/c9.vfs.client/endpoint",
|
|
|
|
"plugins/c9.ide.auth/auth",
|
2017-12-13 20:17:16 +00:00
|
|
|
"plugins/c9.core/api",
|
2016-06-26 11:53:19 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
consumes: ["Plugin", "tabManager", "preferences", "settings", "ui", "util", "commands", "preferences.general"],
|
|
|
|
provides: [],
|
|
|
|
setup: main
|
|
|
|
}
|
|
|
|
], architect);
|
|
|
|
|
|
|
|
function main(options, imports, register) {
|
|
|
|
var tabs = imports.tabManager;
|
|
|
|
var ui = imports.ui;
|
|
|
|
var prefs = imports.preferences;
|
|
|
|
var settings = imports.settings;
|
|
|
|
var commands = imports.commands;
|
|
|
|
var Plugin = imports.Plugin;
|
|
|
|
var general = imports["preferences.general"];
|
|
|
|
|
|
|
|
expect.html.setConstructor(function(tab) {
|
|
|
|
if (typeof tab == "object")
|
|
|
|
return tab.pane.aml.getPage("editor::" + tab.editorType).$ext;
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('preferences', function() {
|
|
|
|
this.timeout(20000);
|
|
|
|
|
|
|
|
before(function(done) {
|
2017-12-13 20:17:16 +00:00
|
|
|
|
2016-06-26 11:53:19 +00:00
|
|
|
bar.$ext.style.height = "66%";
|
|
|
|
|
|
|
|
document.body.style.marginBottom = "66%";
|
|
|
|
|
2017-01-30 11:32:54 +00:00
|
|
|
tabs.once("ready", function() {
|
2016-06-26 11:53:19 +00:00
|
|
|
prefs.activate(general);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var plugin = new Plugin();
|
|
|
|
|
2017-01-30 11:32:54 +00:00
|
|
|
describe("addSettings", function() {
|
2016-06-26 11:53:19 +00:00
|
|
|
|
|
|
|
it('should open a pane with just an editor', function(done) {
|
|
|
|
settings.set("user/general/keybindings/@preset", "custom");
|
|
|
|
|
|
|
|
prefs.add({
|
2017-01-30 11:32:54 +00:00
|
|
|
"General": {
|
|
|
|
"Application": {},
|
|
|
|
"Run / Debug": {}
|
2016-06-26 11:53:19 +00:00
|
|
|
},
|
2017-01-30 11:32:54 +00:00
|
|
|
"Code Tools": {
|
|
|
|
"Language Support": {},
|
|
|
|
"Code Tools": {},
|
|
|
|
"Code Formatter": {}
|
2016-06-26 11:53:19 +00:00
|
|
|
}
|
|
|
|
}, plugin);
|
|
|
|
|
|
|
|
[
|
|
|
|
{
|
|
|
|
name: "resume",
|
|
|
|
group: "Run & Debug",
|
|
|
|
hint: "resume the current paused process",
|
2017-01-30 11:32:54 +00:00
|
|
|
bindKey: { mac: "F8", win: "F8" }
|
2016-06-26 11:53:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "stepinto",
|
|
|
|
group: "Run & Debug",
|
|
|
|
hint: "step into the function that is next on the execution stack",
|
2017-01-30 11:32:54 +00:00
|
|
|
bindKey: { mac: "F11", win: "F11" }
|
2016-06-26 11:53:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "stepover",
|
|
|
|
group: "Run & Debug",
|
|
|
|
hint: "step over the current expression on the execution stack",
|
2017-01-30 11:32:54 +00:00
|
|
|
bindKey: { mac: "F10", win: "F10" }
|
2016-06-26 11:53:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "stepout",
|
|
|
|
group: "Run & Debug",
|
|
|
|
hint: "step out of the current function scope",
|
2017-01-30 11:32:54 +00:00
|
|
|
bindKey: { mac: "Shift-F11", win: "Shift-F11" }
|
2016-06-26 11:53:19 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "testing",
|
|
|
|
group: "Code Editor",
|
|
|
|
hint: "step out of the current function scope",
|
2017-01-30 11:32:54 +00:00
|
|
|
bindKey: { mac: "Shift-F11", win: "Shift-F11" }
|
2016-06-26 11:53:19 +00:00
|
|
|
}
|
|
|
|
].forEach(function(cmd) {
|
|
|
|
commands.addCommand(cmd, prefs);
|
2017-01-30 11:32:54 +00:00
|
|
|
});
|
2016-06-26 11:53:19 +00:00
|
|
|
|
|
|
|
tabs.openEditor("preferences", function(err, tab) {
|
|
|
|
expect(tabs.getTabs()).length(1);
|
2017-08-09 22:14:34 +00:00
|
|
|
var checkbox = Array.apply(
|
|
|
|
null, tab.editor.aml.$ext.querySelectorAll(".hsplitbox>.label")
|
|
|
|
).filter(function(e) {
|
|
|
|
return /ui animation/i.test(e.textContent);
|
|
|
|
})[0].nextSibling.host;
|
|
|
|
|
|
|
|
expect(checkbox.getValue()).to.equal(true);
|
|
|
|
expect(checkbox.$ext.className).to.match(/checked/i)
|
|
|
|
expect(settings.get("user/general/@animateui")).to.equal(true);
|
|
|
|
settings.set("user/general/@animateui", false);
|
|
|
|
expect(settings.get("user/general/@animateui")).to.equal(false);
|
|
|
|
expect(checkbox.getValue()).to.equal(false);
|
|
|
|
expect(checkbox.$ext.className).to.not.match(/checked/i)
|
2016-06-26 11:53:19 +00:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (!onload.remain) {
|
2017-08-09 22:14:34 +00:00
|
|
|
describe("unload()", function() {
|
|
|
|
it('should unload the preferences', function(done) {
|
|
|
|
general.unload();
|
|
|
|
prefs.unload();
|
|
|
|
tabs.getTabs()[0].editor.unload();
|
|
|
|
tabs.getTabs()[0].unload();
|
|
|
|
tabs.unload();
|
|
|
|
done();
|
|
|
|
});
|
2016-06-26 11:53:19 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-12-13 20:17:16 +00:00
|
|
|
register();
|
2016-06-26 11:53:19 +00:00
|
|
|
}
|
|
|
|
});
|