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

Side by Side Diff: third_party/WebKit/LayoutTests/typedcssom/styleValue-parse-basic.html

Issue 2867883003: [CSS Typed OM] Delete obsolete number and length classes from Typed OM (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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src='../resources/testharness.js'></script> 2 <script src='../resources/testharness.js'></script>
3 <script src='../resources/testharnessreport.js'></script> 3 <script src='../resources/testharnessreport.js'></script>
4 <script> 4 <script>
5 5
6 test(function() { 6 test(function() {
7 var result = CSSStyleValue.parse('width', '10px'); 7 var result = CSSStyleValue.parse('width', '10px');
8 8
9 assert_not_equals(result, null); 9 assert_not_equals(result, null);
10 assert_equals(result.constructor.name, CSSSimpleLength.name); 10 assert_equals(result.constructor.name, CSSUnitValue.name);
11 assert_equals(result.value, 10); 11 assert_equals(result.value, 10);
12 assert_equals(result.type, 'px'); 12 assert_equals(result.type, 'px');
13 }, 'Parsing 10px results in a CSSSimpleLength'); 13 }, 'Parsing 10px results in a CSSUnitValue');
14 14
15 test(function() { 15 test(function() {
16 assert_equals(CSSStyleValue.parse('width', 'hello'), null); 16 assert_equals(CSSStyleValue.parse('width', 'hello'), null);
17 assert_equals(CSSStyleValue.parse('width', ''), null); 17 assert_equals(CSSStyleValue.parse('width', ''), null);
18 assert_equals(CSSStyleValue.parse('width', null), null); 18 assert_equals(CSSStyleValue.parse('width', null), null);
19 }, 'Parsing returns null on failure'); 19 }, 'Parsing returns null on failure');
20 20
21 test(function() { 21 test(function() {
22 assert_throws(new TypeError(), function() { 22 assert_throws(new TypeError(), function() {
23 CSSStyleValue.parse('', '10px'); 23 CSSStyleValue.parse('', '10px');
24 }); 24 });
25 }, 'Passing in empty string to parse for the property name throws'); 25 }, 'Passing in empty string to parse for the property name throws');
26 26
27 test(function() { 27 test(function() {
28 assert_throws(new TypeError(), function() { 28 assert_throws(new TypeError(), function() {
29 CSSStyleValue.parse('hello', '5px'); 29 CSSStyleValue.parse('hello', '5px');
30 }); 30 });
31 }, 'Passing in an invalid property name throws'); 31 }, 'Passing in an invalid property name throws');
32 32
33 test(function() { 33 test(function() {
34 assert_throws(new TypeError(), function() { 34 assert_throws(new TypeError(), function() {
35 CSSStyleValue.parse('border', '10px'); 35 CSSStyleValue.parse('border', '10px');
36 }); 36 });
37 }, 'Attempting to parse a value for a shorthand property throws'); 37 }, 'Attempting to parse a value for a shorthand property throws');
38 38
39 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698