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

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

Powered by Google App Engine
This is Rietveld 408576698