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/typedcssom/cssRotation.html

Issue 2942183002: [CSS Typed OM] Make CSSRotation attributes mutable. (Closed)
Patch Set: rebase Created 3 years, 6 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/typedcssom/cssRotation.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html b/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html
index bc7cff4afccaa933f8990351d43e3d492027ccdd..22ad92b343248a915e18b333ba5e74436fada85e 100644
--- a/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html
+++ b/third_party/WebKit/LayoutTests/typedcssom/cssRotation.html
@@ -52,7 +52,8 @@ var testParams = [
x: 0,
y: 0,
z: 1,
- is2D: false, cssText: "rotate3d(0, 0, 1, 90deg)",
+ is2D: false,
+ cssText: "rotate3d(0, 0, 1, 90deg)",
asMatrix: new DOMMatrixReadOnly([0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
},
{
@@ -147,4 +148,34 @@ for (let params of testParams) {
}, "toMatrix works for " + params.cssText);
}
+for (let attribute of ["x", "y", "z"]) {
+ test(() => {
+ let rotation = new CSSRotation(1, 2, 3, new CSSUnitValue(10, 'deg'));
+ assert_equals(rotation.x, 1);
+ assert_equals(rotation.y, 2);
+ assert_equals(rotation.z, 3);
+
+ rotation[attribute] = 4;
+ assert_equals(rotation[attribute], 4);
+ }, "Setting " + attribute + " with valid values");
+}
+
+test(() => {
+ let rotation = new CSSRotation(new CSSUnitValue(10, 'deg'));
+ assert_equals(rotation.angle.value, 10);
+ assert_equals(rotation.angle.unit, 'deg');
+
+ rotation.angle = new CSSUnitValue(20, 'rad');
+ assert_equals(rotation.angle.value, 20);
+ assert_equals(rotation.angle.unit, 'rad');
+}, "Setting angle with valid value");
+
+test(() => {
+ let rotation = new CSSRotation(new CSSUnitValue(10, 'deg'));
+
+ assert_throws(new TypeError(), () => {
+ rotation.angle = new CSSUnitValue(20, 'px');
+ });
+}, "Setting angle with invalid value");
+
</script>

Powered by Google App Engine
This is Rietveld 408576698