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

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html

Issue 2791193004: [Typed CSSOM] New design for computed styles which includes custom properties (Closed)
Patch Set: Make UpdateStyle non-const Created 3 years, 7 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/computedstyle/line-height.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html b/third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html
index 80a586305f11fff0b7f60ed8f829cc54899ce272..68c9e89471ac82a25eeec8f41fb81bfb30400f82 100644
--- a/third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html
+++ b/third_party/WebKit/LayoutTests/typedcssom/computedstyle/line-height.html
@@ -12,83 +12,48 @@
testElement.style.lineHeight = '10px';
testElement.style.fontSize = '100px';
-
-var t1 = async_test("Getting a 10px lineHeight results in a CSSSimpleLength");
-function t1Callback(computedStyleMap) {
- t1.step(function() {
- var result = computedStyleMap.get('line-height');
- assert_equals(result.constructor.name, CSSSimpleLength.name);
- assert_equals(result.cssText, '10px');
- });
- t1.done();
-}
-
-var t2 = async_test("getAll for lineHeight returns a single value");
-function t2Callback(computedStyleMap) {
- t2.step(function() {
- testElement.style.lineHeight = '20px';
- var result = computedStyleMap.getAll('line-height');
- assert_equals(result.length, 1);
- assert_equals(result[0].cssText, '20px');
- });
- t2.done();
-}
-
-var t3 = async_test("Getting a 10% lineHeight results in a CSSSimpleLength");
-function t3Callback(computedStyleMap) {
- t3.step(function() {
- testElement.style.lineHeight = '10%';
- var result = computedStyleMap.get('line-height');
- assert_equals(result.constructor.name, CSSSimpleLength.name);
- assert_equals(result.cssText, '10px');
- });
- t3.done();
-}
-
-var t4 = async_test("Getting a number lineHeight results in a CSSNumberValue");
-function t4Callback(computedStyleMap) {
- t4.step(function() {
- testElement.style.lineHeight = '0.2';
- var result = computedStyleMap.get('line-height');
- assert_equals(result.constructor.name, CSSNumberValue.name);
- assert_equals(result.cssText, '20');
- });
- t4.done();
-}
-
-var t5 = async_test("Getting a calc lineHeight results in a CSSSimpleLength");
-function t5Callback(computedStyleMap) {
- t5.step(function() {
- testElement.style.lineHeight = 'calc(10px + 10%)';
- var result = computedStyleMap.get('line-height');
- assert_equals(result.constructor.name, CSSSimpleLength.name);
- assert_equals(result.cssText, '20px');
- });
- t5.done();
-}
-
-var t6 = async_test("Getting a normal lineHeight results in a CSSKeywordValue");
-function t6Callback(computedStyleMap) {
- t6.step(function() {
- testElement.style.lineHeight = 'normal';
- var result = computedStyleMap.get('line-height');
- assert_equals(result.constructor.name, CSSKeywordValue.name);
- assert_equals(result.cssText, 'normal');
- });
- t6.done();
-}
-
-document.onreadystatechange = function() {
- if(document.readyState == 'complete') {
- var computedStyleMap = getComputedStyleMap(testElement);
- t1Callback(computedStyleMap);
- t2Callback(computedStyleMap);
- t3Callback(computedStyleMap);
- t4Callback(computedStyleMap);
- t5Callback(computedStyleMap);
- t6Callback(computedStyleMap);
- }
-};
+var computedStyleMap = getComputedStyleMap(testElement);
+
+test(function() {
+ var result = computedStyleMap.get('line-height');
+ assert_true(result instanceof CSSSimpleLength);
+ assert_equals(result.cssText, '10px');
+}, 'Getting a 10px lineHeight results in a CSSSimpleLength');
+
+test(function() {
+ testElement.style.lineHeight = '20px';
+ var result = computedStyleMap.getAll('line-height');
+ assert_equals(result.length, 1);
+ assert_equals(result[0].cssText, '20px');
+}, 'getAll for lineHeight returns a single value');
+
+test(function() {
+ testElement.style.lineHeight = '10%';
+ var result = computedStyleMap.get('line-height');
+ assert_true(result instanceof CSSSimpleLength);
+ assert_equals(result.cssText, '10px');
+}, 'Getting a 10% lineHeight results in a CSSSimpleLength');
+
+test(function() {
+ testElement.style.lineHeight = '0.2';
+ var result = computedStyleMap.get('line-height');
+ assert_true(result instanceof CSSSimpleLength);
+ assert_equals(result.cssText, '20px');
+}, 'Getting a number lineHeight results in a CSSSimpleLength');
+
+test(function() {
+ testElement.style.lineHeight = 'calc(10px + 10%)';
+ var result = computedStyleMap.get('line-height');
+ assert_true(result instanceof CSSSimpleLength);
+ assert_equals(result.cssText, '20px');
+}, 'Getting a calc lineHeight results in a CSSSimpleLength');
+
+test(function() {
+ testElement.style.lineHeight = 'normal';
+ var result = computedStyleMap.get('line-height');
+ assert_true(result instanceof CSSKeywordValue);
+ assert_equals(result.cssText, 'normal');
+}, 'Getting a normal lineHeight results in a CSSKeywordValue');
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698