-
-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathComputedCSSStyleDeclarationTest.java
More file actions
2663 lines (2486 loc) · 96.2 KB
/
ComputedCSSStyleDeclarationTest.java
File metadata and controls
2663 lines (2486 loc) · 96.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2002-2021 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gargoylesoftware.htmlunit.javascript.host.css;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.CHROME;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.EDGE;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF78;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE;
import java.io.InputStream;
import java.net.URL;
import java.util.Collections;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import com.gargoylesoftware.htmlunit.BrowserRunner;
import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts;
import com.gargoylesoftware.htmlunit.BrowserRunner.HtmlUnitNYI;
import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented;
import com.gargoylesoftware.htmlunit.util.NameValuePair;
import com.gargoylesoftware.htmlunit.WebDriverTestCase;
/**
* Tests for {@link ComputedCSSStyleDeclaration}.
*
* @author Ahmed Ashour
* @author Marc Guillemot
* @author Ronald Brill
* @author Frank Danek
* @author Dennis Duysak
*/
@RunWith(BrowserRunner.class)
public class ComputedCSSStyleDeclarationTest extends WebDriverTestCase {
/**
* @throws Exception if the test fails
*/
@Test
@Alerts("none")
public void cssFloat() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ " function test() {\n"
+ " var e = document.getElementById('myDiv');\n"
+ " var s = window.getComputedStyle(e, null);\n"
+ " log(s.cssFloat);\n"
+ " }\n"
+ "</script>\n"
+ "</head>\n"
+ "<body onload='test()'>\n"
+ " <div id='myDiv'></div>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* Compares all {@code style} and {@code getComputedStyle}.
*
* @throws Exception if the test fails
*/
@Test
public void stringProperties() throws Exception {
final String html
= "<html><head><body>\n"
+ " <div id='myDiv'><br>\n"
+ " <textarea id='myTextarea' cols='120' rows='20'></textarea>\n"
+ " </div>\n"
+ "<script>\n"
+ "var e = document.getElementById('myDiv');\n"
+ "var array = [];\n"
+ "try {\n"
+ " for (var i in e.style) {\n"
+ " var s1 = e.style[i];\n"
+ " var s2 = window.getComputedStyle(e, null)[i];\n"
+ " if ('height' == i || 'width' == i || 'cssText' == i) {\n"
+ " s2 = 'skipped';\n"
+ " }\n"
+ " if(typeof s1 == 'string')\n"
+ " array.push(i + '=' + s1 + ':' + s2);\n"
+ " }\n"
+ "} catch (e) { array[array.length] = 'exception'; }\n"
+ "array.sort();\n"
+ "document.getElementById('myTextarea').value = array.join('\\n');\n"
+ "</script></body></html>";
final WebDriver driver = loadPage2(html);
final String expected = loadExpectation("ComputedCSSStyleDeclarationTest.properties", ".txt");
final String actual = driver.findElement(By.id("myTextarea")).getAttribute("value");
assertEquals(expected, actual);
}
/**
* Compares all {@code style} and {@code getComputedStyle}, for not-attached elements.
*
* @throws Exception if the test fails
*/
@Test
@NotYetImplemented
public void stringPropertiesNotAttached() throws Exception {
// to fix Chrome, look into ComputedCSSStyleDeclaration.defaultIfEmpty first condition
final String html
= "<html><head><body>\n"
+ " <textarea id='myTextarea' cols='120' rows='20'></textarea>\n"
+ " </div>\n"
+ "<script>\n"
+ "var e = document.createElement('div');\n"
+ "var array = [];\n"
+ "try {\n"
+ " for (var i in e.style) {\n"
+ " var s1 = e.style[i];\n"
+ " var s2 = window.getComputedStyle(e, null)[i];\n"
+ " if ('height' == i || 'width' == i || 'cssText' == i) {\n"
+ " s2 = 'skipped';\n"
+ " }\n"
+ " if(typeof s1 == 'string')\n"
+ " array.push(i + '=' + s1 + ':' + s2);\n"
+ " }\n"
+ "} catch (e) { array[array.length] = 'exception'; }\n"
+ "array.sort();\n"
+ "document.getElementById('myTextarea').value = array.join('\\n');\n"
+ "</script></body></html>";
final WebDriver driver = loadPage2(html);
final String expected = loadExpectation("ComputedCSSStyleDeclarationTest.properties.notAttached", ".txt");
final String actual = driver.findElement(By.id("myTextarea")).getAttribute("value");
assertEquals(expected, actual);
}
/**
* @throws Exception if the test fails
*/
@Test
@Alerts({"", "", "auto", "pointer"})
public void styleElement() throws Exception {
final String html = "<html><head>\n"
+ "<style type='text/css'>\n"
+ " /* <![CDATA[ */\n"
+ " #myDiv2 {cursor: pointer}\n"
+ " /* ]]> */\n"
+ "</style>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ " function test() {\n"
+ " var div1 = document.getElementById('myDiv1');\n"
+ " var div2 = document.getElementById('myDiv2');\n"
+ " log(div1.style.cursor);\n"
+ " log(div2.style.cursor);\n"
+ " log(window.getComputedStyle(div1, null).cursor);\n"
+ " log(window.getComputedStyle(div2, null).cursor);\n"
+ " }\n"
+ "</script></head><body onload='test()'>\n"
+ " <div id='myDiv1'/>\n"
+ " <div id='myDiv2'/>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* Some style tests. There are two points in this case:
* <ol>
* <li>http://sourceforge.net/p/cssparser/bugs/17/</li>
* <li>the "pointer" value gets inherited by "myDiv2", which is parsed as a child of "style_test_1"</li>
* </ol>
* @throws Exception if the test fails
*/
@Test
@Alerts({"", "", "pointer", "pointer"})
public void styleElement2() throws Exception {
final String html = "<html><head>\n"
+ "<style type='text/css'>\n"
+ " /* <![CDATA[ */\n"
+ " #style_test_1 {cursor: pointer}\n"
+ " /* ]]> */\n"
+ "</style>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ " function test() {\n"
+ " var div1 = document.getElementById('style_test_1');\n"
+ " var div2 = document.getElementById('myDiv2');\n"
+ " log(div1.style.cursor);\n"
+ " log(div2.style.cursor);\n"
+ " log(window.getComputedStyle(div1, null).cursor);\n"
+ " log(window.getComputedStyle(div2, null).cursor);\n"
+ " }\n"
+ "</script></head><body onload='test()'>\n"
+ " <div id='style_test_1'/>\n"
+ " <div id='myDiv2'/>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if the test fails
*/
@Test
@Alerts({"auto", "string"})
public void zIndex() throws Exception {
final String html = "<html>\n"
+ "<head>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ " function test() {\n"
+ " var d = document.getElementById('myDiv');\n"
+ " var style = window.getComputedStyle(d, null);\n"
+ " log(style.zIndex);\n"
+ " log(typeof style.zIndex);\n"
+ " }\n"
+ "</script>\n"
+ "</head>\n"
+ "<body onload='test()'>\n"
+ " <div id='myDiv'></div>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts("50px")
public void styleAttributePreferredOverStylesheet() throws Exception {
final String html = "<html>\n"
+ "<head><style>div { width: 30px; }</style></head>\n"
+ "<body>\n"
+ "<div id='d' style='width:50px'>foo</div>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ "var d = document.getElementById('d');\n"
+ "var style = window.getComputedStyle(d, null);\n"
+ "log(style.width);\n"
+ "</script>\n"
+ "</body>\n"
+ "</html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"1em 16px", "1em 16px", "1em 16px", "1em 16px", "1em 16px", "1em 16px", "1em 16px", "1em 16px",
"1em 16px", "1em 16px", "1em 16px", "1em 16px", "1em 16px", "1em 16px"})
public void lengthsConvertedToPixels() throws Exception {
final String html = "<html><body>\n"
+ "<div id='d' style='width:1em; height:1em; border:1em solid black; padding:1em; margin:1em;'>d</div>\n"
+ "<script>\n"
+ LOG_TITLE_FUNCTION
+ "var d = document.getElementById('d');\n"
+ "var cs = window.getComputedStyle(d, null);\n"
+ "log(d.style.width + ' ' + cs.width);\n"
+ "log(d.style.height + ' ' + cs.height);\n"
+ "log(d.style.borderBottomWidth + ' ' + cs.borderBottomWidth);\n"
+ "log(d.style.borderLeftWidth + ' ' + cs.borderLeftWidth);\n"
+ "log(d.style.borderTopWidth + ' ' + cs.borderTopWidth);\n"
+ "log(d.style.borderRightWidth + ' ' + cs.borderRightWidth);\n"
+ "log(d.style.paddingBottom + ' ' + cs.paddingBottom);\n"
+ "log(d.style.paddingLeft + ' ' + cs.paddingLeft);\n"
+ "log(d.style.paddingTop + ' ' + cs.paddingTop);\n"
+ "log(d.style.paddingRight + ' ' + cs.paddingRight);\n"
+ "log(d.style.marginBottom + ' ' + cs.marginBottom);\n"
+ "log(d.style.marginLeft + ' ' + cs.marginLeft);\n"
+ "log(d.style.marginTop + ' ' + cs.marginTop);\n"
+ "log(d.style.marginRight + ' ' + cs.marginRight);\n"
+ "</script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"inline", "inline", "inline", "block", /* "inline-block", */ "inline", "block", "block", "none"},
FF = {"inline", "inline", "inline", "block", /* "inline-block", */ "none", "block", "block", "none"},
FF78 = {"inline", "inline", "inline", "block", /* "inline-block", */ "none", "block", "block", "none"})
public void defaultDisplayValues_A() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p id='p'>\n"
+ " <a id='a'></a>\n"
+ " <abbr id='abbr'></abbr>\n"
+ " <acronym id='acronym'></acronym>\n"
+ " <address id='address'></address>\n"
+ " <article id='article'></article>\n"
+ " <aside id='aside'></aside>\n"
+ " <audio id='audio'></audio>\n"
+ " </p>\n"
// + " <applet id='applet'></applet>\n"
+ " <img usemap='#imgmap'>\n"
+ " <map name='imgmap'>\n"
+ " <area id='area'>\n"
+ " </map>\n"
+ " </img>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('a');\n"
+ " x('abbr');\n"
+ " x('acronym');\n"
+ " x('address');\n"
// + " x('applet');\n"
+ " x('area');\n"
+ " x('article');\n"
+ " x('aside');\n"
+ " x('audio');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"inline", "inline", "inline", "inline", "block", "inline", "inline-block"})
public void defaultDisplayValues_B() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p id='p'>\n"
+ " <b id='b'></b>\n"
+ " <bdi id='bdi'></bdi>\n"
+ " <bdo id='bdo'></bdo>\n"
+ " <big id='big'></big>\n"
+ " <blockquote id='blockquote'></blockquote>\n"
+ " <br id='br'>\n"
+ " <button id='button' type='button'></button>\n"
+ " </p>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('b');\n"
+ " x('bdi');\n"
+ " x('bdo');\n"
+ " x('big');\n"
+ " x('blockquote');\n"
+ " x('br');\n"
+ " x('button');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"inline", "table-caption", "block", "inline", "inline", "table-column", "table-column-group", "inline"})
public void defaultDisplayValues_C() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <canvas id='canvas'></canvas>\n"
+ " <center id='center'></center>\n"
+ " <code id='code'></code>\n"
+ " <table>\n"
+ " <caption id='caption'></caption>\n"
+ " <colgroup id='colgroup'>\n"
+ " <col id='col'>\n"
+ " </colgroup>\n"
+ " </table>\n"
+ " <p id='p'>\n"
+ " <cite id='cite'></cite>\n"
+ " </p>\n"
+ " <menu>\n"
+ " <command id='command'></command>\n"
+ " </menu>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('canvas');\n"
+ " x('caption');\n"
+ " x('center');\n"
+ " x('cite');\n"
+ " x('code');\n"
+ " x('col');\n"
+ " x('colgroup');\n"
+ " x('command');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"none", "block", "inline", "block", "inline", "none", "block", "block", "block", "block"},
IE = {"none", "block", "inline", "inline", "inline", "inline", "block", "block", "block", "block"})
public void defaultDisplayValues_D() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <datalist id='datalist'></datalist>\n"
+ " <dl id='dl'>\n"
+ " <dt id='dt'></dt>\n"
+ " <dd id='dd'><dd>\n"
+ " </dl>\n"
+ " <p id='p'>\n"
+ " <del id='del'></del>\n"
+ " </p>\n"
+ " <details id='details'></details>\n"
+ " <dfn id='dfn'></dfn>\n"
+ " <dialog id='dialog'></dialog>\n"
+ " <dir id='dir'></dir>\n"
+ " <dir id='div'></div>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('datalist');\n"
+ " x('dd');\n"
+ " x('del');\n"
+ " x('details');\n"
+ " x('dfn');\n"
+ " x('dialog');\n"
+ " x('dir');\n"
+ " x('div');\n"
+ " x('dl');\n"
+ " x('dt');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"inline", "inline"})
public void defaultDisplayValues_E() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p id='p'>\n"
+ " <em id='em'></em>\n"
+ " </p>\n"
+ " <embed id='embed'>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('em');\n"
+ " x('embed');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"block", "block", "block", "inline", "block", "block"})
public void defaultDisplayValues_F() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <form id='form'>\n"
+ " <fieldset id='fieldset'></fieldset>\n"
+ " </form>\n"
+ " <figure id='figure'>\n"
+ " <figcaption id='figcaption'></figcaption>\n"
+ " </figure>\n"
+ " <p id='p'>\n"
+ " <font id='font'></font>\n"
+ " </p>\n"
+ " <footer id='footer'></footer>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('fieldset');\n"
+ " x('figcaption');\n"
+ " x('figure');\n"
+ " x('font');\n"
+ " x('footer');\n"
+ " x('form');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"block", "block", "block", "block", "block", "block", "block", "block"})
public void defaultDisplayValues_H() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <h1 id='h1'></h1>\n"
+ " <h2 id='h2'></h2>\n"
+ " <h3 id='h3'></h3>\n"
+ " <h4 id='h4'></h4>\n"
+ " <h5 id='h5'></h5>\n"
+ " <h6 id='h6'></h6>\n"
+ " <header id='header'></header>\n"
+ " <hr id='hr'>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('h1');\n"
+ " x('h2');\n"
+ " x('h3');\n"
+ " x('h4');\n"
+ " x('h5');\n"
+ " x('h6');\n"
+ " x('header');\n"
+ " x('hr');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"inline", "inline", "inline", "inline-block", "inline-block",
"inline-block", "inline-block", "inline-block", "inline-block", "inline"})
public void defaultDisplayValues_I() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p id='p'>\n"
+ " <i id='i'></i>\n"
+ " <ins id='ins'></ins>\n"
+ " </p>\n"
+ " <iframe id='iframe'></iframe>\n"
+ " <img id='img'></img>\n"
+ " <form id='form'>\n"
+ " <input id='submit' type='submit'>\n"
+ " <input id='reset' type='reset'>\n"
+ " <input id='text' type='text'>\n"
+ " <input id='password' type='password'>\n"
+ " <input id='checkbox' type='checkbox'>\n"
+ " <input id='radio' type='radio'>\n"
+ " </form>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('i');\n"
+ " x('iframe');\n"
+ " x('img');\n"
+ " x('submit');\n"
+ " x('reset');\n"
+ " x('text');\n"
+ " x('password');\n"
+ " x('checkbox');\n"
+ " x('radio');\n"
+ " x('ins');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = { "inline", "inline", "inline", "block", "list-item" },
IE = {"inline", "inline", "inline", "inline", "list-item"})
public void defaultDisplayValues_KL() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p id='p'>\n"
+ " <kbd id='kbd'></kbd>\n"
+ " </p>\n"
+ " <ol>\n"
+ " <li id='li'></li>\n"
+ " </ol>\n"
+ " <form id='form'>\n"
+ " <keygen id='keygen'>\n"
+ " <label id='label'>\n"
+ " <fieldset id='fieldset'>\n"
+ " <legend id='legend'></legend>\n"
+ " </fieldset>\n"
+ " </form>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('kbd');\n"
+ " x('keygen');\n"
+ " x('label');\n"
+ " x('legend');\n"
+ " x('li');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"inline", "inline", "block", "inline-block"},
IE = {"inline", "inline", "block", "inline"})
public void defaultDisplayValues_M() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <img usemap='#imgmap'>\n"
+ " <map id='map' name='imgmap'>\n"
+ " <area id='area'>\n"
+ " </map>\n"
+ " </img>\n"
+ " <p id='p'>\n"
+ " <mark id='mark'></mark>\n"
+ " </p>\n"
+ " <menu id='menu'>\n"
+ " <li id='li'></li>\n"
+ " </menu>\n"
+ " <meter id='meter'></meter>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('map');\n"
+ " x('mark');\n"
+ " x('menu');\n"
+ " x('meter');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"block", "none", "inline", "block", "block", "block", "inline"},
CHROME = {"block", "inline", "inline", "block", "block", "block", "inline"},
EDGE = {"block", "inline", "inline", "block", "block", "block", "inline"},
IE = {"block", "none", "inline", "block", "inline", "inline", "inline"})
public void defaultDisplayValues_NO() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <nav id='nav'>\n"
+ " <a id='a'></a>\n"
+ " </nav>\n"
+ " <noscript id='noscript'></noscript> \n"
+ " <object id='object'></object> "
+ " <ol id='ol'>\n"
+ " <li></li>\n"
+ " </ol>\n"
+ " <form>\n"
+ " <select>\n"
+ " <optgroup id='optgroup'>\n"
+ " <option></option>\n"
+ " </optgroup>\n"
+ " <option id='option'></option>\n"
+ " </select>\n"
+ " <output id='output'></output>\n"
+ " </form>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('nav');\n"
+ " x('noscript');\n"
+ " x('object');\n"
+ " x('ol');\n"
+ " x('optgroup');\n"
+ " x('option');\n"
+ " x('output');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"block", "none", "block", "inline-block", "inline"},
IE = {"block", "inline", "block", "inline", "inline"})
public void defaultDisplayValues_PQ() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p id='p'><q id='q'></q></p>\n"
+ " <object>\n"
+ " <param id='param' name='movie' value=''></param>\n"
+ " </object> "
+ " <pre id='pre'></pre>\n"
+ " <progress id='progress'></progress>\n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('p');\n"
+ " x('param');\n"
+ " x('pre');\n"
+ " x('progress');\n"
+ " x('q');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"inline", "block", "none"},
FF = {"ruby", "ruby-text", "none"},
FF78 = {"ruby", "ruby-text", "none"},
IE = {"ruby", "ruby-text", "inline"})
public void defaultDisplayValues_R() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <ruby id='ruby'>\n"
+ " <rt id='rt'>\n"
+ " <rp id='rp'></rp>\n"
+ " </rt>\n"
+ " </ruby> \n"
+ " <script>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('ruby');\n"
+ " x('rt');\n"
+ " x('rp');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"inline", "inline", "none", "block", "inline-block", "inline",
"inline", "inline", "inline", "inline", "inline", "block", "inline"},
IE = {"inline", "inline", "none", "block", "inline-block", "inline",
"inline", "inline", "inline", "inline", "inline", "inline", "inline"})
public void defaultDisplayValues_S() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p>\n"
+ " <s id='s'></s>\n"
+ " <small id='small'></small>\n"
+ " <span id='span'></span>\n"
+ " <strike id='strike'></strike>\n"
+ " <strong id='strong'></strong>\n"
+ " <sub id='sub'></sub>\n"
+ " <sup id='sup'></sup>\n"
+ " </p> \n"
+ " <samp id='samp'></samp>\n"
+ " <section id='section'></section>\n"
+ " <summary id='summary'></summary>\n"
+ " <audio>\n"
+ " <source id='source'>\n"
+ " </audio>\n"
+ " <form>\n"
+ " <select id='select'>\n"
+ " <option></option>\n"
+ " </select>\n"
+ " </form>\n"
+ " <script id='script'>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('s');\n"
+ " x('samp');\n"
+ " x('script');\n"
+ " x('section');\n"
+ " x('select');\n"
+ " x('small');\n"
+ " x('source');\n"
+ " x('span');\n"
+ " x('strike');\n"
+ " x('strong');\n"
+ " x('sub');\n"
+ " x('summary');\n"
+ " x('sup');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts(DEFAULT = {"table", "table-row-group", "table-cell", "inline-block", "table-footer-group",
"table-cell", "table-header-group", "inline", "table-row", "inline", "inline"},
FF = {"table", "table-row-group", "table-cell", "inline", "table-footer-group",
"table-cell", "table-header-group", "inline", "table-row", "inline", "inline"},
FF78 = {"table", "table-row-group", "table-cell", "inline", "table-footer-group",
"table-cell", "table-header-group", "inline", "table-row", "inline", "inline"})
public void defaultDisplayValues_T() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <table id='table'>\n"
+ " <thead id='thead'><tr id='tr'><th id='th'>header</th></tr></thead>\n"
+ " <tfoot id='tfoot'><tr><td>footer</td></tr></tfoot>\n"
+ " <tbody id='tbody'><tr><td id='td'>body</td></tr></tbody>\n"
+ " </table>\n"
+ " <form>\n"
+ " <textarea id='textarea'></textarea>\n"
+ " </form>\n"
+ " <p>\n"
+ " <time id='time'></time>\n"
+ " <tt id='tt'></tt>\n"
+ " </p> \n"
+ " <video>\n"
+ " <track id='track'>\n"
+ " </video>\n"
+ " <script id='script'>\n"
+ LOG_TITLE_FUNCTION
+ " function x(id) {\n"
+ " var e = document.getElementById(id);\n"
+ " var cs = window.getComputedStyle(e, null);\n"
+ " var disp = cs ? cs.display : null;\n"
+ " log(disp);\n"
+ " }\n"
+ " </script>\n"
+ " <script>\n"
+ " x('table');\n"
+ " x('tbody');\n"
+ " x('td');\n"
+ " x('textarea');\n"
+ " x('tfoot');\n"
+ " x('th');\n"
+ " x('thead');\n"
+ " x('time');\n"
+ " x('tr');\n"
+ " x('track');\n"
+ " x('tt');\n"
+ " </script>\n"
+ "</body></html>";
loadPageVerifyTitle2(html);
}
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts({"inline", "block", "inline", "inline", "inline"})
public void defaultDisplayValues_UVW() throws Exception {
final String html = "<!DOCTYPE HTML>\n<html><body>\n"
+ " <p>\n"
+ " <u id='u'></u>\n"
+ " <wbr id='wbr'></wbr>\n"
+ " </p> \n"
+ " <ul id='ul'>\n"