UNPKG

766 BJavaScriptView Raw
1// Jasmine test related to the conversion of xml towards javascript.
2
3var CodeGradX = require('../codegradxlib.js');
4
5describe('CodeGradX', function () {
6
7 it("converts xml to js", function (done) {
8 function faildone (reason) {
9 state.debug('faildone', reason).show();
10 fail(reason);
11 done();
12 }
13 var xml1 = "<a aa='bb' cc='1'></a>";
14 CodeGradX.parsexml(xml1).then(function (js) {
15 //console.log(js);
16 expect(js.a.$.aa).toBe('bb');
17 expect(js.a.$.cc).toBe('1');
18 done();
19 }, faildone);
20 var xml2 = "<a aa='bb' cc='1' />";
21 CodeGradX.parsexml(xml2).then(function (js) {
22 //console.log(js);
23 expect(js.a.$.aa).toBe('bb');
24 expect(js.a.$.cc).toBe('1');
25 done();
26 }, faildone);
27 });
28
29});