add parameter for background color, only change color when parameter is passed in (export image service is used in notebook which needs the background color not changed

added tests
This commit is contained in:
Deep Tailor
2018-02-05 10:36:15 -08:00
committed by Victor Woeltjen
parent 5d3adc6a7f
commit 3669e776a9
3 changed files with 32 additions and 15 deletions

View File

@@ -121,16 +121,26 @@ define(
});
it("changes background color to white and returns color back to original after snapshot, for better visibility of plot lines on print", function () {
exportImageService.exportPNG(testElement, "plot.png");
exportImageService.exportPNG(testElement, "plot.png", 'white');
expect(mockChangeBackgroundColor).toHaveBeenCalledWith(testElement, 'white');
expect(mockChangeBackgroundColor).toHaveBeenCalledWith(testElement, 'black');
exportImageService.exportJPG(testElement, "plot.jpg");
exportImageService.exportJPG(testElement, "plot.jpg", 'white');
expect(mockChangeBackgroundColor).toHaveBeenCalledWith(testElement, 'white');
expect(mockChangeBackgroundColor).toHaveBeenCalledWith(testElement, 'black');
});
it("does not change background color when color is not specified in parameters", function () {
exportImageService.exportPNG(testElement, "plot.png");
expect(mockChangeBackgroundColor).not.toHaveBeenCalled();
exportImageService.exportJPG(testElement, "plot.jpg");
expect(mockChangeBackgroundColor).not.toHaveBeenCalled();
});
});
}
);