Beginning to merge rendering code in main.js and regexper.js

This commit is contained in:
Jeff Avallone
2014-12-29 18:37:21 -05:00
parent 8dda135960
commit d6e81a2932
4 changed files with 34 additions and 26 deletions
+7 -2
View File
@@ -14,7 +14,6 @@ describe('regexper.js', function() {
'<ul id="warnings"></ul>',
'<div><a href="#" data-glyph="link-intact"></a></div>',
'<div><a href="#" data-glyph="data-transfer-download"></a></div>',
'<div class="progress"><div></div></div>',
'<div id="regexp-render"></div>',
'<script type="text/html" id="svg-base"><svg></svg></script>'
].join('');
@@ -281,6 +280,12 @@ describe('regexper.js', function() {
beforeEach(function() {
spyOn(this.regexper, 'buildBlobURL');
this.regexper.svgContainer.innerHTML = '<div class="svg">example image</div>';
});
it('builds the blob URL from the SVG image', function() {
this.regexper.updateLinks();
expect(this.regexper.buildBlobURL).toHaveBeenCalledWith('example image');
});
describe('when blob URLs are supported', function() {
@@ -426,7 +431,7 @@ describe('regexper.js', function() {
it('renders the expression', function(done) {
this.regexper.renderRegexp('example expression')
.then(() => {
expect(this.parser.render).toHaveBeenCalledWith(this.regexper.svgContainer, this.regexper.svgBase);
expect(this.parser.render).toHaveBeenCalledWith(this.regexper.svgContainer.querySelector('.svg'), this.regexper.svgBase);
}, fail)
.finally(done)
.done();