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

Side by Side Diff: tracing/tracing/ui/base/drag_handle_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/dom_helpers.html ('k') | tracing/tracing/ui/base/dropdown_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/drag_handle.html"> 7 <link rel="import" href="/tracing/ui/base/drag_handle.html">
8 <script> 8 <script>
9 'use strict'; 9 'use strict';
10 10
11 tr.b.unittest.testSuite(function() { 11 tr.b.unittest.testSuite(function() {
12 var createDragHandle = function() { 12 var createDragHandle = function() {
13 var el = document.createElement('div'); 13 var el = document.createElement('div');
14 el.style.border = '1px solid black'; 14 el.style.border = '1px solid black';
15 el.style.width = '200px'; 15 el.style.width = '200px';
16 el.style.height = '200px'; 16 el.style.height = '200px';
17 el.style.display = 'flex'; 17 el.style.display = 'flex';
18 el.style.flexDirection = 'column'; 18 el.style.flexDirection = 'column';
19 19
20 var upperEl = document.createElement('div'); 20 var upperEl = document.createElement('div');
21 upperEl.style.flex = '1 1 auto'; 21 upperEl.style.flex = '1 1 auto';
22 upperEl.style.minHeight = '0'; 22 upperEl.style.minHeight = '0';
23 23
24 var lowerEl = document.createElement('div'); 24 var lowerEl = document.createElement('div');
25 lowerEl.style.height = '100px'; 25 lowerEl.style.height = '100px';
26 26
27 var dragHandle = document.createElement('tr-ui-b-drag-handle'); 27 var dragHandle = document.createElement('tr-ui-b-drag-handle');
28 dragHandle.target = lowerEl; 28 dragHandle.target = lowerEl;
29 29
30 el.appendChild(upperEl); 30 Polymer.dom(el).appendChild(upperEl);
31 el.appendChild(dragHandle); 31 Polymer.dom(el).appendChild(dragHandle);
32 el.appendChild(lowerEl); 32 Polymer.dom(el).appendChild(lowerEl);
33 el.upperEl = upperEl; 33 el.upperEl = upperEl;
34 el.dragHandle = dragHandle; 34 el.dragHandle = dragHandle;
35 el.lowerEl = lowerEl; 35 el.lowerEl = lowerEl;
36 36
37 el.getLowerElHeight = function() { 37 el.getLowerElHeight = function() {
38 return parseInt(getComputedStyle(this.lowerEl).height); 38 return parseInt(getComputedStyle(this.lowerEl).height);
39 }; 39 };
40 return el; 40 return el;
41 }; 41 };
42 42
(...skipping 10 matching lines...) Expand all
53 dragHandle.applyDelta_(10); 53 dragHandle.applyDelta_(10);
54 assert.equal(el.getLowerElHeight(), oldHeight + 10); 54 assert.equal(el.getLowerElHeight(), oldHeight + 10);
55 }); 55 });
56 56
57 test('classNameMutation', function() { 57 test('classNameMutation', function() {
58 var el = createDragHandle(); 58 var el = createDragHandle();
59 59
60 var styleEl = document.createElement('style'); 60 var styleEl = document.createElement('style');
61 styleEl.textContent = 61 styleEl.textContent =
62 '.mode-a { height: 100px; } .mode-b { height: 50px; }'; 62 '.mode-a { height: 100px; } .mode-b { height: 50px; }';
63 document.head.appendChild(styleEl); 63 Polymer.dom(document.head).appendChild(styleEl);
64 64
65 this.addHTMLOutput(el); 65 this.addHTMLOutput(el);
66 66
67 try { 67 try {
68 var dragHandle = el.dragHandle; 68 var dragHandle = el.dragHandle;
69 el.lowerEl.className = 'mode-a'; 69 el.lowerEl.className = 'mode-a';
70 assert.equal(el.getLowerElHeight(), 100); 70 assert.equal(el.getLowerElHeight(), 100);
71 71
72 dragHandle.applyDelta_(10); 72 dragHandle.applyDelta_(10);
73 assert.equal(el.getLowerElHeight(), 110); 73 assert.equal(el.getLowerElHeight(), 110);
(...skipping 11 matching lines...) Expand all
85 // to sizing when we were changed. 85 // to sizing when we were changed.
86 el.lowerEl.className = 'mode-a'; 86 el.lowerEl.className = 'mode-a';
87 dragHandle.forceMutationObserverFlush_(); 87 dragHandle.forceMutationObserverFlush_();
88 assert.equal(el.getLowerElHeight(), 110); 88 assert.equal(el.getLowerElHeight(), 110);
89 } finally { 89 } finally {
90 document.head.removeChild(styleEl); 90 document.head.removeChild(styleEl);
91 } 91 }
92 }); 92 });
93 }); 93 });
94 </script> 94 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/ui/base/dom_helpers.html ('k') | tracing/tracing/ui/base/dropdown_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698