-
Notifications
You must be signed in to change notification settings - Fork 30
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 #182 from wonknu/visual_group
enhancement: grouped elements visualy
- Loading branch information
Showing
6 changed files
with
132 additions
and
8 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,49 @@ | ||
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')}) | ||
|
||
import data from '../../../fixtures/editor/compileAbeData.json' | ||
import compileAbe from '../../../../src/cli/cms/editor/handlebars/compileAbe' | ||
import Handlebars from 'handlebars' | ||
import abeEngine from '../../../../src/cli/cms/editor/handlebars/abeEngine' | ||
import xss from 'xss' | ||
|
||
describe('compileAbe', function() { | ||
before( function(done) { | ||
done() | ||
}); | ||
|
||
/** | ||
* compileAbe.group | ||
* | ||
*/ | ||
it('compileAbe.text', function() { | ||
this.sinon = sinon.sandbox.create(); | ||
var stub = sinon.stub(abeEngine, 'instance', { get: function () { return {content: data.compileSimpleText.content} } }) | ||
var result = compileAbe(data.compileSimpleText.argumentSimpleText) | ||
stub.restore() | ||
chai.expect(result).to.be.a('string'); | ||
chai.expect(result).to.be.equal('test value'); | ||
}); | ||
|
||
/** | ||
* compileAbe.group | ||
* | ||
*/ | ||
it('compileAbe.rte', function() { | ||
this.sinon = sinon.sandbox.create(); | ||
var stub = sinon.stub(abeEngine, 'instance', { get: function () { return {content: data.compileRTE.content} } }) | ||
var result = compileAbe(data.compileRTE.argumentRTE) | ||
stub.restore() | ||
chai.expect(result).to.be.a('object'); | ||
chai.expect(result.string).to.be.equal('alert(1);<div>value</div>'); | ||
}); | ||
|
||
}); |
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,42 @@ | ||
{ | ||
"compileSimpleText": { | ||
"content": { | ||
"name": "test", | ||
"test_key": "test value", | ||
"abeEditor": true | ||
}, | ||
"argumentSimpleText": { | ||
"name": "abe", | ||
"hash": { | ||
"order": "0", | ||
"key": "test_key", | ||
"type": "text" | ||
}, | ||
"data": { | ||
"intl": [], | ||
"_parent": [], | ||
"root": [] | ||
} | ||
} | ||
}, | ||
"compileRTE": { | ||
"content": { | ||
"name": "test", | ||
"test_rte_key": "<script>alert(1);</script><div>value</div>", | ||
"abeEditor": true | ||
}, | ||
"argumentRTE": { | ||
"name": "abe", | ||
"hash": { | ||
"order": "0", | ||
"key": "test_rte_key", | ||
"type": "rich" | ||
}, | ||
"data": { | ||
"intl": [], | ||
"_parent": [], | ||
"root": [] | ||
} | ||
} | ||
} | ||
} |