| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | |
| 3 Use of this source code is governed by a BSD-style license that can be | |
| 4 found in the LICENSE file. | |
| 5 --> | |
| 6 | |
| 7 <link rel="import" href="../ct-embedded-flakiness-dashboard.html"> | |
| 8 | |
| 9 <script> | |
| 10 (function () { | |
| 11 | |
| 12 var assert = chai.assert; | |
| 13 | |
| 14 describe('ct-embedded-flakiness-dashboard', function() { | |
| 15 | |
| 16 describe('iframe location', function() { | |
| 17 var embeddedFlakinessDashboard; | |
| 18 | |
| 19 after(function() { | |
| 20 document.body.removeChild(embeddedFlakinessDashboard); | |
| 21 }); | |
| 22 | |
| 23 it('should point the iframe to the dashboard', function(done) { | |
| 24 var failure = new CTStepFailure('foo_tests', 'foo/bar.html'); | |
| 25 failure.embeddedFlakinessDashboardURL = function() { | |
| 26 return 'placeholder.html?' + this.flakinessDashboardURL() + '&showChrome
=false'; | |
| 27 } | |
| 28 | |
| 29 embeddedFlakinessDashboard = document.createElement('ct-embedded-flakiness
-dashboard'); | |
| 30 embeddedFlakinessDashboard.hidden = true; | |
| 31 embeddedFlakinessDashboard.test = failure; | |
| 32 document.body.appendChild(embeddedFlakinessDashboard); | |
| 33 | |
| 34 var iframe = embeddedFlakinessDashboard.shadowRoot.querySelector('#iframe'
); | |
| 35 iframe.addEventListener('load', function() { | |
| 36 assert.include(iframe.contentWindow.location.href, | |
| 37 failure.embeddedFlakinessDashboardURL()); | |
| 38 done(); | |
| 39 }); | |
| 40 }); | |
| 41 }); | |
| 42 | |
| 43 it('should respond to heightChanged', function(done) { | |
| 44 var embeddedFlakinessDashboard = document.createElement('ct-embedded-flakine
ss-dashboard'); | |
| 45 | |
| 46 var finishTest = function() { | |
| 47 window.removeEventListener('message', finishTest); | |
| 48 var iframe = embeddedFlakinessDashboard.shadowRoot.querySelector('#iframe'
); | |
| 49 assert.equal(iframe.style.height, '100px'); | |
| 50 done(); | |
| 51 }; | |
| 52 | |
| 53 window.addEventListener('message', finishTest); | |
| 54 window.postMessage({command: 'heightChanged', height: "100"}, '*'); | |
| 55 }); | |
| 56 }); | |
| 57 | |
| 58 })() | |
| 59 </script> | |
| OLD | NEW |