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);