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

Side by Side Diff: tracing/tracing/ui/base/overlay_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/ui/base/overlay.html ('k') | tracing/tracing/ui/base/radio_picker_test.html » ('j') | 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 (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 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 <link rel="import" href="/tracing/ui/base/overlay.html"> 7 <link rel="import" href="/tracing/ui/base/overlay.html">
8 <link rel="import" href="/tracing/ui/base/dom_helpers.html"> 8 <link rel="import" href="/tracing/ui/base/dom_helpers.html">
9 <script> 9 <script>
10 'use strict'; 10 'use strict';
(...skipping 22 matching lines...) Expand all
33 dlg.onClose_(e); 33 dlg.onClose_(e);
34 }); 34 });
35 return btn; 35 return btn;
36 } 36 }
37 37
38 test('instantiate', function() { 38 test('instantiate', function() {
39 var dlg = new tr.ui.b.Overlay(); 39 var dlg = new tr.ui.b.Overlay();
40 dlg.classList.add('example-overlay'); 40 dlg.classList.add('example-overlay');
41 dlg.title = 'ExampleOverlay'; 41 dlg.title = 'ExampleOverlay';
42 dlg.innerHTML = 'hello'; 42 dlg.innerHTML = 'hello';
43 dlg.buttons.appendChild(makeButton('i am a button')); 43 Polymer.dom(dlg.buttons).appendChild(makeButton('i am a button'));
44 dlg.buttons.appendChild(makeCloseButton(dlg)); 44 Polymer.dom(dlg.buttons).appendChild(makeCloseButton(dlg));
45 dlg.buttons.appendChild(tr.ui.b.createSpan( 45 Polymer.dom(dlg.buttons).appendChild(tr.ui.b.createSpan(
46 {textContent: 'i am a span'})); 46 {textContent: 'i am a span'}));
47 addShowButtonForDialog.call(this, dlg); 47 addShowButtonForDialog.call(this, dlg);
48 }); 48 });
49 49
50 test('instantiate_noButtons', function() { 50 test('instantiate_noButtons', function() {
51 var dlg = new tr.ui.b.Overlay(); 51 var dlg = new tr.ui.b.Overlay();
52 dlg.classList.add('example-overlay'); 52 dlg.classList.add('example-overlay');
53 dlg.title = 'ExampleOverlay'; 53 dlg.title = 'ExampleOverlay';
54 dlg.innerHTML = 'hello'; 54 dlg.innerHTML = 'hello';
55 addShowButtonForDialog.call(this, dlg); 55 addShowButtonForDialog.call(this, dlg);
56 }); 56 });
57 57
58 test('instantiate_disableUserClose', function() { 58 test('instantiate_disableUserClose', function() {
59 var dlg = new tr.ui.b.Overlay(); 59 var dlg = new tr.ui.b.Overlay();
60 dlg.classList.add('example-overlay'); 60 dlg.classList.add('example-overlay');
61 dlg.userCanClose = false; 61 dlg.userCanClose = false;
62 dlg.title = 'Unclosable'; 62 dlg.title = 'Unclosable';
63 dlg.innerHTML = 'This has no close X button.'; 63 dlg.innerHTML = 'This has no close X button.';
64 dlg.buttons.appendChild(makeCloseButton(dlg)); 64 Polymer.dom(dlg.buttons).appendChild(makeCloseButton(dlg));
65 addShowButtonForDialog.call(this, dlg); 65 addShowButtonForDialog.call(this, dlg);
66 }); 66 });
67 67
68 test('instantiateTall', function() { 68 test('instantiateTall', function() {
69 var dlg = new tr.ui.b.Overlay(); 69 var dlg = new tr.ui.b.Overlay();
70 dlg.title = 'TallContent'; 70 dlg.title = 'TallContent';
71 var contentEl = document.createElement('div'); 71 var contentEl = document.createElement('div');
72 contentEl.style.overflowY = 'auto'; 72 contentEl.style.overflowY = 'auto';
73 dlg.appendChild(contentEl); 73 Polymer.dom(dlg).appendChild(contentEl);
74 74
75 for (var i = 0; i < 1000; i++) { 75 for (var i = 0; i < 1000; i++) {
76 var el = document.createElement('div'); 76 var el = document.createElement('div');
77 el.textContent = 'line ' + i; 77 el.textContent = 'line ' + i;
78 contentEl.appendChild(el); 78 Polymer.dom(contentEl).appendChild(el);
79 } 79 }
80 80
81 81
82 dlg.buttons.appendChild(makeButton('i am a button')); 82 Polymer.dom(dlg.buttons).appendChild(makeButton('i am a button'));
83 addShowButtonForDialog.call(this, dlg); 83 addShowButtonForDialog.call(this, dlg);
84 }); 84 });
85 85
86 test('instantiateTallWithManyDirectChildren', function() { 86 test('instantiateTallWithManyDirectChildren', function() {
87 var dlg = new tr.ui.b.Overlay(); 87 var dlg = new tr.ui.b.Overlay();
88 dlg.title = 'TallContent'; 88 dlg.title = 'TallContent';
89 for (var i = 0; i < 100; i++) { 89 for (var i = 0; i < 100; i++) {
90 var el = document.createElement('div'); 90 var el = document.createElement('div');
91 el.style.webkitFlex = '1 0 auto'; 91 el.style.webkitFlex = '1 0 auto';
92 el.textContent = 'line ' + i; 92 el.textContent = 'line ' + i;
93 dlg.appendChild(el); 93 Polymer.dom(dlg).appendChild(el);
94 } 94 }
95 95
96 dlg.buttons.appendChild(makeButton('i am a button')); 96 Polymer.dom(dlg.buttons).appendChild(makeButton('i am a button'));
97 addShowButtonForDialog.call(this, dlg); 97 addShowButtonForDialog.call(this, dlg);
98 }); 98 });
99 99
100 test('closeclickEvent', function() { 100 test('closeclickEvent', function() {
101 var dlg = new tr.ui.b.Overlay(); 101 var dlg = new tr.ui.b.Overlay();
102 dlg.title = 'Test closeclick event'; 102 dlg.title = 'Test closeclick event';
103 var closeBtn = makeCloseButton(dlg); 103 var closeBtn = makeCloseButton(dlg);
104 dlg.buttons.appendChild(closeBtn); 104 Polymer.dom(dlg.buttons).appendChild(closeBtn);
105 105
106 var closeClicked = false; 106 var closeClicked = false;
107 dlg.addEventListener('closeclick', function() { 107 dlg.addEventListener('closeclick', function() {
108 closeClicked = true; 108 closeClicked = true;
109 }); 109 });
110 110
111 return new Promise(function(resolve, reject) { 111 return new Promise(function(resolve, reject) {
112 function pressClose() { 112 function pressClose() {
113 closeBtn.click(); 113 closeBtn.click();
114 if (closeClicked) 114 if (closeClicked)
115 resolve(); 115 resolve();
116 else 116 else
117 reject(new Error('closeclick event is not dispatched')); 117 reject(new Error('closeclick event is not dispatched'));
118 } 118 }
119 dlg.visible = true; 119 dlg.visible = true;
120 setTimeout(pressClose, 60); 120 setTimeout(pressClose, 60);
121 }); 121 });
122 }); 122 });
123 }); 123 });
124 </script> 124 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/ui/base/overlay.html ('k') | tracing/tracing/ui/base/radio_picker_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698