diff --git a/js/components/PlaylistWindow/RunningTimeDisplay.js b/js/components/PlaylistWindow/RunningTimeDisplay.js index 8331a0ed..97ae5900 100644 --- a/js/components/PlaylistWindow/RunningTimeDisplay.js +++ b/js/components/PlaylistWindow/RunningTimeDisplay.js @@ -4,10 +4,20 @@ import { connect } from "react-redux"; import CharacterString from "../CharacterString"; import { getRunningTimeMessage } from "../../selectors"; +// While all the browsers I care about support String.prototype.padEnd, +// Not all node versions do, and I want tests to pass in Jest... +// Sigh. +function rightPad(str, len, fillChar) { + while (str.length < len) { + str += fillChar; + } + return str; +} + const RunningTimeDisplay = props => (
- {props.runningTimeMessage.padEnd(18, " ")} + {rightPad(props.runningTimeMessage, 18, " ")}
);