VisualEditor/Typing/Right-to-left

Introduction
This is an acceptance test procedure for typing in a right-to-left language in the VisualEditor.

The basic typing test is done using Hebrew, because Hebrew characters should be easier to discern than of the other alphabets. Special features of complex RTL scripts will be checked in other tests.

Basic assumptions

 * Visual Editor is completely installed and configured (Parsoid etc.)
 * LocalSettings.php:
 * The computer has an English (US) keyboard enabled.
 * The computer has a Hebrew keyboard enabled. (TODO: Which one? Specify for Mac, Desktop Linux, Windows.)
 * The computer has a Hebrew font installed.
 * The user interface of the wiki is Hebrew (change using preferences or ULS)

N.B.: The words "right" and "left" in this document refer to sides. "Right" doesn't mean "correct" and "left" doesn't mean "not taken".

Basic typing

 * 1) Start a new article that doesn't exist.
 * 2) Start editing it using the Visual Editor.
 * 3) * Check: The cursor is at the top right corner.
 * 4) Type.
 * 5) * Check: The letter appears on the screen in the top right corner.
 * 6) * Check: The cursor is immediately to the left of the letter.
 * 7) Type.
 * 8) * Check: The letters appear on the screen in the top right corner.
 * 9) * Check: The cursor is immediately to the left of the letters.
 * 10) Type
 * 11) * Check: The letters appear on the screen in the top right corner. From right to left:, then , then.
 * 12) * Check: The cursor is immediately to the left of the question mark.
 * 13) Press Enter.
 * 14) * Check: The first line didn't change.
 * 15) * The cursor is at the right end of the second line.
 * 16) Switch the keyboard layout to English
 * 17) Type in English:
 * 18) * Check: The text appears as at the right side of the second line. The exclamation mark must appear on the left end, next to the letter.
 * 19) * Check: The cursor is at the left of the line, next to the exclamation mark.

Paragraph direction
This feature is not implemented yet. Reference bug: Bug 41010 - There's no way to specify the directionality of a paragraph.


 * 1) Press the toolbar button for changing the paragraph direction to left-to-right.
 * 2) * Check: The first line hasn't changed - it's still, at the right side of the line.
 * 3) * Check: The second line now has the text at the left side of the line, with the exclamation mark on the right side of the word, next to the letter.
 * 4) Select the whole text (probably something like Ctrl-A)
 * 5) Press the toolbar button for changing the paragraph direction to right-to-left.
 * 6) * Check: The first line says aligned to the right.
 * 7) * Check: The second line says aligned to the right, with the exclamation mark at the left end.
 * 8) Press the keyboard shortcut for changing the paragraph direction to left-to-right.
 * 9) * Check: The first line says aligned to the left, with the question mark at the right end.
 * 10) * Check: The second line says aligned to the left, with the exclamation mark at the right end.
 * 11) Press the keyboard shortcut for changing the paragraph direction to right-to-left.
 * 12) * Check: The first line says aligned to the right, with the question mark at the left end.
 * 13) * Check: The second line says aligned to the right, with the exclamation mark at the left end.

