| 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-results-comparison.html"> | |
| 8 | |
| 9 <script> | |
| 10 (function () { | |
| 11 | |
| 12 var assert = chai.assert; | |
| 13 | |
| 14 describe('ct-results-comparison', function() { | |
| 15 describe('results comparison UI', function() { | |
| 16 var comparison; | |
| 17 var expected, actual, diff; | |
| 18 | |
| 19 before(function(done) { | |
| 20 comparison = document.createElement('ct-results-comparison'); | |
| 21 comparison.type = results.kImageType; | |
| 22 | |
| 23 expected = "https://domain.com/dummy-expected"; | |
| 24 actual = "https://domain.com/dummy-actual"; | |
| 25 diff = "https://domain.com/dummy-diff"; | |
| 26 | |
| 27 comparison.expectedUrl = expected; | |
| 28 comparison.actualUrl = actual; | |
| 29 comparison.diffUrl = diff; | |
| 30 | |
| 31 setTimeout(done); | |
| 32 }); | |
| 33 | |
| 34 it('should show expected, actual and diff', function() { | |
| 35 var outputs = comparison.shadowRoot.querySelectorAll('ct-test-output'); | |
| 36 assert.lengthOf(outputs, 3); | |
| 37 | |
| 38 // Verify we didn't typo any of the bindings. | |
| 39 assert.equal(outputs[0].type, results.kImageType); | |
| 40 assert.equal(outputs[0].url, expected); | |
| 41 assert.equal(outputs[1].type, results.kImageType); | |
| 42 assert.equal(outputs[1].url, actual); | |
| 43 assert.equal(outputs[2].type, results.kImageType); | |
| 44 assert.equal(outputs[2].url, diff); | |
| 45 | |
| 46 assert.lengthOf(comparison.shadowRoot.querySelectorAll('ct-results-compari
son-zoomer'), 0); | |
| 47 }); | |
| 48 }); | |
| 49 | |
| 50 describe('zoomer', function() { | |
| 51 // FIXME: Create a MouseEventMock class to use here. | |
| 52 var mockMouseEvent = { | |
| 53 clientX: 0, | |
| 54 clientY: 0, | |
| 55 target: document.createElement('div'), | |
| 56 }; | |
| 57 | |
| 58 var imageComparison; | |
| 59 var nonImageComparison; | |
| 60 | |
| 61 before(function(done) { | |
| 62 imageComparison = document.createElement('ct-results-comparison'); | |
| 63 imageComparison.type = results.kImageType; | |
| 64 nonImageComparison = document.createElement('ct-results-comparison'); | |
| 65 setTimeout(done); | |
| 66 }); | |
| 67 | |
| 68 before(function(done) { | |
| 69 imageComparison._handleMouseMove(mockMouseEvent); | |
| 70 nonImageComparison._handleMouseMove(mockMouseEvent); | |
| 71 setTimeout(done); | |
| 72 }); | |
| 73 | |
| 74 it('should exist on images', function(done) { | |
| 75 assert.lengthOf(imageComparison.shadowRoot.querySelectorAll('ct-results-co
mparison-zoomer'), 1); | |
| 76 assert.lengthOf(nonImageComparison.shadowRoot.querySelectorAll('ct-results
-comparison-zoomer'), 0); | |
| 77 | |
| 78 imageComparison.type = 'foo'; | |
| 79 setTimeout(done); | |
| 80 }); | |
| 81 | |
| 82 it('should not exist on other result types', function() { | |
| 83 assert.lengthOf(imageComparison.shadowRoot.querySelectorAll('ct-results-co
mparison-zoomer'), 0); | |
| 84 }); | |
| 85 }); | |
| 86 }); | |
| 87 | |
| 88 })() | |
| 89 </script> | |
| OLD | NEW |