summaryrefslogtreecommitdiff
path: root/test/data/html/popup-tests.html
blob: ef2d36e6eaa35d08777bc84f468211dff8676703 (plain)
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Popup Tests</title>
    <link rel="icon" type="image/gif" href="data:image/gif;base64,R0lGODdhAQABAIABAAAAAP///ywAAAAAAQABAAACAkQBADs=">
    <link rel="stylesheet" href="test-stylesheet.css">
    <script src="js/html-test-utilities.js"></script>
    <script src="js/popup-tests.js"></script>
    <style id="container-styles">
.container {
    width: 100%;
    height: 200px;
    border: 1px solid #d8d8d8;
    position: relative;
    box-sizing: border-box;
}

.container-inner {
    background-color: #f8f8f8;
    padding: 0.5em;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
}

.danger {
    color: #c83c28;
}
    </style>
</head>
<body>
    <h1>Popup Tests</h1>

    <test-description>
        Tests involving popup functionality in different contextsts, such as fullscreen elements, &lt;iframe&gt; elements, and shadow DOMs.
    </test-description>

    <test-case>
        <test-description>Standard content.</test-description>
        <div class="fullscreen-element container hovertarget">
            <div class="container-inner">
                <div>
                    ありがとう
                </div>
                <div>
                    <a href="#" class="fullscreen-link">Toggle fullscreen</a>
                </div>
            </div>
        </div>
    </test-case>

    <test-case data-shadow-mode="open">
        <test-description>Content inside of an open shadow DOM.</test-description>
        <div class="template-content-container hovertarget"></div>
        <template>
            <link rel="stylesheet" href="test-stylesheet.css">
            <div class="fullscreen-element container">
                <div class="container-inner">
                    <div>
                        ありがとう
                    </div>
                    <div>
                        <a href="#" class="fullscreen-link">Toggle fullscreen</a>
                    </div>
                </div>
            </div>
        </template>
    </test-case>

    <test-case data-shadow-mode="closed">
        <test-description>Content inside of a closed shadow DOM.</test-description>
        <div class="template-content-container hovertarget"></div>
        <template>
            <link rel="stylesheet" href="test-stylesheet.css">
            <div class="fullscreen-element container">
                <div class="container-inner">
                    <div>
                        ありがとう
                    </div>
                    <div>
                        <a href="#" class="fullscreen-link">Toggle fullscreen</a>
                    </div>
                </div>
            </div>
        </template>
    </test-case>

    <test-case>
        <test-description>&lt;iframe&gt; element.</test-description>
        <iframe src="popup-tests-frame1.html" allowfullscreen="true" class="container hovertarget"></iframe>
    </test-case>

    <test-case data-shadow-mode="open">
        <test-description>&lt;iframe&gt; element inside of an open shadow DOM.</test-description>
        <div class="template-content-container hovertarget"></div>
        <template>
            <iframe src="popup-tests-frame1.html" allowfullscreen="true" class="container"></iframe>
        </template>
    </test-case>

    <test-case data-shadow-mode="closed">
        <test-description>&lt;iframe&gt; element inside of a closed shadow DOM.</test-description>
        <div class="template-content-container hovertarget"></div>
        <template>
            <iframe src="popup-tests-frame1.html" allowfullscreen="true" class="container"></iframe>
        </template>
    </test-case>

    <test-case>
        <test-description>&lt;iframe&gt; element with data URL.</test-description>
        <iframe id="iframe-with-data-url"
            src="data:text/html;base64,PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCiAgICA8aGVhZD4NCiAgICAgICAgPG1ldGEgY2hhcnNldD0iVVRGLTgiPg0KICAgICAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLGluaXRpYWwtc2NhbGU9MSI+DQogICAgICAgIDx0aXRsZT5Zb21pY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ZvbnQtc2l6ZTogMTRweDsNCiAgICBwYWRkaW5nOiAwOw0KICAgIG1hcmdpbjogMDsNCiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZjhmOGY4Ow0KfQ0KYSwgYTp2aXNpdGVkIHsNCiAgICBjb2xvcjogIzEwODBjMDsNCiAgICB0ZXh0LWRlY29yYXRpb246IHVuZGVybGluZTsNCn0NCi5jb250ZW50IHsNCiAgICBwb3NpdGlvbjogYWJzb2x1dGU7DQogICAgbGVmdDogMDsNCiAgICB0b3A6IDA7DQogICAgcmlnaHQ6IDA7DQogICAgYm90dG9tOiAwOw0KICAgIHBhZGRpbmc6IDAuNWVtOw0KICAgIGJhY2tncm91bmQtY29sb3I6ICNmOGY4Zjg7DQp9DQogICAgICAgIDwvc3R5bGU+DQogICAgPC9oZWFkPg0KPGJvZHk+PGRpdiBjbGFzcz0iY29udGVudCI+DQo8ZGl2Pg0KICAgIOOBguOCiuOBjOOBqOOBhg0KPC9kaXY+DQo8ZGl2Pg0KICAgIDxhIGhyZWY9IiMiIGNsYXNzPSJmdWxsc2NyZWVuLWxpbmsiPlRvZ2dsZSBmdWxsc2NyZWVuPC9hPg0KICAgIDxzY3JpcHQ+c2V0dXAoZG9jdW1lbnQuYm9keSwgZG9jdW1lbnQuYm9keSk7PC9zY3JpcHQ+DQo8L2Rpdj4NCjwvZGl2PjwvYm9keT4NCjwvaHRtbD4="
            allowfullscreen="true" class="container hovertarget"></iframe>
    </test-case>

    <test-case>
        <test-description>&lt;iframe&gt; element with blob URL.</test-description>
        <iframe id="iframe-with-blob-url" allowfullscreen="true" class="container hovertarget"></iframe>
    </test-case>

    <test-case>
        <test-description>&lt;iframe&gt; element with srcdoc.</test-description>
        <iframe allowfullscreen="true" class="iframe-with-srcdoc container hovertarget"></iframe>
    </test-case>

    <test-case>
        <test-description>&lt;iframe&gt; element with srcdoc and
            <code>sandbox="allow-same-origin allow-scripts"</code>.</test-description>
        <iframe allowfullscreen="true" class="iframe-with-srcdoc container hovertarget"
            sandbox="allow-same-origin allow-scripts"></iframe>
    </test-case>

    <test-case>
        <test-description>
            &lt;iframe&gt; element with srcdoc and <code>sandbox="allow-scripts"</code>.<br>
            <span class="danger">This element is expected to not work.</span>
        </test-description>
        <iframe allowfullscreen="true" class="iframe-with-srcdoc container hovertarget"
            sandbox="allow-scripts"></iframe>
    </test-case>

    <test-case>
        <test-description>SVG &lt;img&gt;.</test-description>
        <img src="popup-tests-frame2.svg" class="container hovertarget" alt="">
    </test-case>

    <test-case>
        <test-description>SVG &lt;object&gt;.</test-description>
        <object data="popup-tests-frame2.svg" type="image/svg+xml" class="container hovertarget"></object>
    </test-case>

    <test-case>
        <test-description>SVG &lt;embed&gt;.</test-description>
        <embed type="image/svg+xml" src="popup-tests-frame2.svg" class="container hovertarget">
    </test-case>

    <test-case>
        <test-description>SVG &lt;iframe&gt;.</test-description>
        <iframe src="popup-tests-frame2.svg" allowfullscreen="true" class="container hovertarget"></iframe>
    </test-case>

    <test-case>
        <test-description>SVG &lt;svg&gt;.</test-description>
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="container hovertarget"
            style="background-color: #f8f8f8;" focusable="false">
            <text x="7" y="12" style="
                font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
                font-size: 14px;
                fill: #000000;
                dominant-baseline: hanging;">
                ありがとう
            </text>
        </svg>
    </test-case>
</body>
</html>