sproutcore 1.10.0.rc.3 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION.yml +1 -1
  3. data/lib/buildtasks/manifest.rake +3 -2
  4. data/lib/frameworks/sproutcore/Buildfile +3 -1
  5. data/lib/frameworks/sproutcore/CHANGELOG.md +26 -2
  6. data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +3 -0
  7. data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +1 -1
  8. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +3 -0
  9. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +5 -5
  10. data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +9 -0
  11. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +2 -2
  12. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +6 -0
  13. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +17 -55
  14. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +57 -0
  15. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/isVisible.js +24 -0
  16. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +31 -13
  17. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +8 -5
  18. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +24 -20
  19. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +39 -29
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +400 -242
  21. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +37 -32
  22. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -8
  23. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +3 -2
  24. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +4 -5
  25. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +53 -6
  26. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +9 -3
  27. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -1
  28. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +16 -12
  29. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +16 -2
  30. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +10 -8
  31. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +102 -0
  32. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/password.js +15 -7
  33. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -2
  34. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +4 -0
  35. data/lib/frameworks/sproutcore/phantomjs/minimist.js +181 -0
  36. data/lib/frameworks/sproutcore/phantomjs/q.js +1937 -0
  37. data/lib/frameworks/sproutcore/phantomjs/test_runner.js +733 -0
  38. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +2 -2
  39. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/button.css +11 -11
  40. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/button.css +5 -5
  41. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/jumbo/button.css +3 -3
  42. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/small/button.css +3 -3
  43. data/lib/frameworks/sproutcore/themes/ace/resources/button/popup/select.css +1 -1
  44. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/checkbox.css +3 -3
  45. data/lib/frameworks/sproutcore/themes/ace/resources/collection/source-list/source_list_view.css +4 -4
  46. data/lib/frameworks/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +6 -6
  47. data/lib/frameworks/sproutcore/themes/ace/resources/imagebutton/ace/imagebutton.css +5 -5
  48. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +16 -16
  49. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +42 -42
  50. data/lib/frameworks/sproutcore/themes/ace/resources/progress/ace/progress.css +19 -19
  51. data/lib/frameworks/sproutcore/themes/ace/resources/radio/radio.css +12 -12
  52. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal.css +7 -7
  53. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_touch.css +18 -18
  54. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical.css +8 -8
  55. data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_touch.css +16 -16
  56. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +2 -2
  57. data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +13 -13
  58. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/slider.css +11 -11
  59. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/slider.css +11 -11
  60. data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/slider.css +11 -11
  61. data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +6 -6
  62. data/lib/frameworks/sproutcore/themes/ace/resources/toolbar/toolbar.css +2 -2
  63. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/button.css +3 -3
  64. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/button.css +18 -18
  65. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/checkbox.css +7 -7
  66. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/collection.css +2 -2
  67. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/core.css +7 -7
  68. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/disclosure.css +3 -3
  69. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/list_item.css +4 -4
  70. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/menu.css +3 -3
  71. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/menu_item_view.css +5 -5
  72. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/panel.css +7 -7
  73. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/picker.css +3 -3
  74. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/progress.css +5 -5
  75. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/radio.css +4 -4
  76. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/scroller.css +3 -3
  77. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/segmented.css +7 -7
  78. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/slider.css +2 -2
  79. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/split_view.css +2 -2
  80. data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/toolbar.css +3 -3
  81. data/lib/sproutcore/tools/server.rb +9 -3
  82. metadata +8 -83
  83. data/lib/frameworks/sproutcore/design/Assorted Images/sproutcore-startup-landscape.jpg +0 -0
  84. data/lib/frameworks/sproutcore/design/Assorted Images/sproutcore-startup-landscape.png +0 -0
  85. data/lib/frameworks/sproutcore/design/Assorted Images/sproutcore-startup-portrait.jpg +0 -0
  86. data/lib/frameworks/sproutcore/design/Assorted Images/sproutcore-startup-portrait.png +0 -0
  87. data/lib/frameworks/sproutcore/design/Assorted Images/sproutcore-startup.png +0 -0
  88. data/lib/frameworks/sproutcore/design/Record State Table.numbers +0 -0
  89. data/lib/frameworks/sproutcore/design/greenhouse-statechart.pdf +0 -0
  90. data/lib/frameworks/sproutcore/tests/phantomjs_runner.phantomjs +0 -611
  91. data/lib/frameworks/sproutcore/themes/ace/designs/dark.png +0 -0
  92. data/lib/frameworks/sproutcore/themes/ace/designs/light.png +0 -0
  93. data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/PanelPane.opacity +0 -0
  94. data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/Pointers.opacity +0 -0
  95. data/lib/frameworks/sproutcore/themes/ace/designs/switch/switch_handle.png +0 -0
  96. data/lib/frameworks/sproutcore/themes/ace/designs/switch/switch_off.png +0 -0
  97. data/lib/frameworks/sproutcore/themes/ace/designs/switch/switch_on.png +0 -0
  98. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/10.png +0 -0
  99. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/100.png +0 -0
  100. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/102.png +0 -0
  101. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/110.png +0 -0
  102. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/120.png +0 -0
  103. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/127.png +0 -0
  104. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/18.png +0 -0
  105. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/19.png +0 -0
  106. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/2.png +0 -0
  107. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/24.png +0 -0
  108. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/26.png +0 -0
  109. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/27.png +0 -0
  110. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/28.png +0 -0
  111. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/29.png +0 -0
  112. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/30.png +0 -0
  113. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/31.png +0 -0
  114. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/33.png +0 -0
  115. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/37.png +0 -0
  116. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/41.png +0 -0
  117. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/16/99.png +0 -0
  118. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/10.png +0 -0
  119. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/100.png +0 -0
  120. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/102.png +0 -0
  121. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/110.png +0 -0
  122. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/120.png +0 -0
  123. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/127.png +0 -0
  124. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/18.png +0 -0
  125. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/19.png +0 -0
  126. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/2.png +0 -0
  127. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/24.png +0 -0
  128. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/26.png +0 -0
  129. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/27.png +0 -0
  130. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/28.png +0 -0
  131. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/29.png +0 -0
  132. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/30.png +0 -0
  133. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/31.png +0 -0
  134. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/33.png +0 -0
  135. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/37.png +0 -0
  136. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/41.png +0 -0
  137. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/24/99.png +0 -0
  138. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/10.png +0 -0
  139. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/100.png +0 -0
  140. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/102.png +0 -0
  141. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/110.png +0 -0
  142. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/120.png +0 -0
  143. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/127.png +0 -0
  144. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/18.png +0 -0
  145. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/19.png +0 -0
  146. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/2.png +0 -0
  147. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/24.png +0 -0
  148. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/26.png +0 -0
  149. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/27.png +0 -0
  150. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/28.png +0 -0
  151. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/29.png +0 -0
  152. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/30.png +0 -0
  153. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/31.png +0 -0
  154. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/33.png +0 -0
  155. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/37.png +0 -0
  156. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/41.png +0 -0
  157. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/32/99.png +0 -0
  158. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/48/10.png +0 -0
  159. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/48/18.png +0 -0
  160. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/48/19.png +0 -0
  161. data/lib/frameworks/sproutcore/themes/legacy_theme/Source/icons/48/2.png +0 -0
