Skip to content

Commit

Permalink
Chart: fix export error by enforcing jquery wrapping (T1266360) (#28644)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkithelegendarypokemonster authored Dec 27, 2024
1 parent d5fe718 commit 5ac4ef1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/devextreme/js/viz/core/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export let combineMarkups = function(widgets, options = { }) {
const rowInfo = row.reduce((r, item, colIndex) => {
const size = item.getSize();
const backgroundColor = item.option('backgroundColor') || getTheme(item.option('theme')).backgroundColor;
const node = item.element()
const node = $(item.element())
.find('svg')
.get(0)
.cloneNode(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,31 @@ QUnit.test('exportFromMarkup. backgroundColor from current theme', function(asse
}
});

QUnit.test('exportWidgets method should be able export plain DOM element (T1266360)', function(assert) {
const optionMock = () => {
return {
fileName: 'chart',
format: 'PNG',
};
};

const widgets = [
createMockWidget({ height: 25, width: 10 }, optionMock),
];

widgets.forEach(widget => {
const originalElement = widget.element();
widget.element = sinon.stub().returns(originalElement[0]); // Get native DOM
});

try {
exportModule.exportWidgets(widgets);
assert.strictEqual(clientExporter.export.getCall(0).args[0].nodeName, 'svg', 'combineMarkups should pass to export DOM node');
} catch(error) {
assert.ok(false, 'exportWidgets doesnt work when plain DOM is passed as argument');
}
});

QUnit.test('exportWidgets method should pass to export markup as DOM node', function(assert) {
const optionMock = (param) => {
if(param === 'theme') return 'someTheme.light';
Expand Down

0 comments on commit 5ac4ef1

Please sign in to comment.