Index: tracing/tracing/ui/side_panel/side_panel_container_test.html |
diff --git a/tracing/tracing/ui/side_panel/side_panel_container_test.html b/tracing/tracing/ui/side_panel/side_panel_container_test.html |
index bfad7ee5a37961298d0c7d4d049b3b67d3449e4d..a51be6204269df68af04b38ef6ada771d7b8b888 100644 |
--- a/tracing/tracing/ui/side_panel/side_panel_container_test.html |
+++ b/tracing/tracing/ui/side_panel/side_panel_container_test.html |
@@ -8,9 +8,13 @@ found in the LICENSE file. |
<link rel="import" href="/tracing/core/test_utils.html"> |
<link rel="import" href="/tracing/model/event_set.html"> |
<link rel="import" href="/tracing/model/model.html"> |
+<link rel="import" href="/tracing/ui/base/deep_utils.html"> |
<link rel="import" href="/tracing/ui/side_panel/side_panel.html"> |
<link rel="import" href="/tracing/ui/side_panel/side_panel_container.html"> |
+<dom-module id="tr-ui-sp-disabled-side-panel"></dom-module> |
+<dom-module id="tr-ui-sp-enabled-side-panel"></dom-module> |
+ |
<script> |
'use strict'; |
@@ -45,6 +49,36 @@ tr.b.unittest.testSuite(function() { |
return m; |
} |
+ Polymer({ |
+ is: 'tr-ui-sp-disabled-test-panel', |
+ behaviors: [tr.ui.behaviors.SidePanel], |
+ supportsModel(m) { |
+ return {supported: false}; |
+ }, |
+ get textLabel() { |
+ return 'Disabled'; |
+ } |
+ }); |
+ |
+ tr.ui.side_panel.SidePanelRegistry.register(function disabled() { |
+ return document.createElement('tr-ui-sp-disabled-test-panel'); |
+ }); |
+ |
+ Polymer({ |
+ is: 'tr-ui-sp-enabled-test-panel', |
+ behaviors: [tr.ui.behaviors.SidePanel], |
+ supportsModel(m) { |
+ return {supported: true}; |
+ }, |
+ get textLabel() { |
+ return 'Enabled'; |
+ }, |
+ }); |
+ |
+ tr.ui.side_panel.SidePanelRegistry.register(function enabled() { |
+ return document.createElement('tr-ui-sp-enabled-test-panel'); |
+ }); |
+ |
test('instantiateCollapsed', function() { |
const brushingStateController = new FakeBrushingStateController(); |
brushingStateController.model = createModel(); |
@@ -52,6 +86,13 @@ tr.b.unittest.testSuite(function() { |
const container = document.createElement('tr-ui-side-panel-container'); |
container.brushingStateController = brushingStateController; |
this.addHTMLOutput(container); |
+ |
+ // The Enabled tab should appear first in the tab strip even though the |
+ // disabled side panel was registered first. |
+ // There may be other side panels. |
+ const labels = tr.ui.b.findDeepElementsMatching(container, |
+ 'TAB-STRIP-LABEL').map(e => e.textContent); |
+ assert.isBelow(labels.indexOf('Enabled'), labels.indexOf('Disabled')); |
}); |
}); |
</script> |