@@ -40,6 +40,42 @@ sc_require('system/query');
40
40
  SC.Record = SC.Object.extend(
41
41
  /** @scope SC.Record.prototype */ {
42
42
 
43
+ //@if(debug)
44
+ /* BEGIN DEBUG ONLY PROPERTIES AND METHODS */
45
+ /** @private
46
+ Creates string representation of record, with status.
47
+
48
+ @returns {String}
49
+ */
50
+
51
+ toString: function() {
52
+ // We won't use 'readOnlyAttributes' here because accessing them directly
53
+ // avoids a SC.clone() -- we'll be careful not to edit anything.
54
+ var attrs = this.get('store').readDataHash(this.get('storeKey'));
55
+ return "%@(%@) %@".fmt(this.constructor.toString(), SC.inspect(attrs), this.statusString());
56
+ },
57
+
58
+ /** @private
59
+ Creates string representation of record, with status.
60
+
61
+ @returns {String}
62
+ */
63
+
64
+ statusString: function() {
65
+ var ret = [], status = this.get('status');
66
+
67
+ for(var prop in SC.Record) {
68
+ if(prop.match(/[A-Z_]$/) && SC.Record[prop]===status) {
69
+ ret.push(prop);
70
+ }
71
+ }
72
+
73
+ return ret.join(" ");
74
+ },
75
+
76
+ /* END DEBUG ONLY PROPERTIES AND METHODS */
77
+ //@endif
78
+
43
79
  /**
44
80
  Walk like a duck
45
81
 
@@ -814,37 +850,6 @@ SC.Record = SC.Object.extend(
814
850
  return sc_super();
815
851
  },
816
852
 
817
- /** @private
818
- Creates string representation of record, with status.
819
-
820
- @returns {String}
821
- */
822
-
823
- toString: function() {
824
- // We won't use 'readOnlyAttributes' here because accessing them directly
825
- // avoids a SC.clone() -- we'll be careful not to edit anything.
826
- var attrs = this.get('store').readDataHash(this.get('storeKey'));
827
- return "%@(%@) %@".fmt(this.constructor.toString(), SC.inspect(attrs), this.statusString());
828
- },
829
-
830
- /** @private
831
- Creates string representation of record, with status.
832
-
833
- @returns {String}
834
- */
835
-
836
- statusString: function() {
837
- var ret = [], status = this.get('status');
838
-
839
- for(var prop in SC.Record) {
840
- if(prop.match(/[A-Z_]$/) && SC.Record[prop]===status) {
841
- ret.push(prop);
842
- }
843
- }
844
-
845
- return ret.join(" ");
846
- },
847
-
848
853
  /**
849
854
  Registers a child record with this parent record.
850
855
 
@@ -1501,4 +1506,4 @@ SC.Record.mixin( /** @scope SC.Record */ {
1501
1506
  if(SC.Query) SC.Query._scq_didDefineRecordType(ret);
1502
1507
  return ret ;
1503
1508
  }
1504
- }) ;
1509
+ });
@@ -580,17 +580,10 @@ SC.RecordAttribute.registerTransform(Date, {
580
580
  });
