OLD | NEW |
---|---|
(Empty) | |
1 class ClosableView extends UI.SimpleView { | |
2 isCloseable() { | |
3 return true; | |
4 } | |
5 } | |
6 | |
7 runtime._registerModule({ | |
8 name: "mock-module", | |
9 extensions: ['first', 'second', 'third', 'fourth'].map(title => { | |
10 return { | |
11 "type": "view", | |
12 "location": "mock-location", | |
13 "id": title, | |
14 "title": title, | |
15 "persistence": "closeable", | |
dgozman
2017/05/26 19:17:08
Do you need both this and isCloseable method? In f
einbinder
2017/05/26 21:12:38
I did but now I don't.
| |
16 "factoryName": "ClosableView" | |
17 } | |
18 }), | |
19 scripts: [] | |
20 }); | |
21 | |
22 var tabbedLocation; | |
23 createTabbedLocation(); | |
24 dumpTabs(); | |
25 TestRunner.addResult('Appending three views') | |
26 tabbedLocation.appendView(new ClosableView('first')); | |
dgozman
2017/05/26 19:17:08
Why manually? Doesn't this clash with ones from ex
einbinder
2017/05/26 21:12:38
It doesn't clash, but your code is much cleaner.
| |
27 tabbedLocation.appendView(new ClosableView('second')); | |
28 tabbedLocation.appendView(new ClosableView('third')); | |
29 dumpTabs(); | |
30 createTabbedLocation(); | |
31 dumpTabs(); | |
32 TestRunner.addResult('Re-order tabs'); | |
33 tabbedLocation.tabbedPane()._insertBefore(tabbedLocation.tabbedPane()._tabsById. get("third"), 0); | |
34 dumpTabs(); | |
35 createTabbedLocation(); | |
36 dumpTabs(); | |
37 tabbedLocation.appendView(new ClosableView('fourth')); | |
38 dumpTabs(); | |
39 createTabbedLocation(); | |
40 dumpTabs(); | |
41 TestRunner.addResult('Closing second tab'); | |
42 tabbedLocation.tabbedPane().closeTab('second'); | |
43 dumpTabs(); | |
44 createTabbedLocation(); | |
45 dumpTabs(); | |
46 TestRunner.completeTest(); | |
47 | |
48 function createTabbedLocation() { | |
49 TestRunner.addResult('Creating new TabbedLocation'); | |
50 if (tabbedLocation) | |
51 tabbedLocation.tabbedPane().detach(true); | |
52 tabbedLocation = (new UI.ViewManager()).createTabbedLocation(undefined, 'mock- location', true, true); | |
dgozman
2017/05/26 19:17:08
Why not UI.viewManager?
einbinder
2017/05/26 21:12:39
UI.viewManager has stale extensions. Also it shoul
| |
53 tabbedLocation.widget().show(UI.inspectorView.element); | |
54 } | |
55 | |
56 function dumpTabs() { | |
57 TestRunner.addResult(JSON.stringify(tabbedLocation.tabbedPane().tabIds())); | |
58 } | |
OLD | NEW |