Skip to content

Commit

Permalink
Make workaround for RTL issue null safe (#489)
Browse files Browse the repository at this point in the history
Fixes regression introduced by RTL workaround happening in 14.3 and 16 when disabling accessibility.

Fixes vaadin/vaadin-charts-flow#378
  • Loading branch information
alvarezguille committed Jul 22, 2020
1 parent 11da9cf commit 507bb29
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/vaadin-chart.html
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,10 @@
];

elementsToChange.forEach(el => {
el.style.left = '';
el.style.top = '-999em';
if (el && el.style) {
el.style.left = '';
el.style.top = '-999em';
}
});
}

Expand Down
21 changes: 20 additions & 1 deletion test/element-api-chart-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,17 @@
</vaadin-chart>
</template>
</test-fixture>

<test-fixture id="withoutaccessibility">
<template>
<vaadin-chart additional-options='{
"accessibility": {
"enabled": false
}
}'>
<vaadin-chart-series id="additional-series" values="[10,20,30]" title="series-title"></vaadin-chart-series>
</vaadin-chart>
</template>
</test-fixture>
<script>
describe('High-level API', function() {
var chart, chartContainer;
Expand Down Expand Up @@ -466,6 +476,15 @@
});
});
});

it('should not fail with accessibility disabled', function(done) {
// Test for regression caused by RTL workaround https://github.com/vaadin/vaadin-charts-flow/issues/378
const chart = fixture('withoutaccessibility');
setTimeout(function() {
expect(chart.configuration.options.accessibility.enabled).to.be.false;
done();
}, 120);
});
});
</script>
</body>

0 comments on commit 507bb29

Please sign in to comment.