OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 | 2 |
3 <meta name="transition-elements" content="#transitionElement,#boxTransitionEleme
nt;*"> | 3 <meta name="transition-elements" content="#transitionElement,#boxTransitionEleme
nt;*"> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 description('Tests for the HTML markup serializer used for transition elements')
; | 7 description('Tests for the HTML markup serializer used for transition elements')
; |
8 jsTestIsAsync = true; | 8 jsTestIsAsync = true; |
9 | 9 |
10 window.onload = function() { | 10 window.onload = function() { |
11 if (window.internals) { | 11 if (window.internals) { |
12 var serializedHTML = internals.serializeNavigationMarkup(); | 12 var serializedHTML = internals.serializeNavigationMarkup(); |
13 var testiframe = document.getElementById('testiframe'); | 13 var testiframe = document.getElementById('testiframe'); |
14 testiframe.contentDocument.write(serializedHTML); | 14 testiframe.contentDocument.write(serializedHTML); |
15 | 15 |
16 transitionElement = document.getElementById('transitionElement'); | 16 transitionElement = document.getElementById('transitionElement'); |
17 sourceElement = document.getElementById('boxTransitionElement'); | 17 sourceElement = document.getElementById('boxTransitionElement'); |
18 destElement = testiframe.contentDocument.getElementById('boxTransitionEl
ement'); | 18 destElement = testiframe.contentDocument.getElementById('boxTransitionEl
ement'); |
19 | 19 |
20 sourceElementRect = sourceElement.getBoundingClientRect(); | 20 sourceElementRect = sourceElement.getBoundingClientRect(); |
21 | 21 |
22 bottomElement = document.getElementById('bottomElement'); | 22 bottomElement = document.getElementById('bottomElement'); |
23 | 23 |
24 preHidingBottomElementRect = bottomElement.getBoundingClientRect(); | 24 preHidingBottomElementRect = bottomElement.getBoundingClientRect(); |
25 preHidingTransitionElementOpacity = window.getComputedStyle(transitionEl
ement).opacity; | 25 preHidingTransitionElementOpacity = window.getComputedStyle(transitionEl
ement).opacity; |
26 | 26 |
27 internals.hideAllTransitionElements(); | 27 internals.hideAllTransitionElements(); |
28 | |
29 postHidingTransitionElementOpacity = window.getComputedStyle(transitionE
lement).opacity; | 28 postHidingTransitionElementOpacity = window.getComputedStyle(transitionE
lement).opacity; |
30 postHidingBottomElementRect = bottomElement.getBoundingClientRect(); | 29 postHidingBottomElementRect = bottomElement.getBoundingClientRect(); |
31 | 30 |
32 shouldBe('sourceElementRect.top', 'destElement.offsetTop'); | 31 shouldBe('sourceElementRect.top', 'destElement.offsetTop'); |
33 shouldBe('sourceElementRect.left', 'destElement.offsetLeft'); | 32 shouldBe('sourceElementRect.left', 'destElement.offsetLeft'); |
34 shouldBe('sourceElementRect.height', 'destElement.offsetHeight'); | 33 shouldBe('sourceElementRect.height', 'destElement.offsetHeight'); |
35 shouldBe('sourceElementRect.width', 'destElement.offsetWidth'); | 34 shouldBe('sourceElementRect.width', 'destElement.offsetWidth'); |
36 | 35 |
37 shouldBeTrue('preHidingTransitionElementOpacity == 1'); | 36 shouldBeTrue('preHidingTransitionElementOpacity == 1'); |
38 shouldBeTrue('postHidingTransitionElementOpacity == 0'); | 37 shouldBeTrue('postHidingTransitionElementOpacity == 0'); |
39 | 38 |
40 // Hiding transition elements should not shift any other elements on the
page. | 39 // Hiding transition elements should not shift any other elements on the
page. |
41 shouldBe('preHidingBottomElementRect.top', 'postHidingBottomElementRect.
top'); | 40 shouldBe('preHidingBottomElementRect.top', 'postHidingBottomElementRect.
top'); |
42 shouldBe('preHidingBottomElementRect.left', 'postHidingBottomElementRect
.left'); | 41 shouldBe('preHidingBottomElementRect.left', 'postHidingBottomElementRect
.left'); |
43 | 42 |
| 43 internals.showAllTransitionElements(); |
| 44 postShowingTransitionElementOpacity = window.getComputedStyle(transition
Element).opacity; |
| 45 shouldBeTrue('postShowingTransitionElementOpacity == 1'); |
| 46 |
44 finishJSTest(); | 47 finishJSTest(); |
45 } | 48 } |
46 } | 49 } |
47 </script> | 50 </script> |
48 | 51 |
49 <style> | 52 <style> |
50 | 53 |
51 body { | 54 body { |
52 background: white; | 55 background: white; |
53 margin-height: 0px; | 56 margin-height: 0px; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 <div id="transitionElement">Header</div> | 95 <div id="transitionElement">Header</div> |
93 | 96 |
94 <div id="boxTransitionElement"> | 97 <div id="boxTransitionElement"> |
95 <img id="blueBox" src="resources/images/blue.png"> | 98 <img id="blueBox" src="resources/images/blue.png"> |
96 </div> | 99 </div> |
97 | 100 |
98 <div id="bottomElement">Footer</div> | 101 <div id="bottomElement">Footer</div> |
99 </div> | 102 </div> |
100 | 103 |
101 <iframe id="testiframe"></iframe> | 104 <iframe id="testiframe"></iframe> |
OLD | NEW |