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 <polymer-element name="ct-results-comparison" attributes="type expectedUrl actu alUrl diffUrl"> | |
8 <template> | |
9 <style> | |
10 :host { | |
11 display: flex; | |
12 flex-wrap: wrap; | |
13 width: 100%; | |
14 } | |
15 .container { | |
16 flex: 1; | |
17 min-width: 300px; | |
18 } | |
19 .result { | |
20 border: 1px solid gray; | |
21 } | |
22 iframe { | |
23 border: none; | |
24 width: 100%; | |
25 height: 400px; | |
26 } | |
27 img { | |
28 width: 100%; | |
29 } | |
30 </style> | |
31 | |
32 <template repeat="{{resultKind in _resultKinds}}"> | |
33 <div class="container"> | |
34 <h2>{{resultKind}}</h2> | |
35 <div class="result"> | |
36 <template if="{{type == _kImageType && _urlForKind(resultKin d)}}"> | |
esprehn
2014/06/23 05:25:05
This is a very contorted way to do this. You reall
ojan
2014/06/23 05:43:32
I'm not sure what you're suggesting I do. What wou
| |
37 <img src="{{_urlForKind(resultKind)}}"> | |
38 </template> | |
39 <template if="{{type == _kTextType && _urlForKind(resultKind )}}"> | |
40 <iframe src="{{_urlForKind(resultKind)}}"></iframe> | |
41 </template> | |
42 <template if="{{type == _kAudioType && _urlForKind(resultKin d)}}"> | |
43 <audio controls src="{{_urlForKind(resultKind)}}"></audi o> | |
44 </template> | |
45 </div> | |
46 </div> | |
47 </template> | |
48 </template> | |
49 <script> | |
50 Polymer({ | |
esprehn
2014/06/23 05:25:05
You need to initialize your properties you've set
ojan
2014/06/23 05:43:32
Why? It seems to work without. Not disagreeing, ju
| |
51 _urlForKind: function(kind) { | |
52 if (kind == "Expected") | |
53 return this.expectedUrl; | |
54 if (kind == "Actual") | |
55 return this.actualUrl; | |
56 if (kind == "Diff") | |
57 return this.diffUrl; | |
58 console.error('Unknown kind: ' + kind); | |
59 }, | |
60 _kAudioType: results.kAudioType, | |
61 _kImageType: results.kImageType, | |
62 _kTextType: results.kTextType, | |
63 _resultKinds: ["Expected", "Actual", "Diff"], | |
64 }); | |
65 </script> | |
66 </polymer-element> | |
OLD | NEW |