From 2a9fc324a4beb03b55c50b9fe135767a94fceba9 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Mon, 11 Feb 2019 13:57:32 +0200 Subject: [PATCH 1/2] fix resize on rtl page --- src/platforms/platform.dom.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platforms/platform.dom.css b/src/platforms/platform.dom.css index e0b99a4aad4..5e749593eeb 100644 --- a/src/platforms/platform.dom.css +++ b/src/platforms/platform.dom.css @@ -19,6 +19,7 @@ .chartjs-size-monitor-expand, .chartjs-size-monitor-shrink { position: absolute; + direction: ltr; left: 0; top: 0; right: 0; From 379dd43e5568b36afc8dee417f2ef3c58189c06b Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Mon, 11 Feb 2019 18:31:21 +0200 Subject: [PATCH 2/2] add test --- test/specs/core.controller.tests.js | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index 819074393b1..ef41f5942b4 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -379,6 +379,46 @@ describe('Chart', function() { }); }); + it('should resize the canvas when parent is RTL and width changes', function(done) { + var chart = acquireChart({ + options: { + responsive: true, + maintainAspectRatio: false + } + }, { + canvas: { + style: '' + }, + wrapper: { + style: 'width: 300px; height: 350px; position: relative; direction: rtl' + } + }); + + expect(chart).toBeChartOfSize({ + dw: 300, dh: 350, + rw: 300, rh: 350, + }); + + var wrapper = chart.canvas.parentNode; + wrapper.style.width = '455px'; + waitForResize(chart, function() { + expect(chart).toBeChartOfSize({ + dw: 455, dh: 350, + rw: 455, rh: 350, + }); + + wrapper.style.width = '150px'; + waitForResize(chart, function() { + expect(chart).toBeChartOfSize({ + dw: 150, dh: 350, + rw: 150, rh: 350, + }); + + done(); + }); + }); + }); + it('should resize the canvas when parent height changes', function(done) { var chart = acquireChart({ options: {