Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 class ClosableView extends UI.SimpleView { | |
| 2 isCloseable() { | |
| 3 return true; | |
| 4 } | |
| 5 } | |
| 6 | |
| 7 var views = ['first', 'second', 'third', 'fourth'].map(title => new ClosableView (title)); | |
| 8 | |
| 9 class MockViewManager { | |
| 10 constructor() { | |
| 11 /** @type {!Map<string, !UI.View>} */ | |
| 12 this._views = new Map(); | |
| 13 | |
| 14 for (var view of views) | |
| 15 this._views.set(view.viewId(), view); | |
|
dgozman
2017/05/25 17:12:49
Instead of mock, should we inject real extensions
einbinder
2017/05/25 23:48:54
Done.
| |
| 16 } | |
| 17 | |
| 18 /** | |
| 19 * @param {string} location | |
| 20 * @return {!Array<!UI.View>} | |
| 21 */ | |
| 22 _viewsForLocation(location) { | |
| 23 return Array.from(this._views.values()); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 var tabbedLocation; | |
| 28 createTabbedLocation(); | |
| 29 dumpTabs(); | |
| 30 TestRunner.addResult('Appending three views') | |
| 31 tabbedLocation.appendView(views[0]); | |
| 32 tabbedLocation.appendView(views[1]); | |
| 33 tabbedLocation.appendView(views[2]); | |
| 34 dumpTabs(); | |
| 35 createTabbedLocation(); | |
| 36 dumpTabs(); | |
| 37 TestRunner.addResult('Re-order tabs'); | |
| 38 tabbedLocation.tabbedPane()._insertBefore(tabbedLocation.tabbedPane()._tabsById. get("third"), 0); | |
| 39 dumpTabs(); | |
| 40 createTabbedLocation(); | |
| 41 dumpTabs(); | |
| 42 tabbedLocation.appendView(views[3]); | |
| 43 dumpTabs(); | |
| 44 createTabbedLocation(); | |
| 45 dumpTabs(); | |
| 46 TestRunner.addResult('Closing second tab'); | |
| 47 tabbedLocation.tabbedPane().closeTab('second'); | |
| 48 dumpTabs(); | |
| 49 createTabbedLocation(); | |
| 50 dumpTabs(); | |
| 51 TestRunner.completeTest(); | |
| 52 | |
| 53 function createTabbedLocation() { | |
| 54 TestRunner.addResult('Creating new TabbedLocation'); | |
| 55 if (tabbedLocation) | |
| 56 tabbedLocation.tabbedPane().detach(true); | |
| 57 tabbedLocation = new UI.ViewManager._TabbedLocation(new MockViewManager(), un defined, 'mock-location', true, true); | |
| 58 tabbedLocation.widget().show(UI.inspectorView.element); | |
| 59 } | |
| 60 | |
| 61 function dumpTabs() { | |
| 62 TestRunner.addResult(JSON.stringify(tabbedLocation.tabbedPane().tabIds())); | |
| 63 } | |
| OLD | NEW |