Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: third_party/WebKit/LayoutTests/editing/selection/script-tests/user-select-js-property.html

Issue 2246293003: Unprefix CSS user-select property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/selection/script-tests/user-select-js-property.html
diff --git a/third_party/WebKit/LayoutTests/editing/selection/script-tests/user-select-js-property.html b/third_party/WebKit/LayoutTests/editing/selection/script-tests/user-select-js-property.html
index 1fb71995847a318384d60c63b581cc56fd7c2bd4..8ddcf68b2a15f065e40b4e5e77fe05ad46b1357d 100644
--- a/third_party/WebKit/LayoutTests/editing/selection/script-tests/user-select-js-property.html
+++ b/third_party/WebKit/LayoutTests/editing/selection/script-tests/user-select-js-property.html
@@ -1,10 +1,20 @@
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
+<style>
+ #foo {
+ user-select: none;
+ }
+ #bar {
+ -webkit-user-select: none;
+ }
+</style>
<div id="container">
-<p id="description">Test setting CSSStyleDeclaration.webkitUserStyle</p>
+<p id="description">Test setting CSSStyleDeclaration.webkitUserStyle and userStyle</p>
<div id="sample1" contenteditable="true">editable</div>
<div id="sample2" contenteditable="false">uneditable</div>
+<div class="none" style="user-select:none"></div>
+<div class="none" style="-webkit-user-select:none"></div>
</div>
<div id="log"></div>
<script>
@@ -19,13 +29,38 @@ function setSelection(node)
test(function(){
// user-select:none in editable element
- sample1.style.webkitUserSelect = 'none';
+ sample1.style.webkitUserSelect = "none";
setSelection(sample1);
- assert_equals(selection.type, 'Range');
+ assert_equals(selection.type, "Range");
// user-select:none in uneditable element
- sample2.style.webkitUserSelect = 'none';
+ sample2.style.webkitUserSelect = "none";
setSelection(sample2);
- assert_equals(selection.type, 'None');
+ assert_equals(selection.type, "None");
});
+
+var style = document.createElement("baz").style;
+test(function () {
+ assert_true("userSelect" in style);
+}, "'userSelect' in style");
+test(function () {
+ assert_true("webkitUserSelect" in style);
+}, "'webkitUserSelect' in style");
+
+Array.prototype.forEach.call(document.styleSheets[0].cssRules, function (cssRule) {
+ testUserSelect(cssRule.style, cssRule.cssText);
+});
+
+Array.prototype.forEach.call(document.querySelectorAll(".none"), function (element) {
+ testUserSelect(getComputedStyle(element), element.getAttribute("style"));
+});
+
+function testUserSelect(style, title) {
+ test(function () {
+ assert_equals(style.userSelect, "none");
+ }, "userSelect of '" + title + "' should be 'none'");
+ test(function () {
+ assert_equals(style.webkitUserSelect, "none");
+ }, "webkitUserSelect of '" + title + "' should be 'none'");
+}
</script>

Powered by Google App Engine
This is Rietveld 408576698