581
581
 
582
582
  if (SC.DateTime && !SC.RecordAttribute.transforms[SC.guidFor(SC.DateTime)]) {
583
+
583
584
  /**
584
585
  Registers a transform to allow `SC.DateTime` to be used as a record
585
586
  attribute, ie `SC.Record.attr(SC.DateTime);`
586
-
587
- Because `SC.RecordAttribute` is in the datastore framework and
588
- `SC.DateTime` in the foundation framework, and we don't know which
589
- framework is being loaded first, this chunck of code is duplicated in
590
- both frameworks.
591
-
592
- IF YOU EDIT THIS CODE MAKE SURE YOU COPY YOUR CHANGES to
593
- `record_attribute.js.`
594
587
  */
595
588
 
596
589
  SC.RecordAttribute.registerTransform(SC.DateTime, {
@@ -90,9 +90,10 @@ SC.ModalPane = SC.Pane.extend(
90
90
  */
91
91
  _hideShowTextfields: function(pane, focusable){
92
92
  var view;
93
- for(view in SC.View.views){
93
+
94
+ for (view in SC.View.views) {
94
95
  view = SC.View.views[view];
95
- if (view!==pane && view.get('pane')===pane && view.get('isTextField')){
96
+ if (view.get('isTextField') && view !== pane && view.get('pane') === pane) {
96
97
  if (focusable) {
97
98
  // Setting isBrowserFocusable back to YES. If we cached the previous
98
99
  // value, use that instead.
@@ -201,11 +201,10 @@ SC.PanelPane = SC.Pane.extend(
201
201
  _isModalDidChange: function() {
202
202
  var pane, isModal = this.get('isModal');
203
203
  if (isModal) {
204
- if (!this._isShowingModal && this.get('isVisibleInWindow') && (pane = this._modalPane())) {
205
- this._isShowingModal = YES;
206
- pane.paneWillAppend(this);
207
- }
208
-
204
+ if (!this._isShowingModal && this.get('viewState') & SC.CoreView.IS_SHOWN && (pane = this._modalPane())) {
205
+ this._isShowingModal = YES;
206
+ pane.paneWillAppend(this);
207
+ }
209
208
  } else {
210
209
  if (this._isShowingModal && (pane = this._modalPane())) {
211
210
  this._isShowingModal = NO ;
@@ -14,8 +14,7 @@ var pane ;
14
14
  test("verify panel content container is visible at correct location with right size", function() {
15
15
  pane = SC.PanelPane.create({
16
16
  layout: { width: 400, height: 200, centerX: 0, centerY: 0 },
17
- contentView: SC.View.extend({
18
- })
17
+ contentView: SC.View
19
18
  });
20
19
  pane.append();
21
20
 
@@ -42,8 +41,7 @@ test("verify panel content container is visible at correct location with right s
42
41
  test("Verify panel pane has aria role set", function() {
43
42
  var pane = SC.PanelPane.create({
44
43
  layout: { width: 400, height: 200, centerX: 0, centerY: 0 },
45
- contentView: SC.View.extend({
46
- })
44
+ contentView: SC.View
47
45
  });
48
46
  pane.append();
49
47
 
@@ -56,8 +54,7 @@ test("Verify panel pane has aria role set", function() {
56
54
  test("Verify panel pane has aria-label attribute set, when ariaLabel is provided", function() {
57
55
  var pane = SC.PanelPane.create({
58
56
  layout: { width: 400, height: 200, centerX: 0, centerY: 0 },
59
- contentView: SC.View.extend({
60
- }),
57
+ contentView: SC.View,
61
58
  ariaLabel: "Panel is labelled by this value for voiceover"
62
59
  });
63
60
  pane.append();
@@ -68,3 +65,53 @@ test("Verify panel pane has aria-label attribute set, when ariaLabel is provided
68
65
  pane.destroy();
69
66
  });
70
67
 
68
+ test("Verify panel pane's modal pane lifecycle", function() {
69
+ var pane = SC.PanelPane.create({
70
+ contentView: SC.View,
71
+ modalPane: SC.ModalPane,
72
+ isModal: YES
73
+ });
74
+ ok(pane.get('modalPane').isClass, "Modal pane class is not instantiated before is panel is appended.");
75
+ pane.append();
76
+ var modal = pane.get('modalPane');
77
+ ok(!modal.isClass, "Modal pane class is instantiated when the panel is appended.");
78
+ ok(modal.get('viewState') === SC.CoreView.ATTACHED_SHOWN, "Modal pane appends when panel pane is appended.");
79
+ pane.remove();
80
+ ok(modal.get('viewState') & SC.CoreView.UNATTACHED, "Modal pane is removed when panel pane is removed.");
81
+ pane.destroy();
82
+ ok(modal.get('isDestroyed'), "Modal pane is destroyed when its panel pane is destroyed.");
83
+
84
+ });
85
+
86
+ test("Verify SC.PanelPane#isModal", function() {
87
+ SC.RunLoop.begin();
88
+ var pane = SC.PanelPane.create({
89
+ contentView: SC.View,
90
+ modalPane: SC.ModalPane.create(),
91
+ isModal: NO
92
+ });
93
+ pane.append();
94
+ equals(pane.getPath('modalPane.viewState'), SC.CoreView.UNRENDERED, "Panel pane does not use modal pane when isModal is NO");
95
+ pane.set('isModal', YES);
96
+ equals(pane.getPath('modalPane.viewState'), SC.CoreView.ATTACHED_SHOWN, "Panel pane appends modal pane when isModal becomes YES");
97
+ pane.set('isModal', NO);
98
+ equals(pane.getPath('modalPane.viewState'), SC.CoreView.UNATTACHED, "Panel pane removes modal pane when isModal becomes NO");
99
+
100
+
101
+ pane.destroy()
102
+
103
+ // Tests an edge case where isModal turns YES during a transition out.
104
+ pane = SC.PanelPane.create({
105
+ contentView: SC.View,
106
+ modalPane: SC.ModalPane.create(),
107
+ isModal: NO,
108
+ transitionOut: SC.View.FADE_OUT,
109
+ transitionOutOptions: { duration: 0.1 }
110
+ });
111
+ pane.append();
112
+ pane.remove(); // trigger transition and then willRemoveFromDocument
113
+ pane.set('isModal', YES);
114
+ equals(pane.getPath('modalPane.viewState'), SC.CoreView.UNRENDERED, "Panel pane does not add modal pane when isModal becomes YES while transitioning out");
115
+ pane.destroy();
116
+ SC.RunLoop.end();
117
+ });
@@ -2781,7 +2781,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2781
2781
 
2782
2782
  /**
2783
2783
  Implements the SC.DropTarget protocol. Hides any visible insertion
2784
- point and clears some cached values.
2784
+ point and clears some cached values.
2785
2785
  */
2786
2786
  dragExited: function () {
2787
2787
  this.hideInsertionPoint();
@@ -2945,6 +2945,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2945
2945
  };
2946
2946
  },
2947
2947
 
2948
+ /* @private Internal property used to track the rate of touch scroll change events. */
2949
+ _lastTouchScrollTime: null,
2950
+
2948
2951
  /** @private SC.ScrollView */
2949
2952
  touchScrollDidChange: function (left, top) {
2950
2953
  // Fast path! Don't try to update too soon.
@@ -2958,8 +2961,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2958
2961
 
2959
2962
  // Indicate that nowShowing should be re-computed (this will use the
2960
2963
  // in-scroll clipping frame when it does).
2961
- this.notifyPropertyChange('nowShowing');
2962
- this.invokeOnce('_cv_nowShowingDidChange');
2964
+ // TODO: perform a raw update that doesn't require the run loop.
2965
+ SC.run(function () {
2966
+ this.notifyPropertyChange('nowShowing');
2967
+ this.invokeOnce('_cv_nowShowingDidChange');
2968
+ }, this);
2963
2969
 
2964
2970
  // Track the last time we updated.
2965
2971
  this._lastTouchScrollTime = Date.now();
@@ -257,7 +257,7 @@ SC.GridView = SC.ListView.extend(
257
257
 
258
258
  // A change to the width of the frame is the only variable that
259
259
  // alters the layout of item views and our computed layout.
260
- if (lastFrameWidth && width !== lastFrameWidth) {
260
+ if (!SC.none(lastFrameWidth) && width !== lastFrameWidth) {
261
261
  var itemView,
262
262
  nowShowing = this.get('nowShowing');
263
263
 
@@ -1166,13 +1166,14 @@ SC.ScrollView = SC.View.extend({
1166
1166
  needsScrollEnd = NO,
1167
1167
  contentWidth = 0,
1168
1168
  contentHeight = 0,
1169
+ existingTouch = this.touch,
1169
1170
  viewFrame,
1170
1171
  view;
1171
1172
 
1172
- if (this.touch && this.touch.timeout) {
1173
- // clear the timeout
1174
- clearTimeout(this.touch.timeout);
1175
- this.touch.timeout = null;
1173
+ if (existingTouch && !SC.none(existingTouch.animationID)) {
1174
+ // If a deceleration calculation is queued to run, we need to cancel it so
1175
+ // it doesn't run after we begin touch tracking again.
1176
+ window.cancelAnimationFrame(existingTouch.animationID);
1176
1177
 
1177
1178
  // get the scroll offsets
1178
1179
  startClipOffsetX = this.touch.startClipOffset.x;
@@ -1295,6 +1296,7 @@ SC.ScrollView = SC.View.extend({
1295
1296
  /** @private */
1296
1297
  touchesDragged: function (evt) {
1297
1298
  var avg = evt.averagedTouchesForView(this);
1299
+
1298
1300
  this.updateTouchScroll(avg.x, avg.y, avg.d, evt.timeStamp);
1299
1301
  },
1300
1302
 
@@ -1484,7 +1486,7 @@ SC.ScrollView = SC.View.extend({
1484
1486
  var touchStatus = this.touch;
1485
1487
 
1486
1488
  // if we are decelerating, we don't want to stop that. That would be bad. Because there's no point.
1487
- if (!touchStatus || !touchStatus.timeout) {
1489
+ if (!touchStatus || !touchStatus.animationID) {
1488
1490
  this.beginPropertyChanges();
1489
1491
  this.set("scale", this._scale);
1490
1492
  this.set("verticalScrollOffset", this._scroll_verticalScrollOffset);
@@ -1509,7 +1511,7 @@ SC.ScrollView = SC.View.extend({
1509
1511
  y: touch.scrollVelocity.y * 10
1510
1512
  };
1511
1513
 
1512
- window.requestAnimationFrame(function () {
1514
+ touch.animationID = window.requestAnimationFrame(function () {
1513
1515
  self.decelerateAnimation();
1514
1516
  });
1515
1517
  },
@@ -1547,7 +1549,7 @@ SC.ScrollView = SC.View.extend({
1547
1549
  return velocity;
1548
1550
  },
1549
1551
 
1550
- /** @private */
1552
+ /** @private Decelerates the scrolling smoothly. */
1551
1553
  decelerateAnimation: function () {
1552
1554
  // get a bunch of properties. They are named well, so not much explanation of what they are...
1553
1555
  // However, note maxOffsetX/Y takes into account the scale;
@@ -1689,8 +1691,8 @@ SC.ScrollView = SC.View.extend({
1689
1691
  var absXVelocity = Math.abs(touch.decelerationVelocity.x),
1690
1692
  absYVelocity = Math.abs(touch.decelerationVelocity.y);
1691
1693
  if (absYVelocity < 0.05 && absXVelocity < 0.05 && Math.abs(sv) < 0.05) {
1692
- // we can reset the timeout, as it will no longer be required, and we don't want to re-cancel it later.
1693
- touch.timeout = null;
1694
+ // We can reset the animation id, as it will no longer be required, and we don't want to accidentally try to cancel it later.
1695
+ touch.animationID = null;
1694
1696
  this.touch = null;
1695
1697
 
1696
1698
  // trigger scroll end
@@ -1710,11 +1712,13 @@ SC.ScrollView = SC.View.extend({
1710
1712
  // We now set up the next round. We are doing this as raw as we possibly can, not touching the
1711
1713
  // run loop at all. This speeds up performance drastically--keep in mind, we're on comparatively
1712
1714
  // slow devices, here. So, we'll just make a closure, saving "this" into "self" and calling
1713
- // 10ms later (or however long it takes). Note also that we save both the last event time
1714
- // (so we may calculate elapsed time) and the timeout we are creating, so we may cancel it in future.
1715
+ // 10ms later (or however long it takes).
1716
+
1717
+ // Note also that we save both the last event time (so we may calculate elapsed time) and the animation
1718
+ // id we are creating, so we may cancel it in future.
1715
1719
  var self = this;
1716
1720
  touch.lastEventTime = Date.now();
1717
- window.requestAnimationFrame(function () {
1721
+ touch.animationID = window.requestAnimationFrame(function () {
1718
1722
  SC.run(self.decelerateAnimation(), self);
1719
1723
  });
1720
1724
  },
@@ -357,12 +357,26 @@ SC.ScrollerView = SC.View.extend(
357
357
 
358
358
  /** @private */
359
359
  touchScrollDidEnd: function(value) {
360
- this.set("_touchScrollValue", NO);
360
+ SC.run(function () {
361
+ this.set("_touchScrollValue", NO);
362
+ }, this);
361
363
  },
362
364
 
365
+ /* @private Internal property used to track the rate of touch scroll change events. */
366
+ _lastTouchScrollTime: null,
367
+
363
368
  /** @private */
364
369
  touchScrollDidChange: function(value) {
365
- this.set("_touchScrollValue", value);
370
+ // Fast path! Don't try to update too soon.
371
+ if (Date.now() - this._lastTouchScrollTime < 30) { return; }
372
+
373
+ // TODO: perform a raw update that doesn't require the run loop.
374
+ SC.run(function () {
375
+ this.set("_touchScrollValue", value);
376
+ }, this);
377
+
378
+ // Track the last time we updated.
379
+ this._lastTouchScrollTime = Date.now();
366
380
  },
367
381
 
368
382
  // ..........................................................
@@ -156,12 +156,14 @@ SC.AutoResize = {
156
156
  */
157
157
  measuredSizeDidChange: function() {
158
158
  var measuredSize = this.get('measuredSize'),
159
- calculatedWidth = measuredSize.width, calculatedHeight = measuredSize.height,
160
- paddingHeight, paddingWidth,
161
- autoResizePadding = this.get('autoResizePadding') || 0,
162
- maxWidth = this.get('maxWidth'), maxHeight = this.get('maxHeight');
163
-
164
- if(SC.typeOf(autoResizePadding) === SC.T_NUMBER) {
159
+ calculatedWidth = measuredSize.width,
160
+ calculatedHeight = measuredSize.height,
161
+ paddingHeight, paddingWidth,
162
+ autoResizePadding = this.get('autoResizePadding') || 0,
163
+ maxWidth = this.get('maxWidth'),
164
+ maxHeight = this.get('maxHeight');
165
+
166
+ if (SC.typeOf(autoResizePadding) === SC.T_NUMBER) {
165
167
  paddingHeight = paddingWidth = autoResizePadding;
166
168
  } else {
167
169
  paddingHeight = autoResizePadding.height;
@@ -171,7 +173,7 @@ SC.AutoResize = {
171
173
  calculatedHeight += paddingHeight;
172
174
  calculatedWidth += paddingWidth;
173
175
 
174
- if(this.get('shouldAutoResize')) {
176
+ if (this.get('shouldAutoResize')) {
175
177
  // if we are allowed to autoresize, adjust the layout
176
178
  if (this.get('shouldResizeWidth')) {
177
179
  if (maxWidth && calculatedWidth > maxWidth) {
@@ -254,7 +256,7 @@ SC.AutoResize = {
254
256
  cachedMetrics = this.get('_cachedMetrics'),
255
257
  maxFontSize = this.get('maxFontSize');
256
258
 
257
- if(!layer) return;
259
+ if (!layer) return;
258
260
 
259
261
  // There are three special cases.
260
262
  // - size is cached: the cached size is used with no measurement
@@ -0,0 +1,102 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2011 Strobe Inc. and contributors.
4
+ // ©2008-2011 Apple Inc. All rights reserved.
5
+ // License: Licensed under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ /*global module, test, equals,ok */
9
+
10
+ var view;
11
+
12
+ /** Test the SC.View states. */
13
+ module("SC.AutoResize", {
14
+
15
+ setup: function () {
16
+ view = SC.LabelView.create(SC.AutoResize, {
17
+ layout: { left: 0, height: 40},
18
+ value: "The bottom line, Williams said, is that the internet is “a giant machine designed to give people what they want.” It’s not a utopia. It’s not magical. It’s simply an engine of convenience. Those who can tune that engine well — who solve basic human problems with greater speed and simplicity than those who came before — will profit immensely. Those who lose sight of basic human needs — who want to give people the next great idea — will have problems. “We often think of the internet enables you to do new things,” Williams said. “But people just want to do the same things they’ve always done.”"
19
+ });
20
+ },
21
+
22
+ teardown: function () {
23
+ view.destroy();
24
+ view = null;
25
+ }
26
+
27
+ });
28
+
29
+ test("Resize with transition plugin - no conflict", function () {
30
+ stop(700);
31
+
32
+ var pane = SC.Pane.create({
33
+ layout: { top: 200, left: 0, width: 200, height: 200 }
34
+ });
35
+
36
+ view.set('transitionIn', SC.View.SLIDE_IN);
37
+
38
+ SC.run(function () {
39
+ pane.appendChild(view);
40
+ equals(view.get('layout').width, 10, 'width is');
41
+ equals(view.get('layout').left, 0, 'left is');
42
+ pane.append();
43
+ });
44
+
45
+ setTimeout(function () {
46
+ ok(view.get('layout').width > 2000, 'width is > 2000');
47
+ equals(view.get('layout').left, 0, 'left is');
48
+
49
+ pane.destroy();
50
+ pane.remove();
51
+
52
+ start();
53
+ }, 500);
54
+ });
55
+
56
+ test("Resize with transition plugin - conflict", function () {
57
+ stop(2000);
58
+
59
+ var pane = SC.Pane.create({
60
+ layout: { top: 200, left: 0, width: 200, height: 200 }
61
+ });
62
+
63
+ view.set('transitionIn', {
64
+ setup: function (view, options, finalLayout, finalFrame) {
65
+ view.adjust({ width: 100 });
66
+ },
67
+
68
+ // Width transition plugin.
69
+ run: function (view, options, finalLayout, finalFrame) {
70
+ view.animate('width', finalFrame.width, { duration: 0.5 }, function (data) {
71
+ this.didTransitionIn();
72
+ });
73
+ }
74
+ });
75
+
76
+ SC.run(function () {
77
+ pane.appendChild(view);
78
+ equals(view.get('layout').width, 10, 'width is');
79
+ pane.append();
80
+ });
81
+
82
+ setTimeout(function () {
83
+ var jqEl = view.$();
84
+
85
+ ok(jqEl.width() > 10, 'width is > 10: %@'.fmt(jqEl.width()));
86
+ ok(jqEl.width() < 3000, 'width is < 3000: %@'.fmt(jqEl.width()));
87
+ ok(view.get('layout').width > 3000, 'layout.width is > 3000: %@'.fmt(view.get('layout').width));
88
+ }, 200);
89
+
90
+ setTimeout(function () {
91
+ var jqEl = view.$();
92
+ ok(jqEl.width() > 3000, 'width is > 3000: %@'.fmt(jqEl.width()));
93
+ ok(view.get('layout').width > 3000, 'width is > 3000: %@'.fmt(view.get('layout').width));
94
+
95
+ SC.run(function () {
96
+ pane.destroy();
97
+ pane.remove();
98
+ });
99
+
100
+ start();
101
+ }, 700);
102
+ });