Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow SC.SplitView to be a SC.SplitChild #769

Merged
merged 2 commits into from Apr 22, 2012
Jump to file or symbol
Failed to load files and symbols.
+191 −172
Split
@@ -214,7 +214,7 @@ SC.SplitChild =
* @property SC.SplitView
*/
splitView: function() {
- var view = this ;
+ var view = this.get('parentView') ;
while (view && !view.isSplitView) view = view.get('parentView') ;
return view ;
}.property('parentView').cacheable(),
@@ -33,7 +33,14 @@ module("SplitView - SplitChild (" + (layoutDirection === SC.LAYOUT_HORIZONTAL ?
left: SC.View.extend(SC.SplitChild, { name: 'left', size: 100 }),
middle: SC.View.extend(SC.SplitChild, { name: 'middle', size: 300, positionOffset: -10, sizeOffset: 20 }),
- right: SC.View.extend(SC.SplitChild, { name: 'right', size: 100 }),
+ right: SC.SplitView.extend(SC.SplitChild, {
+ name: 'right',
+ size: 100,
+ splitDividerView: null,
+ childViews: ['top', 'bottom'],
+ top: SC.View.extend(SC.SplitChild, { name: 'top', size: 100 }),
+ bottom: SC.View.extend(SC.SplitChild, { name: 'bottom', size: 400 })
+ }),
layout: {
left: 0, top: 0,
@@ -129,6 +136,18 @@ test("Check that changing orientation changes layouts.", function() {
verifyChildren(splitView, 100, 100, 100);
});
+test("Check that the `splitView` computed is correct on SC.SplitChilds", function () {
+ equals(splitView, splitView.childViews[0].get('splitView'));
+ equals(splitView, splitView.childViews[1].get('splitView'));
+ equals(splitView, splitView.childViews[2].get('splitView'),
+ 'the splitView should the closest parent splitView');
+
+ var nestedSplitView = splitView.childViews[2];
+
+ equals(nestedSplitView, nestedSplitView.childViews[0].get('splitView'));
+ equals(nestedSplitView, nestedSplitView.childViews[1].get('splitView'));
+});
+
}
setupSuite(SC.LAYOUT_HORIZONTAL);
Oops, something went wrong.