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

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/config-templates.js

Issue 2583063002: Add common test configs for properties that take lengths (Closed)
Patch Set: Remove extra whitespace Created 3 years, 9 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/inlinestyle/properties/config-templates.js
diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/config-templates.js b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/config-templates.js
index e4d37c3a7ee5009eb51d361f04dcc825cfb635d7..505c0d37a77a19a3c33261759edcce9312659020 100644
--- a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/config-templates.js
+++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/config-templates.js
@@ -2,9 +2,83 @@
* Generates config objects that are common between multiple properties for use
* in property-suite.js
*/
+
let config_templates = {};
+config_templates.lengthConfig_ = {
+ validObjects: [
+ new CSSSimpleLength(1, 'px'),
+ new CSSSimpleLength(3, 'em'),
+ new CSSSimpleLength(4, 'ex'),
+ new CSSSimpleLength(5, 'ch'),
+ new CSSSimpleLength(6, 'rem'),
+ new CSSSimpleLength(7, 'vw'),
+ new CSSSimpleLength(8, 'vh'),
+ new CSSSimpleLength(9, 'vmin'),
+ new CSSSimpleLength(10, 'vmax'),
+ new CSSSimpleLength(11, 'cm'),
+ new CSSSimpleLength(12, 'mm'),
+ new CSSSimpleLength(13, 'in'),
+ new CSSSimpleLength(14, 'pc'),
+ new CSSSimpleLength(15, 'pt'),
+ // Fully populated calc (no percent)
+ new CSSCalcLength({
+ px: 1200,
+ em: 4.5,
+ ex: -6.7,
+ ch: 8.9,
+ rem: -10,
+ vw: 1.1,
+ vh: -1.2,
+ vmin: 1.3,
+ vmax: -1.4,
+ cm: 1.56,
+ mm: -1.7,
+ in: 1.8,
+ pc: -1.9,
+ pt: 2.1}),
+ // Contains only px
+ new CSSCalcLength({px: 10}),
+ // Contains neither pixels or percent
+ new CSSCalcLength({vmin: 5, in: 10}),
+ ],
+ validStringMappings: {
+ // Contains multiplication
+ 'calc(3 * (5px - 3em))': new CSSCalcLength({px: 15, em: -9}),
+ // Contains division
+ 'calc((5vmin + 1mm) / 2)': new CSSCalcLength({vmin: 2.5, mm: 0.5}),
+ },
+ supportsMultiple: false,
+ invalidObjects: [new CSSNumberValue(1)]
+};
-config_templates.borderConfig = {
+config_templates.lengthPercentConfig_ = Object.assign(
+ {}, config_templates.lengthConfig_);
+config_templates.lengthPercentConfig_.validObjects.concat([
+ new CSSSimpleLength(2, 'percent'),
+ // Fully populated calc
+ new CSSCalcLength({
+ px: 1200,
+ percent: -2.3,
+ em: 4.5,
+ ex: -6.7,
+ ch: 8.9,
+ rem: -10,
+ vw: 1.1,
+ vh: -1.2,
+ vmin: 1.3,
+ vmax: -1.4,
+ cm: 1.56,
+ mm: -1.7,
+ in: 1.8,
+ pc: -1.9,
+ pt: 2.1}),
+ // Contains only percent
+ new CSSCalcLength({percent: 10}),
+ // Contains px and percent
+ new CSSCalcLength({px: 6, percent: 10})
+ ]);
+
+config_templates.borderConfig_ = {
validKeywords: [
'none',
//TODO: Implement the keywords listed below.
@@ -23,4 +97,14 @@ config_templates.borderConfig = {
],
supportsMultiple: false,
invalidObjects: [new CSSSimpleLength(4, 'px')]
-};
+};
+
+config_templates.lengthConfig = function() {
+ return Object.assign({}, config_templates.lengthConfig_);
+};
+config_templates.lengthPercentConfig = function() {
+ return Object.assign({}, config_templates.lengthPercentConfig_);
+};
+config_templates.borderConfig = function() {
+ return Object.assign({}, config_templates.borderConfig_);
+};

Powered by Google App Engine
This is Rietveld 408576698