Skip to content
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions e2e/rtl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ import {
await addFontStyles(page);
await page.evaluate(() => {
document.dir = 'rtl';
})
});
});

test('dnd the thumb to right', async () => {
await trackMouse(page);
expect(await page.screenshot()).toMatchImageSnapshot();
await page.mouse.move(300, 80);
await page.mouse.down();
await page.mouse.move(460, 80);
await page.mouse.up();
await untrackMouse(page);
const output = await page.$('#output');
expect(await page.evaluate(e => e.textContent, output)).toBe('20.4');
expect(await page.evaluate(e => e.textContent, output)).toBe('60.2');
expect(await page.screenshot()).toMatchImageSnapshot();
});
4 changes: 2 additions & 2 deletions examples/Rtl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import * as React from 'react';
import { Range, getTrackBackground } from '../src/index';

const STEP = 0.1;
const MIN = 0;
const MIN = 50;
const MAX = 100;

class Basic extends React.Component {
state = {
values: [50]
};
render() {
return (
return (
<div
style={{
display: 'flex',
Expand Down
2 changes: 1 addition & 1 deletion src/Range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class Range extends React.Component<IProps> {
}
// invert for RTL
if (rtl) {
newValue = max - newValue;
newValue = (max+min) - newValue;
}
if (Math.abs(values[draggedThumbIndex] - newValue) >= step) {
onChange(
Expand Down