Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix resize on rtl page #6063

Merged
merged 2 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/platforms/platform.dom.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
.chartjs-size-monitor-expand,
.chartjs-size-monitor-shrink {
position: absolute;
direction: ltr;
simonbrunel marked this conversation as resolved.
Show resolved Hide resolved
left: 0;
top: 0;
right: 0;
Expand Down
40 changes: 40 additions & 0 deletions test/specs/core.controller.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down