8 border:
1px solid blue;
18 list-style-position: inside;
27 .floating
> ul
> li, .floating
> ol
> li {
34 .block
> ul, .block
> ol {
35 display: inline-block;
40 <script src=
"../../resources/js-test.js"></script>
45 <h1>list-style-position: inside
</h1>
47 Tests that lists with header the list marker displayed
48 inside the item works as expected.
52 <section class=
"floating">
53 <h1>Floating, Unordered
</h1>
60 The list markers above should be inside the respective
64 <section class=
"floating">
65 <h1>Floating, Ordered
</h1>
72 The list markers above should be inside the respective
78 <section class=
"block">
79 <h1>Block, Unordered
</h1>
86 The list markers above should be inside the respective
87 list item boxes and the text should not wrap.
91 <section class=
"block">
92 <h1>Block, Ordered
</h1>
99 The list markers above should be inside the respective
100 list item boxes and the text should not wrap.
105 <section class=
"reference">
106 <h1>Reference, Unordered
</h1>
112 <section class=
"reference">
113 <h1>Reference, Ordered
</h1>
120 function getItems(className
, tagName
)
122 var selector
= '.' + className
+ ' > ' + tagName
;
123 var block
= document
.querySelector(selector
);
124 return block
.getElementsByTagName('li');
127 function test(className
, tagName
)
129 var referenceHeight
= getItems('reference', tagName
)[0].
130 getBoundingClientRect().height
;
131 var testItems
= getItems(className
, tagName
);
133 // Check that all items have the right height
135 for (var item
, i
= 0; item
= testItems
[i
]; i
++) {
136 var rect
= item
.getBoundingClientRect();
137 if (rect
.height
!= referenceHeight
) {
139 testFailed('Item ' + i
+ ' in ' + className
+
140 ' ' + tagName
+ ' has height of ' +
141 rect
.height
+ 'px, expecting ' +
142 referenceHeight
+ 'px.');
146 testPassed('All items in ' + className
+ ' ' +
147 tagName
+ ' has the expected height.');
149 // Change list-style-type to none and back to ensure
150 // that the width changes.
151 for (var item
, i
= 0; item
= testItems
[i
]; i
++) {
152 item
.style
.listStyleType
= 'none';
154 var width
= testItems
[0].getBoundingClientRect().width
;
155 for (var item
, i
= 0; item
= testItems
[i
]; i
++) {
156 item
.style
.listStyleType
= '';
158 if (testItems
[0].getBoundingClientRect().width
!= width
)
159 testPassed('Width of first item in ' + className
+
160 ' ' + tagName
+ ' is affected by list marker ' +
163 testFailed('Width of first item in ' + className
+
164 ' ' + tagName
+ ' is not affected by list ' +
165 'marker as expected.');
168 test('floating', 'ul');
169 test('floating', 'ol');
173 // Only include test results in test output.
174 if (window
.testRunner
) {
175 while (document
.body
.lastChild
!= document
.body
.firstChild
)
176 document
.body
.removeChild(document
.body
.lastChild
);