| OLD | NEW | 
|---|
| 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 | 7 | 
| 8 <link rel="import" href="/tracing/ui/base/tab_view.html"> | 8 <link rel="import" href="/tracing/ui/base/tab_view.html"> | 
| 9 | 9 | 
| 10 <template id="tab-view-test-template"> | 10 <template id="tab-view-test-template"> | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 42         'sed egestas mollis, urna nisl varius sem, sed venenatis turpis null' + | 42         'sed egestas mollis, urna nisl varius sem, sed venenatis turpis null' + | 
| 43         'a ipsum. Suspendisse potenti.'; | 43         'a ipsum. Suspendisse potenti.'; | 
| 44 | 44 | 
| 45     var tabViewContainer = document.createElement('div'); | 45     var tabViewContainer = document.createElement('div'); | 
| 46     tabViewContainer.style.width = '500px'; | 46     tabViewContainer.style.width = '500px'; | 
| 47     tabViewContainer.style.height = '200px'; | 47     tabViewContainer.style.height = '200px'; | 
| 48 | 48 | 
| 49     var tabView = new TracingAnalysisTabView(); | 49     var tabView = new TracingAnalysisTabView(); | 
| 50 | 50 | 
| 51     var firstTab = document.createElement('div'); | 51     var firstTab = document.createElement('div'); | 
| 52     firstTab.setAttribute('tab-label', 'First Tab Label'); | 52     Polymer.dom(firstTab).setAttribute('tab-label', 'First Tab Label'); | 
| 53     firstTab.innerHTML = '<p>' + TAB_TEXT + '<p>'; | 53     Polymer.dom(firstTab).innerHTML = '<p>' + TAB_TEXT + '<p>'; | 
| 54 | 54 | 
| 55     var secondTab = document.createElement('div'); | 55     var secondTab = document.createElement('div'); | 
| 56     secondTab.setAttribute('tab-label', 'Second Tab Label'); | 56     Polymer.dom(secondTab).setAttribute('tab-label', 'Second Tab Label'); | 
| 57     secondTab.innerHTML = '<b>' + 'Second Tab Text' + '</b>'; | 57     Polymer.dom(secondTab).innerHTML = '<b>' + 'Second Tab Text' + '</b>'; | 
| 58 | 58 | 
| 59     var thirdTab = document.createElement('div'); | 59     var thirdTab = document.createElement('div'); | 
| 60     thirdTab.setAttribute('tab-label', 'Third Tab Label'); | 60     Polymer.dom(thirdTab).setAttribute('tab-label', 'Third Tab Label'); | 
| 61     thirdTab.innerHTML = '<b>' + 'Third Tab Text' + '</b>'; | 61     Polymer.dom(thirdTab).innerHTML = '<b>' + 'Third Tab Text' + '</b>'; | 
| 62 | 62 | 
| 63     Polymer.dom(tabView).appendChild(firstTab); | 63     Polymer.dom(tabView).appendChild(firstTab); | 
| 64     Polymer.dom(tabView).appendChild(secondTab); | 64     Polymer.dom(tabView).appendChild(secondTab); | 
| 65     Polymer.dom(tabView).appendChild(thirdTab); | 65     Polymer.dom(tabView).appendChild(thirdTab); | 
| 66     Polymer.dom(tabViewContainer).appendChild(tabView); | 66     Polymer.dom(tabViewContainer).appendChild(tabView); | 
| 67 | 67 | 
| 68     this.addHTMLOutput(tabViewContainer); | 68     this.addHTMLOutput(tabViewContainer); | 
| 69 | 69 | 
| 70     thirdTab.setAttribute('tab-label', 'Something Different'); | 70     Polymer.dom(thirdTab).setAttribute('tab-label', 'Something Different'); | 
| 71 | 71 | 
| 72     var button = document.createElement('button'); | 72     var button = document.createElement('button'); | 
| 73     button.textContent = 'Change label'; | 73     button.textContent = 'Change label'; | 
| 74 | 74 | 
| 75     button.addEventListener('click', function() { | 75     button.addEventListener('click', function() { | 
| 76       thirdTab.setAttribute('tab-label', 'Label Changed'); | 76       Polymer.dom(thirdTab).setAttribute('tab-label', 'Label Changed'); | 
| 77     }); | 77     }); | 
| 78 | 78 | 
| 79     tabView.selectedTab = secondTab; | 79     tabView.selectedTab = secondTab; | 
| 80     this.addHTMLOutput(button); | 80     this.addHTMLOutput(button); | 
| 81   }); | 81   }); | 
| 82 | 82 | 
| 83 | 83 | 
| 84   test('instantiateWithTabHeading', function() { | 84   test('instantiateWithTabHeading', function() { | 
| 85     var TAB_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' + | 85     var TAB_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' + | 
| 86         ' Cras eleifend elit nec erat tristique pellentesque. Cras placerat ' + | 86         ' Cras eleifend elit nec erat tristique pellentesque. Cras placerat ' + | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 98         'a ipsum. Suspendisse potenti.'; | 98         'a ipsum. Suspendisse potenti.'; | 
| 99 | 99 | 
| 100     var tabViewContainer = document.createElement('div'); | 100     var tabViewContainer = document.createElement('div'); | 
| 101     tabViewContainer.style.width = '500px'; | 101     tabViewContainer.style.width = '500px'; | 
| 102     tabViewContainer.style.height = '200px'; | 102     tabViewContainer.style.height = '200px'; | 
| 103 | 103 | 
| 104     var tabView = new TracingAnalysisTabView(); | 104     var tabView = new TracingAnalysisTabView(); | 
| 105     tabView.tabStripHeadingText = 'Hello world:'; | 105     tabView.tabStripHeadingText = 'Hello world:'; | 
| 106 | 106 | 
| 107     var firstTab = document.createElement('div'); | 107     var firstTab = document.createElement('div'); | 
| 108     firstTab.setAttribute('tab-label', 'First Tab Label'); | 108     Polymer.dom(firstTab).setAttribute('tab-label', 'First Tab Label'); | 
| 109     firstTab.innerHTML = '<p>' + TAB_TEXT + '<p>'; | 109     Polymer.dom(firstTab).innerHTML = '<p>' + TAB_TEXT + '<p>'; | 
| 110 | 110 | 
| 111     var secondTab = document.createElement('div'); | 111     var secondTab = document.createElement('div'); | 
| 112     secondTab.setAttribute('tab-label', 'Second Tab Label'); | 112     Polymer.dom(secondTab).setAttribute('tab-label', 'Second Tab Label'); | 
| 113     secondTab.innerHTML = '<b>' + 'Second Tab Text' + '</b>'; | 113     Polymer.dom(secondTab).innerHTML = '<b>' + 'Second Tab Text' + '</b>'; | 
| 114 | 114 | 
| 115     var thirdTab = document.createElement('div'); | 115     var thirdTab = document.createElement('div'); | 
| 116     thirdTab.setAttribute('tab-label', 'Third Tab Label'); | 116     Polymer.dom(thirdTab).setAttribute('tab-label', 'Third Tab Label'); | 
| 117     thirdTab.innerHTML = '<b>' + 'Third Tab Text' + '</b>'; | 117     Polymer.dom(thirdTab).innerHTML = '<b>' + 'Third Tab Text' + '</b>'; | 
| 118 | 118 | 
| 119     Polymer.dom(tabView).appendChild(firstTab); | 119     Polymer.dom(tabView).appendChild(firstTab); | 
| 120     Polymer.dom(tabView).appendChild(secondTab); | 120     Polymer.dom(tabView).appendChild(secondTab); | 
| 121     Polymer.dom(tabView).appendChild(thirdTab); | 121     Polymer.dom(tabView).appendChild(thirdTab); | 
| 122     Polymer.dom(tabViewContainer).appendChild(tabView); | 122     Polymer.dom(tabViewContainer).appendChild(tabView); | 
| 123 | 123 | 
| 124     this.addHTMLOutput(tabViewContainer); | 124     this.addHTMLOutput(tabViewContainer); | 
| 125     tabView.selectedTab = secondTab; | 125     tabView.selectedTab = secondTab; | 
| 126   }); | 126   }); | 
| 127 | 127 | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 220     t3.textContent = 'This text should NOT be visible, also.'; | 220     t3.textContent = 'This text should NOT be visible, also.'; | 
| 221 | 221 | 
| 222     t1.selected = true; | 222     t1.selected = true; | 
| 223     t2.selected = false; | 223     t2.selected = false; | 
| 224     t3.selected = false; | 224     t3.selected = false; | 
| 225 | 225 | 
| 226     Polymer.dom(tabView).appendChild(t1); | 226     Polymer.dom(tabView).appendChild(t1); | 
| 227     Polymer.dom(tabView).appendChild(t2); | 227     Polymer.dom(tabView).appendChild(t2); | 
| 228     Polymer.dom(tabView).appendChild(t3); | 228     Polymer.dom(tabView).appendChild(t3); | 
| 229 | 229 | 
| 230     t1.setAttribute('tab-label', 'This should be selected'); | 230     Polymer.dom(t1).setAttribute('tab-label', 'This should be selected'); | 
| 231     t2.setAttribute('tab-label', 'Not selected'); | 231     Polymer.dom(t2).setAttribute('tab-label', 'Not selected'); | 
| 232     t3.setAttribute('tab-label', 'Not selected'); | 232     Polymer.dom(t3).setAttribute('tab-label', 'Not selected'); | 
| 233 | 233 | 
| 234     Polymer.dom(tabViewContainer).appendChild(tabView); | 234     Polymer.dom(tabViewContainer).appendChild(tabView); | 
| 235 | 235 | 
| 236     this.addHTMLOutput(tabViewContainer); | 236     this.addHTMLOutput(tabViewContainer); | 
| 237   }); | 237   }); | 
| 238 | 238 | 
| 239   test('selectingInvalidTabWorks', function() { | 239   test('selectingInvalidTabWorks', function() { | 
| 240     var tabView = new TracingAnalysisTabView(); | 240     var tabView = new TracingAnalysisTabView(); | 
| 241     var t1 = document.createElement('div'); | 241     var t1 = document.createElement('div'); | 
| 242     var t2 = document.createElement('div'); | 242     var t2 = document.createElement('div'); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 302     t1.textContent = 'This text should BE visible.'; | 302     t1.textContent = 'This text should BE visible.'; | 
| 303     var t2 = document.createElement('div'); | 303     var t2 = document.createElement('div'); | 
| 304     t2.textContent = 'This text should NOT be visible.'; | 304     t2.textContent = 'This text should NOT be visible.'; | 
| 305     var t3 = document.createElement('div'); | 305     var t3 = document.createElement('div'); | 
| 306     t3.textContent = 'This text should NOT be visible, also.'; | 306     t3.textContent = 'This text should NOT be visible, also.'; | 
| 307 | 307 | 
| 308     Polymer.dom(tabView).appendChild(t1); | 308     Polymer.dom(tabView).appendChild(t1); | 
| 309     Polymer.dom(tabView).appendChild(t2); | 309     Polymer.dom(tabView).appendChild(t2); | 
| 310     Polymer.dom(tabView).appendChild(t3); | 310     Polymer.dom(tabView).appendChild(t3); | 
| 311 | 311 | 
| 312     t1.setAttribute('tab-label', 'This should not exist'); | 312     Polymer.dom(t1).setAttribute('tab-label', 'This should not exist'); | 
| 313     t2.setAttribute('tab-label', 'Not selected'); | 313     Polymer.dom(t2).setAttribute('tab-label', 'Not selected'); | 
| 314     t3.setAttribute('tab-label', 'Not selected'); | 314     Polymer.dom(t3).setAttribute('tab-label', 'Not selected'); | 
| 315 | 315 | 
| 316     tabView.selectedTab = t1; | 316     tabView.selectedTab = t1; | 
| 317     tabView.removeChild(t1); | 317     Polymer.dom(tabView).removeChild(t1); | 
| 318 | 318 | 
| 319     Polymer.dom(tabViewContainer).appendChild(tabView); | 319     Polymer.dom(tabViewContainer).appendChild(tabView); | 
| 320 | 320 | 
| 321     this.addHTMLOutput(tabViewContainer); | 321     this.addHTMLOutput(tabViewContainer); | 
| 322   }); | 322   }); | 
| 323 }); | 323 }); | 
| 324 </script> | 324 </script> | 
| OLD | NEW | 
|---|