Debian Codegraph @

test/acceptance/safari/rules.ts

raw symbols SCIP
1 import {Selector} from 'testcafe';
2
3 fixture `Safari Rules Tests`
4 .page `http://localhost:8080/test/page/with-css.html`;
5
6 test('Use a better box model (opinionated).', async t => {
7 await t
8 .expect(Selector('html').getStyleProperty('box-sizing')).eql('border-box');
9 });
10
11 test('Use a more readable tab size (opinionated).', async t => {
12 await t
13 .expect(Selector('html').getStyleProperty('tab-size')).eql('4');
14 });
15
16 test('Correct the line height in all browsers.', async t => {
17 await t
18 .expect(Selector('html').getStyleProperty('font-size')).eql('16px')
19 .expect(Selector('html').getStyleProperty('line-height')).eql('18px');
20 });
21
22 test('Prevent adjustments of font size after orientation changes in iOS.', async t => {
23 await t
24 // TODO: Check behavior of `-webkit-text-size-adjust` changing to auto in Safari
25 .expect(Selector('html').getStyleProperty('-webkit-text-size-adjust')).eql('auto');
26 });
27
28 test('Remove the margin in all browsers.', async t => {
29 await t
30 .expect(Selector('body').getStyleProperty('margin-top')).eql('0px')
31 .expect(Selector('body').getStyleProperty('margin-right')).eql('0px')
32 .expect(Selector('body').getStyleProperty('margin-bottom')).eql('0px')
33 .expect(Selector('body').getStyleProperty('margin-left')).eql('0px');
34 });
35
36 test('Improve consistency of default fonts in all browsers.', async t => {
37 await t
38 .expect(Selector('body').getStyleProperty('font-family')).eql(`system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"`);
39 });
40
41 test('<hr> should be the correct height.', async t => {
42 await t
43 .expect(Selector('hr[data-test--hr]').getStyleProperty('height')).eql('2px');
44 });
45
46 test('Add the correct text decoration in Safari.', async t => {
47 // TODO: Why `text-decoration` is none?
48 // await t
49 // .expect(Selector('abbr[data-test--abbr]').getStyleProperty('text-decoration')).eql('underline dotted');
50 });
51
52 test('Add the correct font weight in Chrome and Safari.', async t => {
53 await t
54 .expect(Selector('b[data-test--bold]').getStyleProperty('font-weight')).eql('900')
55 .expect(Selector('strong[data-test--bold]').getStyleProperty('font-weight')).eql('900');
56 });
57
58 test('Improve consistency of default fonts in all browsers.', async t => {
59 await t
60 .expect(Selector('[data-test--code]').getStyleProperty('font-family')).eql('ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace');
61 });
62
63 test('Correct the odd `em` font sizing in all browsers.', async t => {
64 await t
65 .expect(Selector('[data-test--code]').getStyleProperty('font-size')).eql('16px');
66 });
67
68 test('Add the correct font size in all browsers.', async t => {
69 await t
70 .expect(Selector('[data-test--small]').getStyleProperty('font-size')).eql('12.800000190734863px');
71 });
72
73 test('Prevent `sub` and `sup` elements from affecting the line height in all browsers.', async t => {
74 await t
75 .expect(Selector('[data-test--subsup]').getStyleProperty('font-size')).eql('12px')
76 .expect(Selector('[data-test--subsup]').getStyleProperty('line-height')).eql('0px')
77 .expect(Selector('[data-test--subsup]').getStyleProperty('position')).eql('relative')
78 .expect(Selector('[data-test--subsup]').getStyleProperty('vertical-align')).eql('baseline')
79 .expect(Selector('sub[data-test--subsup]').getStyleProperty('bottom')).eql('-3px')
80 .expect(Selector('sup[data-test--subsup]').getStyleProperty('top')).eql('-6px');
81 });
82
83 test('Change the font styles in all browsers.', async t => {
84 await t
85 .expect(Selector('[data-test--forms-1]').getStyleProperty('font-family')).eql('MYCUSTOMFONT')
86 .expect(Selector('[data-test--forms-1]').getStyleProperty('font-size')).eql('16px')
87 .expect(Selector('[data-test--forms-1]').getStyleProperty('line-height')).eql('18px');
88 });
89
90 test('Remove the margin in Firefox and Safari.', async t => {
91 await t
92 .expect(Selector('[data-test--forms-1]').getStyleProperty('margin-top')).eql('0px')
93 .expect(Selector('[data-test--forms-1]').getStyleProperty('margin-right')).eql('0px')
94 .expect(Selector('[data-test--forms-1]').getStyleProperty('margin-bottom')).eql('0px')
95 .expect(Selector('[data-test--forms-1]').getStyleProperty('margin-left')).eql('0px');
96 });
97
98 test('Text transform should not be inherited.', async t => {
99 await t
100 .expect(Selector('button[data-test--forms-1]').getStyleProperty('text-transform')).eql('none')
101 .expect(Selector('select[data-test--forms-1]').getStyleProperty('text-transform')).eql('none');
102 });
103
104 test('Correct the inability to style clickable types in iOS and Safari.', async t => {
105 await t
106 .expect(Selector('button[data-test--forms-1]').getStyleProperty('-webkit-appearance')).eql('button')
107 .expect(Selector('[type="button"][data-test--forms-1]').getStyleProperty('-webkit-appearance')).eql('button')
108 .expect(Selector('[type="reset"][data-test--forms-1]').getStyleProperty('-webkit-appearance')).eql('button')
109 .expect(Selector('[type="submit"][data-test--forms-1]').getStyleProperty('-webkit-appearance')).eql('button');
110 });
111
112 test('Correct the padding in Firefox.', async t => {
113 await t
114 .expect(Selector('fieldset[data-test--forms-2]').getStyleProperty('padding-top')).eql('5.599999904632568px')
115 .expect(Selector('fieldset[data-test--forms-2]').getStyleProperty('padding-right')).eql('12px')
116 .expect(Selector('fieldset[data-test--forms-2]').getStyleProperty('padding-bottom')).eql('10px')
117 .expect(Selector('fieldset[data-test--forms-2]').getStyleProperty('padding-left')).eql('12px');
118 });
119
120 test('Remove the padding so developers are not caught out when they zero out `fieldset` elements in all browsers.', async t => {
121 await t
122 .expect(Selector('legend[data-test--forms-2]').getStyleProperty('padding-top')).eql('0px')
123 .expect(Selector('legend[data-test--forms-2]').getStyleProperty('padding-right')).eql('0px')
124 .expect(Selector('legend[data-test--forms-2]').getStyleProperty('padding-bottom')).eql('0px')
125 .expect(Selector('legend[data-test--forms-2]').getStyleProperty('padding-left')).eql('0px');
126 });
127
128 test('Add the correct vertical alignment in Chrome and Firefox.', async t => {
129 await t
130 .expect(Selector('progress[data-test--forms-2]').getStyleProperty('vertical-align')).eql('baseline');
131 });
132
133 test('Correct the cursor style of increment and decrement buttons in Safari.', async t => {
134 // TODO: Pseudo-elements selector not supported by testcafe (See https://github.com/DevExpress/testcafe/issues/2813).
135 });
136
137 test('Correct the odd appearance in Chrome and Safari.', async t => {
138 await t
139 .expect(Selector('[type="search"][data-test--forms-1]').getStyleProperty('-webkit-appearance')).eql('textfield');
140 });
141
142 test('Correct the outline style in Safari.', async t => {
143 await t
144 .expect(Selector('[type="search"][data-test--forms-1]').getStyleProperty('outline-offset')).eql('0px');
145 });
146
147 test('Remove the inner padding in Chrome and Safari on macOS.', async t => {
148 // TODO: Pseudo-elements selector not supported by testcafe (See https://github.com/DevExpress/testcafe/issues/2813).
149 });
150
151 test('Correct the inability to style clickable types in iOS and Safari.', async t => {
152 // TODO: Pseudo-elements selector not supported by testcafe (See https://github.com/DevExpress/testcafe/issues/2813).
153 });
154
155 test('Change font properties to `inherit` in Safari.', async t => {
156 // TODO: Pseudo-elements selector not supported by testcafe (See https://github.com/DevExpress/testcafe/issues/2813).
157 });
158
159 test('Add the correct display in Chrome and Safari.', async t => {
160 await t
161 .expect(Selector('summary[data-test--interactive]').getStyleProperty('display')).eql('list-item');
162 });