| /* |
| * Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| * for details. All rights reserved. Use of this source code is governed by a |
| * BSD-style license that can be found in the LICENSE file. |
| */ |
| /** |
| * @description |
| */ |
| import "dart:html"; |
| import "../../testcommon.dart"; |
| |
| main() { |
| document.body.setInnerHtml(''' |
| <div dir=rtl> |
| <p>Right To Left |
| |
| <p>Well-formed pair of unicode bidi control characters. |
| <div>‫b!‬</div> |
| <div>‪b!‬</div> |
| |
| <p>Unpaired unicode bidi control characters. |
| <div>‫b!</div> |
| <div>‪b!</div> |
| |
| <p>Empty content inside unicode bidi control characters. |
| <div>‬‬</div> |
| <div>‪‪</div> |
| <div>‫‫</div> |
| |
| <p>String inside unicode bidi control characters. |
| <div contenteditable id="test">‬abc‬</div> |
| <div>‪abc‪</div> |
| <div>‫abc‫</div> |
| |
| <p>String around unicode bidi control characters. |
| <div>def‬abc‬</div> |
| <div>‬abc‬def</div> |
| <div>xyz‬abc‬def</div> |
| |
| <p>Nested unicode bidi control characters. |
| <div>‪‪b!‬</div> |
| <div>‫‫b!‬</div> |
| <div>‬‬b!‬</div> |
| <div>‬1‫c!‬</div> |
| |
| <p>Start with different directionality characters. |
| <div>12‬‪1‬‫</div> |
| <div>12‬‪</div> |
| <div>٠١‬‪</div> |
| <div>ڃڄ‬‪</div> |
| <div>‬‪</div> |
| <div>abc‬‪</div> |
| <div>אב‬‪</div> |
| </div> |
| |
| <div> |
| <p>Left To Right |
| |
| <p>Well-formed pair of unicode bidi control characters. |
| <div>‫b!‬</div> |
| <div>‪b!‬</div> |
| |
| <p>Unpaired unicode bidi control characters. |
| <div>‫b!</div> |
| <div>‪b!</div> |
| |
| <p>Empty content inside unicode bidi control characters. |
| <div>‬‬</div> |
| <div>‪‪</div> |
| <div>‫‫</div> |
| |
| <p>String inside unicode bidi control characters. |
| <div>‬abc‬</div> |
| <div>‪abc‪</div> |
| <div>‫abc‫</div> |
| |
| <p>String around unicode bidi control characters. |
| <div>def‬abc‬</div> |
| <div>‬abc‬def</div> |
| <div>xyz‬abc‬def</div> |
| |
| <p>Nested unicode bidi control characters. |
| <div>‪‪b!‬</div> |
| <div>‫‫b!‬</div> |
| <div>‬‬b!‬</div> |
| <div>‬1‫c!‬</div> |
| |
| <p>Start with different directionality characters. |
| <div>12‬‪1‬‫</div> |
| <div>12‬‪</div> |
| <div>٠١‬‪</div> |
| <div>ڃڄ‬‪</div> |
| <div>‬‪</div> |
| <div>abc‬‪</div> |
| <div>אב‬‪</div> |
| </div> |
| ''', treeSanitizer: new NullTreeSanitizer()); |
| |
| var test = document.getElementById('test'); |
| var sel = window.getSelection(); |
| sel.setPosition(test,0); |
| sel.modify("move", "right", "lineBoundary"); |
| sel.modify("move", "left", "character"); |
| sel.modify("extend", "left", "character"); |
| debug("test id=test: the right-most character of rendering result of <PDF>abc<PDF> in RTL block should be c"); |
| shouldBe(sel.toString(), 'c'); |
| } |