|
1 | 1 | var Plotly = require('@lib/index');
|
2 | 2 | var Lib = require('@src/lib');
|
3 | 3 |
|
4 |
| -var helpers = require('@src/snapshot/helpers'); |
5 |
| -var getImageSize = require('@src/traces/image/helpers').getImageSize; |
6 |
| - |
7 | 4 | var createGraphDiv = require('../assets/create_graph_div');
|
8 | 5 | var destroyGraphDiv = require('../assets/destroy_graph_div');
|
9 | 6 |
|
@@ -137,51 +134,6 @@ describe('Plotly.downloadImage', function() {
|
137 | 134 | })
|
138 | 135 | .then(done, done.fail);
|
139 | 136 | }, LONG_TIMEOUT_INTERVAL);
|
140 |
| - |
141 |
| - it('should produce right output in Safari', function(done) { |
142 |
| - spyOn(Lib, 'isSafari').and.callFake(function() { return true; }); |
143 |
| - spyOn(helpers, 'octetStream'); |
144 |
| - |
145 |
| - Plotly.newPlot(gd, textchartMock.data, textchartMock.layout) |
146 |
| - .then(function() { return Plotly.downloadImage(gd, {format: 'svg'}); }) |
147 |
| - .then(function() { return Plotly.downloadImage(gd, {format: 'png'}); }) |
148 |
| - .then(function() { return Plotly.downloadImage(gd, {format: 'jpeg'}); }) |
149 |
| - .then(function() { return Plotly.downloadImage(gd, {format: 'webp'}); }) |
150 |
| - .then(function() { |
151 |
| - var args = helpers.octetStream.calls.allArgs(); |
152 |
| - expect(args[0][0].slice(0, 15)).toBe(',%3Csvg%20class', 'format:svg'); |
153 |
| - expect(args[1][0].slice(0, 8)).toBe(';base64,', 'format:png'); |
154 |
| - expect(args[2][0].slice(0, 8)).toBe(';base64,', 'format:jpeg'); |
155 |
| - expect(args[3][0].slice(0, 8)).toBe(';base64,', 'format:webp'); |
156 |
| - }) |
157 |
| - .then(done, done.fail); |
158 |
| - }); |
159 |
| - |
160 |
| - it('should default width & height for downloadImage to match with the live graph', function(done) { |
161 |
| - spyOn(Lib, 'isSafari').and.callFake(function() { return true; }); |
162 |
| - spyOn(helpers, 'octetStream'); |
163 |
| - |
164 |
| - var fig = { |
165 |
| - data: [{y: [0, 1]}] |
166 |
| - }; |
167 |
| - |
168 |
| - gd.style.width = '500px'; |
169 |
| - gd.style.height = '300px'; |
170 |
| - |
171 |
| - Plotly.newPlot(gd, fig) |
172 |
| - .then(function() { return Plotly.downloadImage(gd, {format: 'png'}); }) |
173 |
| - .then(function() { |
174 |
| - var args = helpers.octetStream.calls.allArgs(); |
175 |
| - var blob = args[0][0]; |
176 |
| - expect(blob.slice(0, 8)).toBe(';base64,', 'format:png'); |
177 |
| - var size = getImageSize('data:image/png' + blob); |
178 |
| - expect(size.width).toBe(gd._fullLayout.width, 'fullLayout width'); |
179 |
| - expect(size.height).toBe(gd._fullLayout.height, 'fullLayout height'); |
180 |
| - expect(size.width).toBe(500, 'div width'); |
181 |
| - expect(size.height).toBe(300, 'div height'); |
182 |
| - }) |
183 |
| - .then(done, done.fail); |
184 |
| - }); |
185 | 137 | });
|
186 | 138 |
|
187 | 139 | function downloadTest(gd, format) {
|
|
0 commit comments