Keyboard shortcuts for movement and selection

 * 1) While the whole text is selected, change the keyboard layout to Hebrew and type.
 * 2) * Check: All the previous text was deleted and replaced by new text.
 * 3) * Check: The first line says, aligned to the right and the cursor is at the left end of the line.
 * 4) Press the right arrow on the keyboard (→).
 * 5) * Check: The cursor moved one character to the right and is between the letters of the two-letter word.
 * 6) Press the Home button (probably Ctrl-→ on a Mac).
 * 7) * Check: The cursor is at the right end of the line.
 * 8) Press the left arrow on the keyboard (←).
 * 9) * Check: The cursor moved one letter to the left and is between the first letter from the right and the apostrophe.
 * 10) Hold Shift and press ← three times.
 * 11) * Check: The words appear in the first line, aligned to the right.
 * 12) * Check: The letters are selected.
 * 13) Type.
 * 14) * Check: The words appear in the first line, aligned to the right.
 * 15) * Check: No text is selected.
 * 16) * Check: The cursor is on the right side of the space between two words.
 * 17) Hold Shift and press → three times.
 * 18) * Check: The text appear in the first line, aligned to the right.
 * 19) * Check: The letters are selected.
 * 20) Type
 * 21) * Check: The words appear in the first line, aligned to the right.
 * 22) * Check: No text is selected.
 * 23) * Check: The cursor is on the right side of the space between two words.
 * 24) Press Shift-Control-→ (Probably Shift-Command-→ on a Mac).
 * 25) * Check: The words appear in the first line, aligned to the right.
 * 26) * Check: The first word from the right is selected.
 * 27) Press the End key. (Probably Control-← on a Mac)
 * 28) * Check: The words appear in the first line, aligned to the right.
 * 29) * Check: The cursor is on the left end of the first line.
 * 30) Press Ctrl-→.
 * 31) * Check: The words appear in the first line, aligned to the right.
 * 32) * Check: The cursor is in the left side of the space between the two words.
 * 33) Press Ctrl-→.
 * 34) * Check: The words appear in the first line, aligned to the right.
 * 35) * Check: The cursor is in the right end of the first line.
 * 36) Press Ctrl-←.
 * 37) * Check: The words appear in the first line, aligned to the right.
 * 38) * Check: The cursor is in the left side of the space between the two words.
 * 39) Press Ctrl-←.
 * 40) * Check: The words appear in the first line, aligned to the right.
 * 41) * Check: The cursor is in the right end of the first line.
 * 42) Press Ctrl-←.
 * 43) Press Ctrl-Shift-←
 * 44) * Check: The words appear in the first line, aligned to the right.
 * 45) * Check: The two letter word is selected.
 * 46) Press the End key.
 * 47) * Check: The words appear in the first line, aligned to the right.
 * 48) * Check: The cursor is in the left end of the first line.
 * 49) Press Shift-Home
 * 50) * Check: The words appear in the first line, aligned to the right.
 * 51) * Check: Both words are selected.
 * 52) Press the Home key.
 * 53) * Check: The words appear in the first line, aligned to the right.
 * 54) * Check: The cursor is in the right end of the first line.
 * 55) Press Shift-End
 * 56) * Check: The words appear in the first line, aligned to the right.
 * 57) * Check: Both words are selected.
 * 58) Press the End key.
 * 59) Press Enter twice.
 * 60) Type.
 * 61) * Check: The words appear in the first line, aligned to the right.
 * 62) * Check: The second line is empty.
 * 63) * Check: The word appears in the third line, aligned to the right, and the period is at the left end of the line.
 * 64) * Check: The cursor is at the left end of the third line.
 * 65) Press Ctrl-Home.
 * 66) * Check: The cursor is at the right end of the first line.
 * 67) Press Ctrl-End.
 * 68) * Check: The cursor is at the right end of the third line.
 * 69) Press Ctrl-Shift-Home.
 * 70) * Check: The whole text is selected.
 * 71) Press End.
 * 72) * Check: The cursor is at the left end of the first line.
 * 73) Press Ctrl-Shift-End.
 * 74) * Check: The first line is not selected.
 * 75) * Check: The second and the third line are selected.
 * 76) Press the Home key.
 * 77) Press the Delete key (Mac: fn-delete).
 * 78) * Check: Nothing is selected.
 * 79) * Check: The third line says.
 * 80) * Check: The cursor is at the right end of the third line.
 * 81) Press the End key.
 * 82) Press the Backspace key ("delete" on Macs).
 * 83) * Check: The cursor is at the left end of the third line.
 * 84) * Check: The third line says.

Inline direction
Not implemented yet. Reference bug: Bug 41009 - There's no way to specify the directionality of an inline piece of text.


 * 1) Press Ctrl-Home.
 * 2) Press End.
 * 3) Type one space.
 * 4) Switch the keyboard layout to English.
 * 5) Type
 * 6) Type one space.
 * 7) Switch to the Hebrew keyboard
 * 8) Type
 * 9) * Check: The first line says: . The number is to the right of the words . (This is intentionally incorrect display.)
 * 10) Select the words  (with any punctuation marks).
 * 11) This is the unimplemented part, which is the main point of this test: Perform the operation, which defines the language of the selection to English (lang="en"), with isolated directionality (should be the default). (The operation is described in the Bidirectional text requirements document).
 * 12) * Check: The semicolon appears to the left of the words, and the number appears to the left of the semicolon.

More shortcuts

 * 1) Press Ctrl-End.
 * 2) Press Enter twice.
 * 3) Type.
 * 4) Press Ctrl-Backspace
 * 5) * Check: The words appear in the fifth line.
 * 6) Press the undo button (probably Ctrl-Z).
 * 7) * Check: The words appear in the fifth line.
 * 8) Press Ctrl-→ twice.
 * 9) Press Ctrl-Delete.
 * 10) * Check: The words appear in the fifth line.

Clusters in Arabic
Assumption: An Arabic keyboard layout is installed.


 * 1) Start in an empty editing window.
 * 2) * Check: The cursor is at the top right corner.
 * 3) Type.
 * 4) * Check: The word appears in the first line.
 * 5) * Check: The exclamation mark at the left end of the first line.
 * 6) * Check: The cursor is to the left of the exclamation mark.
 * 7) Press the right arrow (→) three times.
 * 8) * Check: The cursor is between and.