it("should emit child elements", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent><MyChild /><MyOtherChild /></MyComponent>;"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, null, [\n    ViewHost.render(MyChild, null),\n    ViewHost.render(MyOtherChild, null)\n]);\n        ".trim());
 });
 .end(function (err, res) {
   expect(err).to.be.null;
   expect(res.body.response.route[0].mode.transportModes).to.include('publicTransportTimeTable');
   expect(res.body.response.route[0].mode.feature[0].value).to.equal('park');
   expect(res.body.response.route[0].mode.feature[1].value).to.equal('tunnel');
   done();
 });
 .end(function (err, res) {
   expect(err).to.be.null;
   assert.equal(200, res.statusCode);
   expect(res).to.be.json;
   expect(res.body.Response.View[0].Result[0].Location.NavigationPosition[0].Latitude).to.equal(51.5173562);
   expect(res.body.Response.View[0].Result[0].Location.NavigationPosition[0].Longitude).to.equal(-0.0735515);
   done();
 });
 it("should emit child literals and binding expressions", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent>This is the number: {this.viewModel.number}!</MyComponent>;"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, null, [\n    'This is the number: ',\n    {\n        source: this.viewModel,\n        target: null,\n        sourceProp: 'number'\n    },\n    '!'\n]);".trim());
 });
 it("should emit child binding expressions", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent>{this.viewModel.source}</MyComponent>;"));
     chai_1.expect(result).to.equal("\n    ViewHost.render(MyComponent, null, [{\n        source: this.viewModel,\n        target: null,\n        sourceProp: 'source'\n    }]);".trim());
 });
Exemple #6
0
 it('symlinks a directory', () => {
   symlinkDotfile(testDotdir, testDestDotdir)
   expect(existsSync(testDestDotdir)).to.equal(true)
 })
 .then((res) => {
   expect(res.status).to.equal(200);
   expect(res.body.name).to.equal('MegaBrian');
   done();
 })
 it('should parse single parameter', () => {
     const input = `int a`;
     const tokenizer = new Tokenizer(input);
     const astNode = parseVarDec(tokenizer);
     expect(astNode.toXML()).to.eql(expectedSimple);
 });
 test.client._session.on(Session.DispositionReceived, function(d) {
   expect(called).to.eql({ receiver: false, sender: true });
   done();
 });
 it("should emit binding between the source and target properties", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent target={this.viewModel.source} />"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, [{\n        source: this.viewModel,\n        target: 'target',\n        sourceProp: 'source'\n    }]);\n        ".trim());
 });
 it("should handle indexers in bindings", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent target={this.viewModel.arr[10].source} />"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, [{\n        source: this.viewModel.arr[10],\n        target: 'target',\n        sourceProp: 'source'\n    }]);\n        ".trim());
 });
 it("should emit multiple bindings between the source and target properties", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent target={this.viewModel.source} otherTarget={this.viewModel.otherSource} nonBound={false} />"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, [\n    {\n        source: this.viewModel,\n        target: 'target',\n        sourceProp: 'source'\n    },\n    {\n        source: this.viewModel,\n        target: 'otherTarget',\n        sourceProp: 'otherSource'\n    },\n    {\n        source: false,\n        target: 'nonBound'\n    }\n]);\n        ".trim());
 });
 .then((res) => {
   expect(res.status).to.equal(200);
   expect(res.body.name).to.equal(this.tempDeity.name);
   done();
 })
 .catch( err => {
   const res = err.response;
   expect(res.status).to.equal(400);
   done();
 });
 .then((res) => {
   expect(res.status).to.equal(200);
   expect(res.body.name).to.equal('tester');
   done();
 }).catch(done);
 .catch((err) => {
   const res = err.response;
   expect(res.status).to.equal(404);
   expect(res.text).to.equal('not found');
   done();
 });
 .then((res) => {
   expect(res.status).to.equal(204);
   expect(res.body.name).to.equal(undefined);
   done();
 })
 it("should emit bindings for child elements", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent><MyChild target={this.viewModel.source} /><MyOtherChild /></MyComponent>;"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, null, [\n    ViewHost.render(MyChild, [{\n            source: this.viewModel,\n            target: 'target',\n            sourceProp: 'source'\n        }]),\n    ViewHost.render(MyOtherChild, null)\n]);\n        ".trim());
 });
 it("should emit ES5 as-is", function () {
     var result = emit_1["default"](parse_1["default"]("var x = 10;"));
     chai_1.expect(result).to.equal("var x = 10;");
 });
 it("should handle string indexers as binding source", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent target={this.viewModel.arr['the cool property']} />"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, [{\n        source: this.viewModel.arr['the cool property'],\n        target: 'target'\n    }]);\n        ".trim());
 });
Exemple #21
0
 it('should expose a worker method', function () {
   expect(mail.worker).to.be.a('function');
   expect(mail).to.respondTo('worker');
 });
 it("should emit null to the target property", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent target={null} />"));
     chai_1.expect(result).to.equal("\nViewHost.render(MyComponent, [{\n        source: null,\n        target: 'target'\n    }]);\n        ".trim());
 });
 .then(function(queue) {
   expect(queue.msgDepth).to.equal(0);
   done();
 });
Exemple #24
0
 request.get(options, function (err, res, body) {
   expect(res.statusCode).to.equal(200);
   //make sure we're requesting the google service.
   expect(res.request.uri.host).to.equal('accounts.google.com');
   done();
 });
 it('should parse multiple parameters', () => {
     const input = `int a, boolean b, int z`;
     const tokenizer = new Tokenizer(input);
     const astNode = parseVarDec(tokenizer);
     expect(astNode.toXML()).to.eql(expectedMultiple);
 });
 .catch( err => {
   const res = err.response;
   expect(res.status).to.equal(404);
   expect(res.body.name).to.equal(undefined);
   done();
 });
 .end(function (err, res) {
   expect(err).to.be.null;
   assert.equal(200, res.statusCode);
   expect(res).to.be.json;
   done();
 });
 it("should emit child literals", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent>String</MyComponent>;"));
     chai_1.expect(result).to.equal("ViewHost.render(MyComponent, null, ['String']);");
 });
 it("should emit a call to ViewHost.render", function () {
     var result = emit_1["default"](parse_1["default"]("<MyComponent />"));
     chai_1.expect(result).to.equal("ViewHost.render(MyComponent, null);");
 });
Exemple #30
0
 it('symlinks a file', () => {
   symlinkDotfile(testDotfile, testDestDotfile)
   expect(existsSync(testDestDotfile)).to.equal(true)
 })