(mock, expected, countToCheck)
| 306 | } |
| 307 | |
| 308 | function checkValidate(mock, expected, countToCheck) { |
| 309 | var template = mock.layout.template; |
| 310 | var mockNoTemplate = Lib.extendDeep({}, mock); |
| 311 | delete mockNoTemplate.layout.template; |
| 312 | |
| 313 | // Test with objects as argument |
| 314 | var out1 = Plotly.validateTemplate(mock); |
| 315 | var out2 = Plotly.validateTemplate(mockNoTemplate, template); |
| 316 | expect(out2).toEqual(out1); |
| 317 | compareOutputs(out1, out2, expected, countToCheck); |
| 318 | |
| 319 | // Test with DOM elements as argument |
| 320 | var gd = createGraphDiv(); |
| 321 | return Plotly.newPlot(gd, mock) |
| 322 | .then(function() {out1 = Plotly.validateTemplate(gd);}) |
| 323 | .then(function() {return Plotly.newPlot(gd, mockNoTemplate);}) |
| 324 | .then(function() {out2 = Plotly.validateTemplate(gd, template);}) |
| 325 | .then(function() {compareOutputs(out1, out2, expected, countToCheck);}) |
| 326 | .catch(failTest) |
| 327 | .then(destroyGraphDiv); |
| 328 | } |
| 329 | |
| 330 | var cleanMock = Lib.extendDeep({}, templateMock); |
| 331 | cleanMock.layout.annotations.pop(); |
no test coverage detected
searching dependent graphs…