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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/resources/font-variation-settings-css-support.js

Issue 2558053002: Add CSS support for font-variation-settings (Closed)
Patch Set: DCHECK corrected, newline removed. Created 4 years 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 var validWriteExpectations = [ "normal",
2 "'abcd' 1",
3 "'abcd' 0, 'efgh' 1",
4 "'abcd' 0.3, 'efgh' 1.4",
5 "'abcd' -1000, 'efgh' -10000",
6 "'abcd' 0.3, 'abcd' 0.4, 'abcd' 0.5, 'abcd' 0.6, 'abcd' 0.7" ];
7
8 var writeInvalidExpectations = ["none",
9 "'abc' 1",
10 "'abcde' 1",
11 "",
12 "'abc¡' 1",
13 "normal, 'abcd' 0",
14 "'abcd'",
15 "'abcd' 1 2",
16 "1 1",
17 "0 0",
18 "a a"];
19
20 setup({ explicit_done: true });
21
22 function styleAndComputedStyleReadback() {
23
24 var testContainer = document.createElement("div");
25 document.body.appendChild(testContainer);
26
27 for (validValue of validWriteExpectations) {
28 testContainer.style.fontVariationSettings = validValue;
29 test(function() {
30 assert_equals(testContainer.style.fontVariationSettings, validValue) ;
31 assert_equals(getComputedStyle(testContainer).fontVariationSettings, validValue);
32 }, 'font-variation-settings value ' + validValue + ' should be equal whe n reading it back from style and getComputedstyle.');
33 }
34
35 document.body.removeChild(testContainer);
36 }
37
38 function testInheritance() {
39 var testContainer = document.createElement('div');
40 var testContainerChild = document.createElement('div');
41 testContainer.appendChild(testContainerChild);
42 document.body.appendChild(testContainer);
43
44 for (validValue of validWriteExpectations) {
45 testContainer.style.fontVariationSettings = validValue;
46 test(function() {
47 assert_equals(testContainerChild.style.fontVariationSettings, '');
48 assert_equals(getComputedStyle(testContainerChild).fontVariationSett ings, validValue);
49 }, 'font-variation-settings value ' + validValue + ' should be inherited to computed style of child.');
50 }
51 document.body.removeChild(testContainer);
52 }
53
54 function validWriteTests() {
55 for (validValue of validWriteExpectations) {
56 test(function() {
57 assert_true(CSS.supports('font-variation-settings', validValue));
58 }, 'Value ' + validValue + ' valid for property font-variation-settings' );
59 }
60 }
61
62 function invalidWriteTests() {
63 for (invalidValue of writeInvalidExpectations) {
64 test(function() {
65 assert_false(CSS.supports('font-variation-settings', invalidValue));
66 }, 'Value ' + invalidValue + ' invalid for property font-variation-setti ngs');
67 }
68 }
69
70 window.addEventListener('load', function() {
71 validWriteTests();
72 invalidWriteTests();
73 styleAndComputedStyleReadback();
74 testInheritance();
75 done();
76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698