The code you wrote does not exactly do what I intended. More precisely, it does not extend the range to the left, so as to include the whole word. I would expect offsetToWord('hello kitty', 2) to return 'hello'.
I intended my code like this, because in future I might want to test whether the contextmenu works correctly in the middle of the word or between words ('hello| world' + contextmenu should return 'hello' and not 'world').
However, for the current bug, the mochitest might seem a little over-engineered. Do you still think I should simplify the code?
(In reply to comment #67)
Hello,
The code you wrote does not exactly do what I intended. More precisely, it does not extend the range to the left, so as to include the whole word. I would expect offsetToWord('hello kitty', 2) to return 'hello'.
I intended my code like this, because in future I might want to test whether the contextmenu works correctly in the middle of the word or between words ('hello| world' + contextmenu should return 'hello' and not 'world').
However, for the current bug, the mochitest might seem a little over-engineered. Do you still think I should simplify the code?