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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-properties/register-property.html

Issue 2310823002: Skeleton implementation of CSS Properties and Values API (Closed)
Patch Set: fix stylevardata copy ctor Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-properties/unregister-property.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script>
5 // Tests for error checking during property registration
6
7 test(function() {
8 assert_throws(new TypeError(), () => CSS.registerProperty());
9 assert_throws(new TypeError(), () => CSS.registerProperty(undefined));
10 assert_throws(new TypeError(), () => CSS.registerProperty(true));
11 assert_throws(new TypeError(), () => CSS.registerProperty(2));
12 assert_throws(new TypeError(), () => CSS.registerProperty("css"));
13 assert_throws(new TypeError(), () => CSS.registerProperty(null));
14 }, "registerProperty requires a Dictionary type");
15
16 test(function() {
17 // Valid property names, shouldn't throw
18 CSS.registerProperty({name: '--name1'});
19 CSS.registerProperty({name: '--name2, no need for escapes'});
20 CSS.registerProperty({name: ['--name', 3]});
21
22 // Invalid property names
23 assert_throws(new TypeError(), () => CSS.registerProperty({}));
24 assert_throws(new SyntaxError(), () => CSS.registerProperty({name: 'no-leadi ng-dash'}));
25 assert_throws(new SyntaxError(), () => CSS.registerProperty({name: ''}));
26 assert_throws(new SyntaxError(), () => CSS.registerProperty({name: '\\--name '}));
27 }, "registerProperty requires a name matching <custom-property-name>");
28
29 test(function() {
30 CSS.registerProperty({name: '--syntax-test-1', syntax: '*'});
31 CSS.registerProperty({name: '--syntax-test-2', syntax: ' * '});
32 assert_throws(new SyntaxError(),
33 () => CSS.registerProperty({name: '--syntax-test-3', syntax: 'length'})) ;
34 }, "registerProperty only allows omitting initialValue is syntax is '*'");
35 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-properties/unregister-property.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698