Index: third_party/WebKit/LayoutTests/typedcssom/cssSimpleLength.html |
diff --git a/third_party/WebKit/LayoutTests/typedcssom/cssSimpleLength.html b/third_party/WebKit/LayoutTests/typedcssom/cssSimpleLength.html |
deleted file mode 100644 |
index 6cc307e96d4d5ad96461109d2a9c1607a1f4a4d8..0000000000000000000000000000000000000000 |
--- a/third_party/WebKit/LayoutTests/typedcssom/cssSimpleLength.html |
+++ /dev/null |
@@ -1,158 +0,0 @@ |
-<!DOCTYPE html> |
-<script src='../resources/testharness.js'></script> |
-<script src='../resources/testharnessreport.js'></script> |
- |
-<script> |
- |
-test(function() { |
- var simpleLength = new CSSSimpleLength(1, 'px'); |
- assert_equals(simpleLength.value, 1); |
- assert_equals(simpleLength.type, 'px'); |
- |
- simpleLength.value = 2; |
- simpleLength.type = 'em'; |
- |
- assert_equals(simpleLength.value, 1); |
- assert_equals(simpleLength.type, 'px'); |
-}, 'CSSSimpleLengths are immutable'); |
- |
-test(function() { |
- var units = ['px', 'percent', 'em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax', 'cm', 'mm', 'in', 'pc', 'pt']; |
- for (var i = 0; i < units.length; ++i) { |
- var simpleLength = new CSSSimpleLength(i, units[i]); |
- assert_equals(simpleLength.type, units[i]); |
- } |
-}, 'Each unit type is returned according to the spec'); |
- |
-test(function() { |
- var simpleLength1 = new CSSSimpleLength(5.1, 'px'); |
- var simpleLength2 = new CSSSimpleLength(10, 'px'); |
- |
- var result = simpleLength1.add(simpleLength2); |
- |
- assert_not_equals(simpleLength1, result); |
- assert_not_equals(simpleLength2, result); |
- assert_equals(result.constructor.name, CSSSimpleLength.name); |
- assert_equals(result.value, 15.1); |
- assert_equals(result.type, 'px'); |
-}, 'Adding CSSSimpleLengths with the same unit produces a new CSSSimpleLength with the correct value.'); |
- |
-test(function() { |
- var simpleLength1 = new CSSSimpleLength(5.1, 'px'); |
- var simpleLength2 = new CSSSimpleLength(10, 'percent'); |
- |
- var result = simpleLength1.add(simpleLength2); |
- |
- assert_equals(result.constructor.name, CSSCalcLength.name); |
- assert_equals(result.px, 5.1); |
- assert_equals(result.percent, 10); |
-}, 'Adding CSSSimpleLengths with different units produces a calc length with the correct values.'); |
- |
-test(function() { |
- var simpleLength1 = new CSSSimpleLength(5.1, 'px'); |
- var simpleLength2 = new CSSSimpleLength(10, 'px'); |
- |
- var result = simpleLength1.subtract(simpleLength2); |
- |
- assert_not_equals(simpleLength1, result); |
- assert_not_equals(simpleLength2, result); |
- assert_equals(result.constructor.name, CSSSimpleLength.name); |
- assert_equals(result.value, -4.9); |
- assert_equals(result.type, 'px'); |
-}, 'Subtracting CSSSimpleLengths with the same unit produces a new CSSSimpleLength with the correct value.'); |
- |
-test(function() { |
- var simpleLength1 = new CSSSimpleLength(5.1, 'px'); |
- var simpleLength2 = new CSSSimpleLength(10, 'percent'); |
- |
- var result = simpleLength1.subtract(simpleLength2); |
- |
- assert_equals(result.constructor.name, CSSCalcLength.name); |
- assert_equals(result.px, 5.1); |
- assert_equals(result.percent, -10); |
-}, 'Subtracting CSSSimpleLengths with different units produces a calc length with the correct values.'); |
- |
-test(function() { |
- var simpleLength = new CSSSimpleLength(5.2, 'px'); |
- var result = simpleLength.multiply(4); |
- |
- assert_not_equals(simpleLength, result); |
- assert_equals(result.constructor.name, CSSSimpleLength.name); |
- assert_approx_equals(result.value, 20.8, 0.00000001); |
- assert_equals(result.type, 'px'); |
-}, 'Multiplying a CSSSimpleLength produces a new CSSSimpleLength with the correct value.'); |
- |
-test(function() { |
- var simpleLength = new CSSSimpleLength(25, 'px'); |
- var result = simpleLength.divide(2); |
- |
- assert_not_equals(simpleLength, result); |
- assert_equals(result.constructor.name, CSSSimpleLength.name); |
- assert_equals(result.value, 12.5); |
- assert_equals(result.type, 'px'); |
-}, 'Dividing a CSSSimpleLength produces a new CSSSimpleLength with the correct value.'); |
- |
-test(function() { |
- var simpleLength = new CSSSimpleLength(1, 'px'); |
- assert_throws(new RangeError(), function() { simpleLength.divide(0); }); |
-}, 'Dividing by zero throws a RangeError'); |
- |
-test(function() { |
- var values = [ |
- {input: new CSSSimpleLength(1, 'px'), cssText: '1px' }, |
- {input: new CSSSimpleLength(2, 'percent'), cssText: '2%' }, |
- {input: new CSSSimpleLength(3, '%'), cssText: '3%' }, |
- {input: new CSSSimpleLength(4, 'em'), cssText: '4em' }, |
- {input: new CSSSimpleLength(5, 'ex'), cssText: '5ex' }, |
- {input: new CSSSimpleLength(6, 'ch'), cssText: '6ch' }, |
- {input: new CSSSimpleLength(7, 'rem'), cssText: '7rem' }, |
- {input: new CSSSimpleLength(8, 'vw'), cssText: '8vw' }, |
- {input: new CSSSimpleLength(9, 'vh'), cssText: '9vh' }, |
- {input: new CSSSimpleLength(10, 'vmin'), cssText: '10vmin' }, |
- {input: new CSSSimpleLength(11, 'vmax'), cssText: '11vmax' }, |
- {input: new CSSSimpleLength(12, 'cm'), cssText: '12cm' }, |
- {input: new CSSSimpleLength(13, 'mm'), cssText: '13mm' }, |
- {input: new CSSSimpleLength(14, 'in'), cssText: '14in' }, |
- {input: new CSSSimpleLength(15, 'pc'), cssText: '15pc' }, |
- {input: new CSSSimpleLength(16, 'pt'), cssText: '16pt' }, |
- // Same again to double check that it's case insensitive. |
- {input: new CSSSimpleLength(1, 'PX'), cssText: '1px' }, |
- {input: new CSSSimpleLength(2, 'PERCENT'), cssText: '2%' }, |
- {input: new CSSSimpleLength(3, '%'), cssText: '3%' }, |
- {input: new CSSSimpleLength(4, 'EM'), cssText: '4em' }, |
- {input: new CSSSimpleLength(5, 'EX'), cssText: '5ex' }, |
- {input: new CSSSimpleLength(6, 'CH'), cssText: '6ch' }, |
- {input: new CSSSimpleLength(7, 'REM'), cssText: '7rem' }, |
- {input: new CSSSimpleLength(8, 'VW'), cssText: '8vw' }, |
- {input: new CSSSimpleLength(9, 'VH'), cssText: '9vh' }, |
- {input: new CSSSimpleLength(10, 'VMIN'), cssText: '10vmin' }, |
- {input: new CSSSimpleLength(11, 'VMAX'), cssText: '11vmax' }, |
- {input: new CSSSimpleLength(12, 'CM'), cssText: '12cm' }, |
- {input: new CSSSimpleLength(13, 'MM'), cssText: '13mm' }, |
- {input: new CSSSimpleLength(14, 'IN'), cssText: '14in' }, |
- {input: new CSSSimpleLength(15, 'PC'), cssText: '15pc' }, |
- {input: new CSSSimpleLength(16, 'PT'), cssText: '16pt' }, |
- ]; |
- |
- for (var i = 0; i < values.length; ++i) { |
- assert_equals(values[i].input.cssText, values[i].cssText); |
- } |
-}, 'cssText is generated correctly for each unit type.'); |
- |
-test(function() { |
- var values = [ |
- {value: NaN, unit: 'px'}, |
- {value: Infinity, unit: 'px'}, |
- {value: -Infinity, unit: 'px'}, |
- {value: 5, unit: 'puppies'} |
- ]; |
- |
- for (var i = 0; i < values.length; ++i) { |
- assert_throws(null, function() { new CSSSimpleLength(values[i].value, values[i].unit); }); |
- } |
-}, 'Invalid input throws an exception.'); |
- |
-</script> |
- |
-<body> |
-</body> |