Index: LayoutTests/editing/selection/user-select-js-property.html |
diff --git a/LayoutTests/editing/selection/user-select-js-property.html b/LayoutTests/editing/selection/user-select-js-property.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8d8a496ac346a909ccd198a163088dd34d53553c |
--- /dev/null |
+++ b/LayoutTests/editing/selection/user-select-js-property.html |
@@ -0,0 +1,34 @@ |
+<script src="../../fast/js/resources/js-test-pre.js"></script> |
+<div id="container"> |
+<p id="description"></p> |
+<div id="sample1" contenteditable="true">editable</div> |
+<div id="sample2" contenteditable="false">uneditable</div> |
+</div> |
+</div> |
+<script> |
+function $(id) { return document.getElementById(id); } |
+description('Test setting CSSStyleDeclaration.webkitUserStyle'); |
+ |
+var selection = window.getSelection(); |
+function setSelection(node) |
+{ |
+ var range = document.createRange(); |
+ range.selectNodeContents(node); |
+ selection.empty(); |
+ selection.addRange(range); |
+} |
+ |
+// user-select:none in editable element |
+$('sample1').style.webkitUserSelect = 'none'; |
+setSelection($('sample1')); |
+shouldBeEqualToString('selection.type', 'Range'); |
+ |
+// user-select:none in uneditable element |
+$('sample2').style.webkitUserSelect = 'none'; |
+setSelection($('sample2')); |
+shouldBeEqualToString('selection.type', 'None'); |
+ |
+if (window.testRunner) |
+ $('container').outerHTML = ''; |
+</script> |
+<script src="../../fast/js/resources/js-test-post.js"></script> |