Adding ability to easily render demo images

This commit is contained in:
Jeff Avallone
2014-12-21 15:22:01 -05:00
parent e466e7e548
commit 55ee380817
7 changed files with 45 additions and 25 deletions
+8 -2
View File
@@ -60,12 +60,18 @@ describe('parser/javascript.js', function() {
this.parser.parsed = jasmine.createSpyObj('parsed', ['render']);
this.parser.parsed.render.and.returnValue(this.renderPromise.promise);
this.svgStyles = 'example styles';
this.svg = Snap(document.createElement('svg'));
spyOn(this.svg, 'group').and.returnValue('example group');
});
it('adds the svg styles to the svg element', function() {
this.parser.render(this.svg, this.svgStyles);
expect(this.svg.innerHTML).toEqual('<style type="text/css">example styles</style>');
});
it('render the parsed expression', function() {
this.parser.render(this.svg, 10);
this.parser.render(this.svg, this.svgStyles);
expect(this.parser.parsed.render).toHaveBeenCalledWith('example group');
});
@@ -82,7 +88,7 @@ describe('parser/javascript.js', function() {
spyOn(this.svg, 'attr');
this.parser.render(this.svg, 10);
this.parser.render(this.svg, this.svgStyles);
this.renderPromise.resolve(this.result);
setTimeout(done, 10);
+1 -5
View File
@@ -378,10 +378,6 @@ describe('regexper.js', function() {
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'start');
});
it('adds the svg styles to the svg element', function() {
expect(this.regexper.svg.innerHTML).toEqual('<style type="text/css">example styles</style>');
});
it('keeps a copy of the running parser', function() {
expect(this.regexper.runningParser).toBeTruthy();
});
@@ -422,7 +418,7 @@ describe('regexper.js', function() {
});
it('renders the expression', function() {
expect(this.parser.render).toHaveBeenCalledWith(this.regexper.snap, this.regexper.padding);
expect(this.parser.render).toHaveBeenCalledWith(this.regexper.svg, this.regexper.svgStyles);
});
});