-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from AdFabConnect/abe_import_variable
Abe import variable
- Loading branch information
Showing
7 changed files
with
131 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
var chai = require('chai'); | ||
var sinonChai = require('sinon-chai') | ||
var expect = chai.expect | ||
chai.use(sinonChai) | ||
var sinon = require('sinon'); | ||
var path = require('path'); | ||
var fse = require('fs-extra'); | ||
|
||
var config = require('../../../src/cli').config | ||
config.set({root: path.join(process.cwd(), 'test', 'fixtures')}) | ||
|
||
var cmsData = require('../../../src/cli').cmsData; | ||
var Manager = require('../../../src/cli').Manager; | ||
|
||
describe('Attr', function() { | ||
before( function(done) { | ||
Manager.instance.init() | ||
.then(function () { | ||
this.fixture = {} | ||
done() | ||
|
||
}.bind(this)) | ||
}); | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
it('new attr', function() { | ||
var attr = new cmsData.attr("article-abe-d20160920T125255138Z.shtml") | ||
chai.expect(attr.str).to.not.be.undefined; | ||
chai.expect(attr.val.s).to.not.be.undefined; | ||
chai.expect(attr.val.s).to.be.equal('d'); | ||
}); | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
it('attr.remove', function() { | ||
var attr = new cmsData.attr("article-abe-d20160920T125255138Z.html") | ||
var filename = attr.remove() | ||
chai.expect(filename).to.be.equal('article.html'); | ||
}); | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
it('attr.getExtension', function() { | ||
var attr = new cmsData.attr("article-abe-d20160920T125255138Z.html") | ||
var extension = attr.getExtension() | ||
chai.expect(extension).to.be.equal('html'); | ||
}); | ||
|
||
/** | ||
* | ||
* | ||
*/ | ||
it('attr.insert', function() { | ||
var attr = new cmsData.attr("article-abe-d20160920T125255138Z.html") | ||
var extension = attr.insert('test') | ||
chai.expect(extension).to.be.equal('article-abe-test.html'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var chai = require('chai'); | ||
var sinonChai = require('sinon-chai') | ||
var expect = chai.expect | ||
chai.use(sinonChai) | ||
var sinon = require('sinon'); | ||
var path = require('path'); | ||
var fse = require('fs-extra'); | ||
|
||
var config = require('../../../src/cli').config | ||
config.set({root: path.join(process.cwd(), 'test', 'fixtures')}) | ||
|
||
var cmsEditor = require('../../../src/cli').cmsEditor; | ||
var Manager = require('../../../src/cli').Manager; | ||
|
||
describe('Form', function() { | ||
before( function(done) { | ||
Manager.instance.init() | ||
.then(function () { | ||
this.fixture = {} | ||
done() | ||
|
||
}.bind(this)) | ||
}); | ||
|
||
/** | ||
* getTemplatesTexts | ||
* | ||
*/ | ||
it('new Form', function() { | ||
// stub | ||
var sinonInstance = sinon.sandbox.create(); | ||
// sinonInstance.stub(fse, 'readFileSync'); | ||
|
||
var form = new cmsEditor.form() | ||
form.add({key: 'test'}) | ||
chai.expect(form._form.default.item[0].key).to.be.equal('test'); | ||
chai.expect(form.dontHaveKey('test')).to.be.equal(false); | ||
chai.expect(form.form.default.item.length).to.be.above(0); | ||
}); | ||
}); |