diff --git a/package.json b/package.json index 3e87e205..d47bff2c 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,6 @@ "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", "c9.ide.upload": "#0bd010d3dc", - "c9.ide.welcome": "#ab1740e33b" + "c9.ide.welcome": "#4a53636aea" } } \ No newline at end of file diff --git a/plugins/c9.core/c9_test.js b/plugins/c9.core/c9_test.js new file mode 100644 index 00000000..bdd0049b --- /dev/null +++ b/plugins/c9.core/c9_test.js @@ -0,0 +1,94 @@ +/*global describe:false, it:false */ + +"use client"; + +require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) { + var expect = chai.expect; + + expect.setupArchitectTest([ + { + packagePath: "plugins/c9.core/c9", + startdate: new Date(), + debug: 2, + hosted: true, + local: false + }, + "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", + { + consumes: [], + provides: ["auth.bootstrap", "info", "dialog.error"], + setup: expect.html.mocked + }, + + { + consumes: ["c9", "vfs"], + provides: [], + setup: main + } + ], architect); + + function main(options, imports, register) { + var c9 = imports.c9; + var vfs = imports.vfs; + + describe('c9', function() { + this.timeout(30000); + + it('should send proper events during connecting', function(done) { + // var count = 0; + + // c9.on("connecting", function c1(){ + // count++; + + // expect(c9.connecting).to.equal(true); + // expect(c9.connected).to.equal(false); + // expect(c9.has(c9.NETWORK)).to.equal(false); + + // c9.off("connecting", c1); + // }); + + expect(c9.connected).to.equal(false); + + c9.once("connect", function c2(){ + // expect(count, "Connecting event was not called").to.equal(1); + expect(c9.connected).to.equal(true); + expect(c9.has(c9.NETWORK)).to.equal(true); + + done(); + }); + + c9.enable(); + }); + it('check status settings and getting', function(done) { + c9.setStatus(c9.status & ~c9.STORAGE); + expect(c9.has(c9.STORAGE)).to.equal(false); + c9.setStatus(c9.status | c9.STORAGE); + expect(c9.has(c9.STORAGE)).to.equal(true); + done(); + }); + it('should send correct events during away', function(done) { + expect(c9.connected).to.equal(true); + expect(c9.has(c9.NETWORK)).to.equal(true); + + c9.once("away", function c1(){ + expect(c9.connected).to.equal(false); + expect(c9.has(c9.NETWORK)).to.equal(true); + }); + c9.once("back", function c1(){ + expect(c9.connected).to.equal(true); + expect(c9.has(c9.NETWORK)).to.equal(true); + done(); + }); + + vfs.connection.socket.close(); + }); + }); + + onload && onload(); + } +}); \ 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 75cf0402..2abd9b0a 100644 --- a/plugins/c9.ide.ace/ace_test.js +++ b/plugins/c9.ide.ace/ace_test.js @@ -259,10 +259,17 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) ace.setTheme(theme); }); it('should allow setting useWrapMode', function(done) { - doc.value = "a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped a very long string to be wrapped "; + var charW = editor.ace.renderer.layerConfig.characterWidth; + expect(charW).to.ok; + bar.$ext.style.width = 150 * charW + "px" + + doc.value = Array(17).join("a very long string to be wrapped "); render(); + + bar.$ext.style.width = "1000px"; + expect(document.querySelector(".ace_gutter-cell").offsetHeight).to.equal(lineHeight); editor.setOption("useWrapMode", true);