Test driving your visualization – SVG rendering
Now we have the basic skeleton of our bar chart object created, and we feel that we are ready to try to render something, so in this second iteration we will try to generate the svg:svg
element.
How to do it...
Rendering the svg:svg
element should not only simply add the svg:svg
element to the HTML body, but also translate the width and height setting on our chart object to proper SVG attributes. Here is how we express our expectation in our test cases:
describe('.render', function () { describe('svg', function () { it('should generate svg', function () { chart.render(); expect(svg()).not.toBeEmpty(); }); it('should set default svg height and width', function () { chart.render(); expect(svg().attr('width')).toBe('500'); expect(svg().attr(...