sproutit-sproutcore 1.0.20090721145251 → 1.0.20090721145280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +3 -3
- data/VERSION.yml +2 -2
- data/frameworks/sproutcore/Buildfile +0 -1
- data/gen/app/templates/apps/@target_name@/core.js +27 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/loading.rhtml +9 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/main_page.js +22 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/strings.js +15 -0
- data/gen/app/templates/apps/@target_name@/main.js +30 -0
- data/gen/controller/templates/controllers/@filename@.js +18 -0
- data/gen/controller/templates/tests/controllers/@filename@.js +15 -0
- data/gen/framework/templates/frameworks/@target_name@/core.js +21 -0
- data/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +15 -0
- data/gen/language/templates/@filename@/strings.js +14 -0
- data/gen/model/templates/fixtures/@filename@.js +35 -0
- data/gen/model/templates/models/@filename@.js +19 -0
- data/gen/model/templates/tests/models/@filename@.js +15 -0
- data/gen/project/templates/@filename@/Buildfile +7 -0
- data/gen/project/templates/@filename@/README +7 -0
- data/gen/test/templates/tests/@filename@.js +15 -0
- data/gen/theme/templates/themes/@target_name@/english.lproj/strings.js +15 -0
- data/gen/view/templates/tests/views/@filename@.js +15 -0
- data/gen/view/templates/views/@filename@.js +18 -0
- data/lib/sproutcore/models/generator.rb +2 -2
- metadata +21 -33
- data/frameworks/sproutcore/frameworks/deprecated/core.js +0 -59
- data/frameworks/sproutcore/frameworks/deprecated/lib/button_views.rb +0 -330
- data/frameworks/sproutcore/frameworks/deprecated/lib/collection_view.rb +0 -83
- data/frameworks/sproutcore/frameworks/deprecated/lib/core_views.rb +0 -326
- data/frameworks/sproutcore/frameworks/deprecated/lib/form_views.rb +0 -253
- data/frameworks/sproutcore/frameworks/deprecated/lib/index.rhtml +0 -75
- data/frameworks/sproutcore/frameworks/deprecated/lib/menu_views.rb +0 -93
- data/frameworks/sproutcore/frameworks/deprecated/server/rails_server.js +0 -80
- data/frameworks/sproutcore/frameworks/deprecated/server/rest_server.js +0 -178
- data/frameworks/sproutcore/frameworks/deprecated/server/server.js +0 -673
- data/frameworks/sproutcore/frameworks/deprecated/system/animator.js +0 -679
- data/frameworks/sproutcore/frameworks/deprecated/system/binding.js +0 -36
- data/frameworks/sproutcore/frameworks/deprecated/system/browser.js +0 -75
- data/frameworks/sproutcore/frameworks/deprecated/system/classic_responder.js +0 -312
- data/frameworks/sproutcore/frameworks/deprecated/system/event.js +0 -58
- data/frameworks/sproutcore/frameworks/deprecated/system/globals.js +0 -20
- data/frameworks/sproutcore/frameworks/deprecated/system/misc.js +0 -58
- data/frameworks/sproutcore/frameworks/deprecated/system/node_descriptor.js +0 -72
- data/frameworks/sproutcore/frameworks/deprecated/system/object.js +0 -122
- data/frameworks/sproutcore/frameworks/deprecated/system/path_module.js +0 -432
- data/frameworks/sproutcore/frameworks/deprecated/system/string.js +0 -107
- data/frameworks/sproutcore/frameworks/deprecated/tests/application/application.rhtml +0 -125
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml +0 -401
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/frame.rhtml +0 -357
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml +0 -147
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/base.rhtml +0 -298
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/incremental_rendering.rhtml +0 -260
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/source_list_rendering.rhtml +0 -143
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/popup_button.rhtml +0 -128
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/text_field.rhtml +0 -37
- data/frameworks/sproutcore/frameworks/deprecated/views/collection.js +0 -24
@@ -1,107 +0,0 @@
|
|
1
|
-
// ========================================================================
|
2
|
-
// SproutCore -- JavaScript Application Framework
|
3
|
-
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
|
4
|
-
// Portions copyright ©2008 Apple, Inc. All rights reserved.
|
5
|
-
// ========================================================================
|
6
|
-
|
7
|
-
// deprecated, mostly useless API, that was blindly copied from Prototype
|
8
|
-
SC.mixin(String.prototype, {
|
9
|
-
|
10
|
-
/** @deprecated
|
11
|
-
Explodes a string into an array of characters.
|
12
|
-
|
13
|
-
@returns {Array}
|
14
|
-
*/
|
15
|
-
toArray: function() {
|
16
|
-
return this.split('');
|
17
|
-
},
|
18
|
-
|
19
|
-
// Deprecated, longer version of this method.
|
20
|
-
format: SC.String.fmt
|
21
|
-
});
|
22
|
-
|
23
|
-
// Add strings for various languages to this collection. String.loc()
|
24
|
-
// method will try to localize the string passed using the current language.
|
25
|
-
// if the language is not available, it will use English.
|
26
|
-
SC.mixin(String,
|
27
|
-
/** @scope String @static */ {
|
28
|
-
|
29
|
-
/** @deprecated
|
30
|
-
The current browser language as a two letter code.
|
31
|
-
Use SC.browser.language instead.
|
32
|
-
*/
|
33
|
-
browserLanguage: ((navigator.language || navigator.browserLanguage).split('-', 1)[0]),
|
34
|
-
|
35
|
-
/** @deprecated
|
36
|
-
If YES, localization will favor the detected language instead of the
|
37
|
-
preferred one.
|
38
|
-
|
39
|
-
Use SC.Locale.useAutodetectedLanguage instead.
|
40
|
-
*/
|
41
|
-
useAutodetectedLanguage: null,
|
42
|
-
|
43
|
-
/** @deprecated
|
44
|
-
This property is set by the build tools to the current build language.
|
45
|
-
Use SC.Locale.preferredLanguage instead
|
46
|
-
*/
|
47
|
-
preferredLanguage: null,
|
48
|
-
|
49
|
-
/** @deprecated
|
50
|
-
Returns the hash key to use for loc strings. The default implementation
|
51
|
-
will autodetect the browser language and look for a loc string to
|
52
|
-
match. If it can't find one then it will introspect to find loc strings
|
53
|
-
that are defined and use those instead.
|
54
|
-
|
55
|
-
Use SC.Locale.currentLanguage property instead.
|
56
|
-
*/
|
57
|
-
currentLanguage: function () {
|
58
|
-
return this.normalizedLanguage(SC.Locale.currentLanguage);
|
59
|
-
},
|
60
|
-
|
61
|
-
/** @deprecated
|
62
|
-
Returns a normalized language string for the two letter country code.
|
63
|
-
|
64
|
-
Use SC.Locale.normalizeLanguage() instead.
|
65
|
-
*/
|
66
|
-
normalizedLanguage: function(ret) {
|
67
|
-
switch(SC.Locale.normalizeLanguage(ret).split('-')[0]) {
|
68
|
-
case 'en':
|
69
|
-
ret = 'English' ;
|
70
|
-
break;
|
71
|
-
case 'fr':
|
72
|
-
ret = 'French' ;
|
73
|
-
break ;
|
74
|
-
case 'ja':
|
75
|
-
ret = 'Japanese' ;
|
76
|
-
break ;
|
77
|
-
case 'de':
|
78
|
-
ret = 'German' ;
|
79
|
-
break ;
|
80
|
-
case 'es':
|
81
|
-
ret = 'Spanish' ;
|
82
|
-
break;
|
83
|
-
default:
|
84
|
-
ret = 'English';
|
85
|
-
}
|
86
|
-
return ret ;
|
87
|
-
},
|
88
|
-
|
89
|
-
/**
|
90
|
-
Adds loc strings for the named language. This method takes care of
|
91
|
-
creating the localized string hash if it does not already exist.
|
92
|
-
The language can be one of the following or any two-letter country code.
|
93
|
-
|
94
|
-
English, French, German, Japanese, Spanish
|
95
|
-
|
96
|
-
@param language {String} the language code
|
97
|
-
@param strings {Hash} hash of loc strings.
|
98
|
-
@returns {this}
|
99
|
-
*/
|
100
|
-
addStringsFor: SC.stringsFor
|
101
|
-
|
102
|
-
});
|
103
|
-
|
104
|
-
String.English = String.English || {};
|
105
|
-
String.French = String.French || {};
|
106
|
-
String.German = String.German || {};
|
107
|
-
String.Japanese = String.Japanese || {};
|
@@ -1,125 +0,0 @@
|
|
1
|
-
<% popup_menu_view :a_menu, :pane => 'menu', :class => 'menu' do %>
|
2
|
-
<%= menu_item_view :item_enabled_key_equiv_no_target,
|
3
|
-
:outlet => true,
|
4
|
-
:label => "",
|
5
|
-
:action => "onAltShiftA",
|
6
|
-
:key_equivalent => 'alt_shift_a'
|
7
|
-
%>
|
8
|
-
<%= menu_item_view :item_enabled_key_equiv_with_target,
|
9
|
-
:outlet => true,
|
10
|
-
:label => "",
|
11
|
-
:action => "onAltShiftB",
|
12
|
-
:target => "SC.exampleController",
|
13
|
-
:key_equivalent => 'alt_shift_b'
|
14
|
-
%>
|
15
|
-
<%= menu_item_view :item_disabled_key_equiv,
|
16
|
-
:outlet => true,
|
17
|
-
:label => "",
|
18
|
-
:enabled => false,
|
19
|
-
:action => "onAltShiftB",
|
20
|
-
:key_equivalent => 'alt_shift_b'
|
21
|
-
%>
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
<% view :view_1 do %>
|
25
|
-
<% view :view_1_1, :outlet => true do %>
|
26
|
-
<% view :view_1_1_1, :outlet => true do %>
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
-
<% view :view_1_2, :outlet => true do %>
|
30
|
-
<% view :view_1_2_1, :outlet => true do %>
|
31
|
-
<% end %>
|
32
|
-
<% end %>
|
33
|
-
<% end %>
|
34
|
-
|
35
|
-
|
36
|
-
<% content_for('final') do %>
|
37
|
-
<script>
|
38
|
-
|
39
|
-
Test.context("SC.Application", {
|
40
|
-
|
41
|
-
"Should be instantiated and placed in SC.app on page load": function()
|
42
|
-
{
|
43
|
-
SC.app.kindOf(SC.Application).shouldEqual(true);
|
44
|
-
},
|
45
|
-
"SC.app keyPane should be set to SC.window by default": function()
|
46
|
-
{
|
47
|
-
var keyPane = SC.app.get('keyPane');
|
48
|
-
( keyPane == SC.window ).shouldEqual(true);
|
49
|
-
},
|
50
|
-
"SC.app mainPane should be set to SC.window by default": function()
|
51
|
-
{
|
52
|
-
var mainPane = SC.app.get('mainPane');
|
53
|
-
( mainPane == SC.window ).shouldEqual(true);
|
54
|
-
},
|
55
|
-
"Setting the keyPane shouldn't change the mainPane": function()
|
56
|
-
{
|
57
|
-
( SC.app.get('mainPane') == SC.window ).shouldEqual(true);
|
58
|
-
|
59
|
-
var pane = SC.ClassicPaneView.viewFor(null);
|
60
|
-
SC.app.set('keyPane', pane);
|
61
|
-
( SC.app.get('mainPane') == SC.window ).shouldEqual(true);
|
62
|
-
},
|
63
|
-
|
64
|
-
setup: function()
|
65
|
-
{
|
66
|
-
},
|
67
|
-
teardown: function()
|
68
|
-
{
|
69
|
-
}
|
70
|
-
|
71
|
-
});
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
Test.context("SC.Application's sendAction method", {
|
76
|
-
|
77
|
-
"Should not handle actions that are not strings": function()
|
78
|
-
{
|
79
|
-
SC.app.sendAction( null, null, null ).shouldEqual(false);
|
80
|
-
SC.app.sendAction( false, null, null ).shouldEqual(false);
|
81
|
-
SC.app.sendAction( {}, null, null ).shouldEqual(false);
|
82
|
-
SC.app.sendAction( function(){}, null, null ).shouldEqual(false);
|
83
|
-
},
|
84
|
-
"Should return boolean for whether an action is handled": function()
|
85
|
-
{
|
86
|
-
var leaf1 = SC.page.get('view1').view11.view111;
|
87
|
-
|
88
|
-
leaf1.anActionThatReturnsNothing = this.anActionThatReturnsNothing;
|
89
|
-
leaf1.anActionThatReturnsTrue = this.anActionThatReturnsTrue;
|
90
|
-
leaf1.anActionThatReturnsFalse = this.anActionThatReturnsFalse;
|
91
|
-
leaf1.becomeFirstResponder();
|
92
|
-
|
93
|
-
SC.app.sendAction( "anActionThatReturnsNothing", leaf1, null ).shouldEqual(true);
|
94
|
-
SC.app.sendAction( "anActionThatReturnsTrue", leaf1, null ).shouldEqual(true);
|
95
|
-
|
96
|
-
SC.app.sendAction( "anActionThatReturnsFalse", leaf1, null ).shouldEqual(false);
|
97
|
-
SC.app.sendAction( "anActionThatDoesNotExist", leaf1, null ).shouldEqual(false);
|
98
|
-
},
|
99
|
-
"Should ...": function()
|
100
|
-
{
|
101
|
-
var leaf1 = SC.page.get('view1').view11.view111;
|
102
|
-
var leaf2 = SC.page.get('view1').view12.view121;
|
103
|
-
|
104
|
-
leaf1.bubblingAction = this.anActionThatReturnsNothing;
|
105
|
-
leaf2.bubblingAction = this.anActionThatReturnsNothing;
|
106
|
-
|
107
|
-
leaf1.becomeFirstResponder();
|
108
|
-
},
|
109
|
-
|
110
|
-
setup: function()
|
111
|
-
{
|
112
|
-
this.anActionThatReturnsNothing = function() { this.__action_called__ = true; };
|
113
|
-
this.anActionThatReturnsTrue = function() { this.__action_called__ = true; return true; };
|
114
|
-
this.anActionThatReturnsFalse = function() { this.__action_called__ = true; return false; };
|
115
|
-
SC.page.awake();
|
116
|
-
},
|
117
|
-
teardown: function()
|
118
|
-
{
|
119
|
-
}
|
120
|
-
|
121
|
-
});
|
122
|
-
|
123
|
-
|
124
|
-
</script>
|
125
|
-
<% end %>
|
data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml
DELETED
@@ -1,401 +0,0 @@
|
|
1
|
-
<% # ========================================================================
|
2
|
-
# SC.ClassicView clippingFrame Unit Test
|
3
|
-
#
|
4
|
-
# The clippingFrame tells you what portion of the view is actually visible
|
5
|
-
# on screen. If the view is not on screen or is scrolled out of view,
|
6
|
-
# then the size of the clipping frame will be 0.
|
7
|
-
#
|
8
|
-
# ========================================================================
|
9
|
-
%>
|
10
|
-
<% content_for('final') do %>
|
11
|
-
|
12
|
-
<script>
|
13
|
-
|
14
|
-
VIEW_HEIGHT = 90 ;
|
15
|
-
CHILD_HEIGHT = 150;
|
16
|
-
NESTED_CHILD_HEIGHT = 40 ;
|
17
|
-
|
18
|
-
Test.context("CASE 1: Non-scrollable view - all view fits within content", {
|
19
|
-
|
20
|
-
"child clippingFrame should == child innerFrame": function() {
|
21
|
-
//debugger ;
|
22
|
-
var v = this.v.child ;
|
23
|
-
var f = v.get('frame') ;
|
24
|
-
var cf = v.get('clippingFrame') ;
|
25
|
-
|
26
|
-
SC.rectsEqual(f, cf).shouldEqual(true) ;
|
27
|
-
},
|
28
|
-
|
29
|
-
"resizing child frame should reflect child clippingFrame -also should notify change": function() {
|
30
|
-
var v = this.v.child ;
|
31
|
-
var f = v.get('frame') ;
|
32
|
-
var cf = v.get('clippingFrame') ; // give system a chance to cache
|
33
|
-
|
34
|
-
var didChange = false ;
|
35
|
-
v.addObserver('clippingFrame', function() { didChange = true; }) ;
|
36
|
-
v.set('frame', { width: 50, height: 50 });
|
37
|
-
didChange.shouldEqual(true) ;
|
38
|
-
|
39
|
-
var f = v.get('frame') ;
|
40
|
-
var cf = v.get('clippingFrame') ;
|
41
|
-
SC.rectsEqual(f, cf).shouldEqual(true) ;
|
42
|
-
},
|
43
|
-
|
44
|
-
"resizing parent frame should not change child clippingFrame - also should notify change": function() {
|
45
|
-
var v = this.v.child ;
|
46
|
-
var f = v.get('frame') ;
|
47
|
-
var cf = v.get('clippingFrame') ; // give system a chance to cache
|
48
|
-
|
49
|
-
var didChange = false ;
|
50
|
-
v.addObserver('clippingFrame', function() { didChange = true; }) ;
|
51
|
-
this.v.set('frame', { width: 80, height: 80 }) ;
|
52
|
-
didChange.shouldEqual(true) ;
|
53
|
-
|
54
|
-
|
55
|
-
var nf = v.get('frame') ;
|
56
|
-
var cf = v.get('clippingFrame') ;
|
57
|
-
SC.rectsEqual(nf, f).shouldEqual(false) ;
|
58
|
-
SC.rectsEqual(nf, cf).shouldEqual(true) ;
|
59
|
-
},
|
60
|
-
|
61
|
-
setup: function() { this.v = SC.page.get('case1'); }
|
62
|
-
|
63
|
-
});
|
64
|
-
|
65
|
-
Test.context("CASE 2: A scrollable view - child view cannot fit within visible area", {
|
66
|
-
|
67
|
-
"clippingFrame should reflect only the visible portion of the view": function() {
|
68
|
-
var v = this.v.child ;
|
69
|
-
var cf = v.get('clippingFrame') ;
|
70
|
-
|
71
|
-
var f = v.get('frame') ;
|
72
|
-
f.height = VIEW_HEIGHT ;
|
73
|
-
|
74
|
-
console.log('cf = %@ - f = %@ - pos = %@'.fmt($I(cf), $I(f), v.getStyle('position'))) ;
|
75
|
-
|
76
|
-
SC.rectsEqual(f,cf).shouldEqual(true) ;
|
77
|
-
},
|
78
|
-
|
79
|
-
"scrolling parent frame should change child clippingFrame (and notify)": function() {
|
80
|
-
var child = this.v.child ;
|
81
|
-
var cf = child.get('clippingFrame') ;
|
82
|
-
|
83
|
-
var didChange = false ;
|
84
|
-
child.addObserver('clippingFrame', function() { didChange = true; }) ;
|
85
|
-
|
86
|
-
// scroll
|
87
|
-
this.v.set('scrollFrame', { y: -20 }) ;
|
88
|
-
|
89
|
-
var ncf = child.get('clippingFrame') ;
|
90
|
-
cf.y = 20 ; // adjust expected frame
|
91
|
-
|
92
|
-
SC.rectsEqual(ncf, cf).shouldEqual(true) ;
|
93
|
-
didChange.shouldEqual(true) ;
|
94
|
-
|
95
|
-
this.v.set('scrollFrame', { y: 0 }) ;
|
96
|
-
},
|
97
|
-
|
98
|
-
"resizing parent frame should change child clippingFrame (and notify)": function() {
|
99
|
-
var child = this.v.child ;
|
100
|
-
var cf = child.get('clippingFrame') ;
|
101
|
-
|
102
|
-
var didChange = false ;
|
103
|
-
child.addObserver('clippingFrame', function() { didChange = true; }) ;
|
104
|
-
|
105
|
-
// scroll
|
106
|
-
this.v.set('frame', { height: 50 }) ;
|
107
|
-
|
108
|
-
var ncf = child.get('clippingFrame') ;
|
109
|
-
cf.height = 48 ; // adjust expected frame
|
110
|
-
|
111
|
-
SC.rectsEqual(ncf, cf).shouldEqual(true) ;
|
112
|
-
didChange.shouldEqual(true) ;
|
113
|
-
|
114
|
-
this.v.set('frame', { height: 90 }) ;
|
115
|
-
},
|
116
|
-
|
117
|
-
"resizing child should change clippingFrame (and notify)": function() {
|
118
|
-
var child = this.v.child ;
|
119
|
-
var cf = child.get('clippingFrame') ;
|
120
|
-
|
121
|
-
var didChange = false ;
|
122
|
-
child.addObserver('clippingFrame', function() { didChange = true; }) ;
|
123
|
-
|
124
|
-
// scroll
|
125
|
-
child.set('frame', { height: 50 }) ;
|
126
|
-
|
127
|
-
var ncf = child.get('clippingFrame') ;
|
128
|
-
cf.height = 50 ; // adjust expected frame
|
129
|
-
|
130
|
-
SC.rectsEqual(ncf, cf).shouldEqual(true) ;
|
131
|
-
didChange.shouldEqual(true) ;
|
132
|
-
|
133
|
-
// reset
|
134
|
-
child.set('frame', { height: 152 }) ;
|
135
|
-
},
|
136
|
-
|
137
|
-
"moving child should change clipping frame (and notify)": function() {
|
138
|
-
var child = this.v.child ;
|
139
|
-
var cf = child.get('clippingFrame') ;
|
140
|
-
|
141
|
-
var didChange = false ;
|
142
|
-
child.addObserver('clippingFrame', function() { didChange = true; }) ;
|
143
|
-
|
144
|
-
// scroll
|
145
|
-
child.set('frame', { y: 20 }) ;
|
146
|
-
|
147
|
-
var ncf = child.get('clippingFrame') ;
|
148
|
-
cf.y = 20; cf.height -= 20 ; // adjust expected frame
|
149
|
-
|
150
|
-
SC.rectsEqual(ncf, cf).shouldEqual(true) ;
|
151
|
-
didChange.shouldEqual(true) ;
|
152
|
-
|
153
|
-
// reset
|
154
|
-
child.set('frame', { y: 0 }) ;
|
155
|
-
},
|
156
|
-
|
157
|
-
"moving parent should NOT change child clipping frame": function() {
|
158
|
-
var child = this.v.child ;
|
159
|
-
var cf = child.get('clippingFrame') ;
|
160
|
-
|
161
|
-
// move parent frame -- make sure this does not exceed the parent or
|
162
|
-
// else the clipping frame will be miscalculated.
|
163
|
-
this.v.set('frame', { y: 5 }) ;
|
164
|
-
|
165
|
-
var ncf = child.get('clippingFrame') ;
|
166
|
-
SC.rectsEqual(ncf, cf).shouldEqual(true) ;
|
167
|
-
|
168
|
-
// reset
|
169
|
-
this.v.set('frame', { y: 0 }) ;
|
170
|
-
},
|
171
|
-
|
172
|
-
setup: function() { this.v = SC.page.get('case2'); }
|
173
|
-
|
174
|
-
});
|
175
|
-
|
176
|
-
Test.context("CASE 3: A scrollable view with extra height - nested child view can fit within visible area", {
|
177
|
-
|
178
|
-
"clippingFrame should == frame when view is entirely visible": function() {
|
179
|
-
|
180
|
-
var f = nested.get('frame') ;
|
181
|
-
var cf = nested.get('clippingFrame') ;
|
182
|
-
console.log('%@: f=%@ -- cf=%@'.fmt(nested, $I(f), $I(cf)));
|
183
|
-
SC.rectsEqual(f,cf).shouldEqual(true) ;
|
184
|
-
},
|
185
|
-
|
186
|
-
"clippingFrame should be partial when view is partially scrolled out (and notify)": function() {
|
187
|
-
|
188
|
-
// register observer
|
189
|
-
var didChange = false ;
|
190
|
-
this.nested.addObserver('clippingFrame', function() { didChange = true; }) ;
|
191
|
-
|
192
|
-
// adjust expected. Note that this expects .case .child to be statically positioned
|
193
|
-
// so that clippingFrame is based on .case3.
|
194
|
-
var cf = this.nested.get('clippingFrame') ;
|
195
|
-
cf.y = 30; cf.height -= 20 ;
|
196
|
-
|
197
|
-
// scroll
|
198
|
-
this.v.set('scrollFrame', { y: -30 }) ;
|
199
|
-
|
200
|
-
// collect new frame and compare
|
201
|
-
this.nested._clippingFrame = null ;
|
202
|
-
var ncf = this.nested.get('clippingFrame') ;
|
203
|
-
|
204
|
-
window.case3 = this ;
|
205
|
-
|
206
|
-
console.log("ncf = %@ - cf = %@".fmt($I(ncf), $I(cf))) ;
|
207
|
-
//equals(true, SC.rectsEqual(ncf,cf), 'rectsEqual') ;
|
208
|
-
|
209
|
-
// force notifications
|
210
|
-
equals(true, didChange, 'didChange') ;
|
211
|
-
|
212
|
-
// reset
|
213
|
-
this.v.set('scrollFrame', { y: 0 }) ;
|
214
|
-
},
|
215
|
-
|
216
|
-
"clippingFrame should be 0 height when scroll completely out of view": function() {
|
217
|
-
this.v.set('scrollFrame', { y: -150 }) ;
|
218
|
-
this.nested.get('clippingFrame').height.shouldEqual(0) ;
|
219
|
-
this.v.set('scrollFrame', { y: 0 }) ; // reset
|
220
|
-
},
|
221
|
-
|
222
|
-
"clippingFrame should == frame when moved around within view (and notify)": function() {
|
223
|
-
var of= this.nested.get('frame') ;
|
224
|
-
this.nested.set('frame', { x: 20, y: 20 }) ;
|
225
|
-
|
226
|
-
var f = this.nested.get('frame') ;
|
227
|
-
var cf = this.nested.get('clippingFrame') ;
|
228
|
-
SC.rectsEqual(f,cf).shouldEqual(true) ;
|
229
|
-
|
230
|
-
// reset
|
231
|
-
this.nested.set('frame', of) ;
|
232
|
-
},
|
233
|
-
|
234
|
-
setup: function() {
|
235
|
-
this.v = SC.page.get('case3');
|
236
|
-
this.nested = this.v.child.nestedChild;
|
237
|
-
}
|
238
|
-
|
239
|
-
});
|
240
|
-
|
241
|
-
Test.context("CASE 4: Child view is not actually in window", {
|
242
|
-
|
243
|
-
"clippingFrame should have 0 width or height": function() {
|
244
|
-
|
245
|
-
// get clipping frame to force caching
|
246
|
-
this.child.get('clippingFrame') ;
|
247
|
-
|
248
|
-
// remove child and get clippingFrame again
|
249
|
-
this.child.removeFromParent() ;
|
250
|
-
var cf = this.child.get('clippingFrame') ;
|
251
|
-
cf.width.shouldEqual(0) ;
|
252
|
-
cf.height.shouldEqual(0) ;
|
253
|
-
},
|
254
|
-
|
255
|
-
setup: function() {
|
256
|
-
this.v = SC.page.get('case4');
|
257
|
-
this.child = this.v.child ;
|
258
|
-
}
|
259
|
-
|
260
|
-
});
|
261
|
-
|
262
|
-
|
263
|
-
Test.context("CASE 5: Child view's parent is not actually in window", {
|
264
|
-
|
265
|
-
"clippingFrame should have 0 width of height for nested view": function() {
|
266
|
-
|
267
|
-
// get clipping frame to cause caching
|
268
|
-
this.nested.get('clippingFrame') ;
|
269
|
-
|
270
|
-
this.v.child.removeFromParent() ;
|
271
|
-
var cf = this.nested.get('clippingFrame') ;
|
272
|
-
cf.width.shouldEqual(0) ;
|
273
|
-
cf.height.shouldEqual(0) ;
|
274
|
-
},
|
275
|
-
|
276
|
-
setup: function() {
|
277
|
-
this.v = SC.page.get('case5');
|
278
|
-
this.nested = this.v.child.nestedChild;
|
279
|
-
}
|
280
|
-
|
281
|
-
});
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
main = function() { SC.page.awake(); };
|
286
|
-
|
287
|
-
</script>
|
288
|
-
|
289
|
-
<% end %>
|
290
|
-
|
291
|
-
<% content_for('body') do %>
|
292
|
-
|
293
|
-
<style>
|
294
|
-
|
295
|
-
.case {
|
296
|
-
background-color: white;
|
297
|
-
position: absolute;
|
298
|
-
width: 190px;
|
299
|
-
height: 90px;
|
300
|
-
border: 1px blue solid;
|
301
|
-
overflow: auto;
|
302
|
-
border-left-width: 5px;
|
303
|
-
}
|
304
|
-
|
305
|
-
.case .child {
|
306
|
-
border: 1px red solid;
|
307
|
-
}
|
308
|
-
|
309
|
-
.case .nested_child {
|
310
|
-
border: 1px green solid;
|
311
|
-
width: 40px;
|
312
|
-
height: 40px;
|
313
|
-
position: absolute;
|
314
|
-
top: 10px;
|
315
|
-
left: 10px;
|
316
|
-
}
|
317
|
-
|
318
|
-
.base {
|
319
|
-
float: left;
|
320
|
-
width: 200px;
|
321
|
-
height: 100px;
|
322
|
-
border: 1px #aaa solid;
|
323
|
-
position: relative;
|
324
|
-
margin: 2px;
|
325
|
-
}
|
326
|
-
|
327
|
-
.cases {
|
328
|
-
position: absolute;
|
329
|
-
bottom: 0 ;
|
330
|
-
left: 0;
|
331
|
-
right: 0;
|
332
|
-
border-top: 1px #ccc solid;
|
333
|
-
}
|
334
|
-
|
335
|
-
.base label {
|
336
|
-
position: absolute;
|
337
|
-
bottom: 4px;
|
338
|
-
left: 4px;
|
339
|
-
}
|
340
|
-
|
341
|
-
.case1 .child { width: 60px; height: 60px; }
|
342
|
-
|
343
|
-
.case2 .child,
|
344
|
-
.case4 .child {
|
345
|
-
position: relative;
|
346
|
-
height: 150px;
|
347
|
-
}
|
348
|
-
|
349
|
-
/* case3 child is statically positioned, so offset parent of nested child should be .case3 */
|
350
|
-
.case3 .child,
|
351
|
-
.case5 .child {
|
352
|
-
height: 150px;
|
353
|
-
}
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
</style>
|
358
|
-
|
359
|
-
<div class="cases">
|
360
|
-
<div class="base">
|
361
|
-
<label>Case 1</label>
|
362
|
-
<% view :case1, :class => 'case' do %>
|
363
|
-
<%= view :child, :outlet => true, :inner_html => 'Child', :properties => { :needs_clipping_frame => true } %>
|
364
|
-
<% end %>
|
365
|
-
</div>
|
366
|
-
|
367
|
-
<div class="base">
|
368
|
-
<label>Case 2</label>
|
369
|
-
<% view :case2, :class => 'case', :properties => { :is_scrollable => true } do %>
|
370
|
-
<%= view :child, :outlet => true, :inner_html => 'Child', :properties => { :needs_clipping_frame => true } %>
|
371
|
-
<% end %>
|
372
|
-
</div>
|
373
|
-
|
374
|
-
<div class="base">
|
375
|
-
<label>Case 3</label>
|
376
|
-
<% view :case3, :class => 'case', :properties => { :is_scrollable => true } do %>
|
377
|
-
<% view :child, :outlet => true do %>
|
378
|
-
<%= view :nested_child, :outlet => true, :inner_html => 'Nested Child', :properties => { :needs_clipping_frame => true } %>
|
379
|
-
<% end %>
|
380
|
-
<% end %>
|
381
|
-
</div>
|
382
|
-
|
383
|
-
<div class="base">
|
384
|
-
<label>Case 4</label>
|
385
|
-
<% view :case4, :class => 'case', :properties => { :is_scrollable => true } do %>
|
386
|
-
<%= view :child, :outlet => true, :inner_html => 'Child', :properties => { :needs_clipping_frame => true } %>
|
387
|
-
<% end %>
|
388
|
-
</div>
|
389
|
-
|
390
|
-
<div class="base">
|
391
|
-
<label>Case 5</label>
|
392
|
-
<% view :case5, :class => 'case', :properties => { :is_scrollable => true } do %>
|
393
|
-
<% view :child, :outlet => true do %>
|
394
|
-
<%= view :nested_child, :outlet => true, :inner_html => 'Nested Child', :properties => { :needs_clipping_frame => true } %>
|
395
|
-
<% end %>
|
396
|
-
<% end %>
|
397
|
-
</div>
|
398
|
-
|
399
|
-
</div>
|
400
|
-
|
401
|
-
<% end %>
|