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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/CSSStyleDeclaration.html

Issue 2468053002: Import wpt@9fcccf38b6be00f71ffa6bd6e29c5aa1ef25ee8c (Closed)
Patch Set: Skip cssom and svg/shapes, remove unwanted baseline Created 4 years, 1 month 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Custom Elements: CEReactions on CSSStyleDeclaration interface</title>
5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
6 <meta name="assert" content="cssText, setProperty, setPropertyValue, setProperty Priority, removeProperty, cssFloat, and all camel cased attributes of CSSStyleDe claration interface must have CEReactions">
7 <meta name="help" content="https://dom.spec.whatwg.org/#node">
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <script src="../resources/custom-elements-helpers.js"></script>
11 <script src="./resources/reactions.js"></script>
12 </head>
13 <body>
14 <div id="log"></div>
15 <script>
16
17 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
18 instance.style.cssText = `${propertyName}: ${value}`;
19 }, 'cssText on CSSStyleDeclaration');
20
21 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
22 instance.style.setProperty(propertyName, value);
23 }, 'setProperty on CSSStyleDeclaration');
24
25 test_mutating_style_property_priority(function (instance, propertyName, idlName, isImportant) {
26 instance.style.setProperty(propertyName, instance.style[idlName], isImportan t ? 'important': '');
27 }, 'setProperty on CSSStyleDeclaration');
28
29 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
30 instance.style.setPropertyValue(propertyName, value);
31 }, 'setPropertyValue on CSSStyleDeclaration');
32
33 test_mutating_style_property_priority(function (instance, propertyName, idlName, isImportant) {
34 instance.style.setPropertyPriority(propertyName, isImportant ? 'important': '');
35 }, 'setPropertyPriority on CSSStyleDeclaration');
36
37 test_removing_style_property_value(function (instance, propertyName, idlName) {
38 instance.style.removeProperty(propertyName);
39 }, 'removeProperty on CSSStyleDeclaration');
40
41 test(function () {
42 var element = define_new_custom_element(['style']);
43 var instance = document.createElement(element.name);
44 assert_array_equals(element.takeLog().types(), ['constructed']);
45 instance.style.cssFloat = 'left';
46 assert_equals(instance.getAttribute('style'), 'float: left;');
47 var logEntries = element.takeLog();
48 assert_array_equals(logEntries.types(), ['attributeChanged']);
49 assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: null , newValue: 'float: left;', namespace: null});
50 }, 'cssFloat on CSSStyleDeclaration must enqueue an attributeChanged reaction wh en it adds the observed style attribute');
51
52 test(function () {
53 var element = define_new_custom_element([]);
54 var instance = document.createElement(element.name);
55 assert_array_equals(element.takeLog().types(), ['constructed']);
56 instance.style.cssFloat = 'left';
57 assert_equals(instance.getAttribute('style'), 'float: left;');
58 assert_array_equals(element.takeLog().types(), []);
59 }, 'cssFloat on CSSStyleDeclaration must not enqueue an attributeChanged reactio n when it adds the style attribute but the style attribute is not observed');
60
61 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
62 assert_equals(idlName, 'borderWidth');
63 instance.style.borderWidth = value;
64 }, 'A camel case attribute (borderWidth) on CSSStyleDeclaration',
65 {propertyName: 'border-width', idlName: 'borderWidth', value1: '2px', value2 : '4px'});
66
67 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
68 assert_equals(propertyName, 'border-width');
69 instance.style['border-width'] = value;
70 }, 'A dashed property (border-width) on CSSStyleDeclaration',
71 {propertyName: 'border-width', idlName: 'borderWidth', value1: '1px', value2 : '5px'});
72
73 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
74 instance.style.webkitFilter = value;
75 }, 'A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration ',
76 {propertyName: 'filter', idlName: 'filter', value1: 'grayscale(20%)', value2 : 'grayscale(30%)'});
77
78 test_mutating_style_property_value(function (instance, propertyName, idlName, va lue) {
79 instance.style['-webkit-filter'] = value;
80 }, 'A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration',
81 {propertyName: 'filter', idlName: 'filter', value1: 'grayscale(20%)', value2 : 'grayscale(30%)'});
82
83 </script>
84 </body>
85 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698