Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: tracing/tracing/value/ui/scalar_span_test.html

Issue 1923953003: [polymer] Switches .appendChild() to Polymer.dom()...appendChild() (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tracing/tracing/value/ui/histogram_span.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2015 The Chromium Authors. All rights reserved. 3 Copyright 2015 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/value/numeric.html"> 8 <link rel="import" href="/tracing/value/numeric.html">
9 <link rel="import" href="/tracing/value/time_display_mode.html"> 9 <link rel="import" href="/tracing/value/time_display_mode.html">
10 <link rel="import" href="/tracing/value/ui/scalar_span.html"> 10 <link rel="import" href="/tracing/value/ui/scalar_span.html">
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 test('warningAndNonWarningHaveSimilarHeights', function() { 142 test('warningAndNonWarningHaveSimilarHeights', function() {
143 var spanA = document.createElement('tr-v-ui-scalar-span'); 143 var spanA = document.createElement('tr-v-ui-scalar-span');
144 spanA.setValueAndUnit(400, Unit.byName.timeDurationInMs); 144 spanA.setValueAndUnit(400, Unit.byName.timeDurationInMs);
145 145
146 var spanB = document.createElement('tr-v-ui-scalar-span'); 146 var spanB = document.createElement('tr-v-ui-scalar-span');
147 spanB.setValueAndUnit(400, Unit.byName.timeDurationInMs); 147 spanB.setValueAndUnit(400, Unit.byName.timeDurationInMs);
148 spanB.warning = 'There is a problem with this time'; 148 spanB.warning = 'There is a problem with this time';
149 149
150 var overall = document.createElement('div'); 150 var overall = document.createElement('div');
151 overall.style.display = 'flex'; 151 overall.style.display = 'flex';
152 overall.appendChild(spanA); 152 Polymer.dom(overall).appendChild(spanA);
153 spanB.style.marginLeft = '4px'; 153 spanB.style.marginLeft = '4px';
154 overall.appendChild(spanB); 154 Polymer.dom(overall).appendChild(spanB);
155 this.addHTMLOutput(overall); 155 this.addHTMLOutput(overall);
156 }); 156 });
157 157
158 test('respectCurrentDisplayUnit', function() { 158 test('respectCurrentDisplayUnit', function() {
159 try { 159 try {
160 Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ns; 160 Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ns;
161 161
162 var span = document.createElement('tr-v-ui-scalar-span'); 162 var span = document.createElement('tr-v-ui-scalar-span');
163 span.setValueAndUnit(73, Unit.byName.timeStampInMs); 163 span.setValueAndUnit(73, Unit.byName.timeStampInMs);
164 this.addHTMLOutput(span); 164 this.addHTMLOutput(span);
(...skipping 10 matching lines...) Expand all
175 var div = document.createElement('div'); 175 var div = document.createElement('div');
176 div.style.width = '100px'; 176 div.style.width = '100px';
177 this.addHTMLOutput(div); 177 this.addHTMLOutput(div);
178 178
179 function addAndCheckScalarSpan(percentage, expectedDisplay, expectedWidth) { 179 function addAndCheckScalarSpan(percentage, expectedDisplay, expectedWidth) {
180 var span = tr.v.ui.createScalarSpan(new ScalarNumeric( 180 var span = tr.v.ui.createScalarSpan(new ScalarNumeric(
181 Unit.byName.timeDurationInMs, 10 * div.children.length)); 181 Unit.byName.timeDurationInMs, 10 * div.children.length));
182 if (percentage !== null) 182 if (percentage !== null)
183 span.percentage = percentage; 183 span.percentage = percentage;
184 184
185 div.appendChild(span); 185 Polymer.dom(div).appendChild(span);
186 186
187 var computedStyle = getComputedStyle(span.$.sparkline); 187 var computedStyle = getComputedStyle(span.$.sparkline);
188 assert.equal(computedStyle.display, expectedDisplay); 188 assert.equal(computedStyle.display, expectedDisplay);
189 assert.equal(parseInt(computedStyle.width), expectedWidth); 189 assert.equal(parseInt(computedStyle.width), expectedWidth);
190 } 190 }
191 191
192 addAndCheckScalarSpan(null /* no percentage set */, 'none', 0); 192 addAndCheckScalarSpan(null /* no percentage set */, 'none', 0);
193 addAndCheckScalarSpan(undefined, 'none', 0); 193 addAndCheckScalarSpan(undefined, 'none', 0);
194 addAndCheckScalarSpan(0, 'block', 1); 194 addAndCheckScalarSpan(0, 'block', 1);
195 addAndCheckScalarSpan(0.05, 'block', 5); 195 addAndCheckScalarSpan(0.05, 'block', 5);
196 addAndCheckScalarSpan(0.5, 'block', 50); 196 addAndCheckScalarSpan(0.5, 'block', 50);
197 addAndCheckScalarSpan(0.95, 'block', 95); 197 addAndCheckScalarSpan(0.95, 'block', 95);
198 addAndCheckScalarSpan(1, 'block', 100); 198 addAndCheckScalarSpan(1, 'block', 100);
199 }); 199 });
200 }); 200 });
201 </script> 201 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/value/ui/histogram_span.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698