sproutcore 1.0.1037 → 1.0.1042

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/History.txt +31 -0
  2. data/README.txt +3 -1
  3. data/Rakefile +11 -4
  4. data/VERSION.yml +3 -3
  5. data/buildtasks/build.rake +5 -0
  6. data/frameworks/sproutcore/Buildfile +3 -1
  7. data/frameworks/sproutcore/frameworks/animation/Buildfile +3 -0
  8. data/frameworks/sproutcore/frameworks/animation/LICENSE +25 -0
  9. data/frameworks/sproutcore/frameworks/animation/README.md +102 -0
  10. data/frameworks/sproutcore/frameworks/animation/core.js +934 -0
  11. data/frameworks/sproutcore/frameworks/animation/tests/core.js +65 -0
  12. data/frameworks/sproutcore/frameworks/datastore/models/record.js +28 -16
  13. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +5 -2
  14. data/frameworks/sproutcore/frameworks/datastore/system/many_array.js +4 -0
  15. data/frameworks/sproutcore/frameworks/datastore/system/query.js +27 -13
  16. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +36 -6
  17. data/frameworks/sproutcore/frameworks/datastore/system/store.js +7 -7
  18. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +2 -1
  19. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +13 -0
  20. data/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +250 -0
  21. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -12
  22. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +3 -6
  23. data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -8
  24. data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -4
  25. data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +1 -0
  26. data/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -1
  27. data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
  28. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -1
  29. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +11 -4
  30. data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +2 -0
  31. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -5
  32. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +24 -23
  33. data/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +91 -60
  34. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +124 -24
  35. data/frameworks/sproutcore/frameworks/desktop/system/drag.js +5 -5
  36. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +33 -25
  37. data/frameworks/sproutcore/frameworks/desktop/tests/panes/pane_page.js +41 -0
  38. data/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/methods.js +30 -1
  39. data/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +13 -0
  40. data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +27 -21
  41. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +81 -1
  42. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +3 -4
  43. data/frameworks/sproutcore/frameworks/desktop/views/button.js +65 -36
  44. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +4 -7
  45. data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +8 -4
  46. data/frameworks/sproutcore/frameworks/desktop/views/list.js +1 -1
  47. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +38 -5
  48. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +5 -1
  49. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -1
  50. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +19 -13
  51. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +30 -2
  52. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +2 -3
  53. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +14 -17
  54. data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +5 -3
  55. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -2
  56. data/frameworks/sproutcore/frameworks/desktop/views/split.js +58 -59
  57. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -1
  58. data/frameworks/sproutcore/frameworks/desktop/views/well.js +1 -1
  59. data/frameworks/sproutcore/frameworks/foundation/core.js +6 -0
  60. data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +2 -1
  61. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +33 -30
  62. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +8 -4
  63. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +15 -10
  64. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +61 -12
  65. data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +2 -1
  66. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +151 -131
  67. data/frameworks/sproutcore/frameworks/foundation/system/datetime.js +29 -23
  68. data/frameworks/sproutcore/frameworks/foundation/system/event.js +18 -10
  69. data/frameworks/sproutcore/frameworks/foundation/system/page.js +7 -5
  70. data/frameworks/sproutcore/frameworks/foundation/system/ready.js +1 -0
  71. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +9 -6
  72. data/frameworks/sproutcore/frameworks/foundation/system/request.js +41 -6
  73. data/frameworks/sproutcore/frameworks/foundation/system/response.js +89 -24
  74. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +1 -1
  75. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +0 -1
  76. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +27 -8
  77. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +6 -6
  78. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +2 -2
  79. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +65 -3
  80. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +1 -1
  81. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertLayouts.js +145 -0
  82. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js +48 -0
  83. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/nextValidKeyView.js +91 -0
  84. data/frameworks/sproutcore/frameworks/foundation/validators/number.js +9 -5
  85. data/frameworks/sproutcore/frameworks/foundation/views/field.js +16 -14
  86. data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +89 -67
  87. data/frameworks/sproutcore/frameworks/foundation/views/view.js +221 -73
  88. data/frameworks/sproutcore/frameworks/runtime/core.js +43 -22
  89. data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +6 -0
  90. data/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +1 -1
  91. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +53 -34
  92. data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +7 -3
  93. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +19 -19
  94. data/frameworks/sproutcore/frameworks/runtime/system/logger.js +132 -88
  95. data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -9
  96. data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +6 -0
  97. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +69 -0
  98. data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +14 -2
  99. data/frameworks/sproutcore/license.js +3 -1
  100. data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  101. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_222222.png +0 -0
  102. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_454545.png +0 -0
  103. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_888888.png +0 -0
  104. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/icons/mini_ffffff.png +0 -0
  105. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/panels/sprite-x.png +0 -0
  106. data/frameworks/sproutcore/{frameworks/desktop → themes/standard_theme}/english.lproj/images/panels/sprite-y.png +0 -0
  107. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  108. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
  109. data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +15 -1
  110. data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu_item_view.css +9 -0
  111. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panel.css +33 -0
  112. data/frameworks/sproutcore/themes/standard_theme/english.lproj/picker.css +17 -0
  113. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +9 -6
  114. data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +0 -4
  115. data/frameworks/sproutcore/themes/standard_theme/english.lproj/well.css +36 -0
  116. data/gen/controller/templates/controllers/@filename@.js +1 -1
  117. data/lib/sproutcore/builders/minify.rb +45 -13
  118. data/lib/sproutcore/helpers/static_helper.rb +2 -2
  119. data/lib/sproutcore/models/manifest_entry.rb +42 -1
  120. data/lib/sproutcore/tools/build.rb +18 -2
  121. data/spec/lib/models/manifest_entry/hyperdomain_prefix.rb +34 -0
  122. data/vendor/yui-compressor/SCyuicompressor-2.4.2.jar +0 -0
  123. metadata +28 -22
  124. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-fat.jpg +0 -0
  125. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-thin.jpg +0 -0
  126. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-edge.png +0 -0
  127. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-left-corner.png +0 -0
  128. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-right-corner.png +0 -0
  129. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/left-edge.png +0 -0
  130. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/overlay.png +0 -0
  131. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/right-edge.png +0 -0
  132. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-edge.png +0 -0
  133. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-left-corner.png +0 -0
  134. data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-right-corner.png +0 -0
@@ -8,10 +8,10 @@
8
8
  sc_require('panes/panel');
9
9
 
10
10
  /**
11
- Displays a modal sheet pane animated drop down from top.
11
+ Displays a modal sheet pane that animates from the top of the viewport.
12
12
 
13
13
  The default way to use the sheet pane is to simply add it to your page like this:
14
-
14
+
15
15
  {{{
16
16
  SC.SheetPane.create({
17
17
  layout: { width: 400, height: 200, centerX: 0 },
@@ -19,36 +19,136 @@ sc_require('panes/panel');
19
19
  })
20
20
  }).append();
21
21
  }}}
22
-
23
- This will cause your sheet panel to display. The default layout for a Sheet
24
- is to cover the entire document window with a semi-opaque background, and to
22
+
23
+ This will cause your sheet panel to display. The default layout for a Sheet
24
+ is to cover the entire document window with a semi-opaque background, and to
25
25
  resize with the window.
26
-
26
+
27
27
  @extends SC.PanelPane
28
28
  @since SproutCore 1.0
29
+ @author Evin Grano
30
+ @author Tom Dale
29
31
  */
30
32
  SC.SheetPane = SC.PanelPane.extend({
31
-
32
33
  classNames: 'sc-sheet',
33
34
 
34
35
  /**
35
- The modal pane to place behind this pane if this pane is modal. This
36
- must be a subclass or an instance of SC.ModalPane.
36
+ Speed of transition. Should be expressed in msec.
37
+
38
+ @property {Number}
37
39
  */
38
- modalPane: SC.ModalPane.extend({
39
- classNames: 'for-sc-panel for-sc-sheet'
40
- }),
41
-
42
- init: function() {
43
- sc_super() ;
44
-
45
- /** TODO: Implement Animation
46
- this.visibleAnimation = {
47
- visible: 'top: 0px',
48
- hidden: 'top: -500px',
49
- duration: 300
50
- } ;
51
- */
52
- }
40
+ transitionDuration: 200,
41
+
42
+ // states for view animation
43
+ NO_VIEW: 'NO_VIEW',
44
+ ANIMATING: 'ANIMATING',
45
+ READY: 'READY',
46
+
47
+ SLIDE_DOWN: 'SLIDEDOWN',
48
+ SLIDE_UP: 'SLIDEUP',
49
+
50
+ _state: 'NO_VIEW', // no view
51
+
52
+ /**
53
+ Displays the pane. SheetPane will calculate the height of your pane, draw it offscreen, then
54
+ animate it down so that it is attached to the top of the viewport.
55
+
56
+ @returns {SC.SheetPane} receiver
57
+ */
58
+ append: function() {
59
+ var layout = this.get('layout');
60
+ if (!layout.height || !layout.top) {
61
+ layout = SC.View.convertLayoutToAnchoredLayout(layout, this.computeParentDimensions());
62
+ }
63
+
64
+ // Gently rest the pane atop the viewport
65
+ layout.top = -1*layout.height;
66
+ this.adjust(layout);
67
+ return sc_super();
68
+ },
69
+
70
+ /**
71
+ Animates the sheet up, then removes it from the DOM once it is hidden from view.
72
+
73
+ @returns {SC.SheetPane} receiver
74
+ */
75
+ remove: function() {
76
+ // We want the functionality of SC.PanelPane.remove(), but we only want it once the animation is complete.
77
+ // Store the reference to the superclass function, and it call it after the transition is complete.
78
+ var that = this, args = arguments;
79
+ this.invokeLater(function() { args.callee.base.apply(that, args) ;}, this.transitionDuration);
80
+ this.slideUp();
81
+
82
+ return this;
83
+ },
84
+
85
+ /**
86
+ Once the pane has been rendered out to the DOM, begin the animation.
87
+ */
88
+ paneDidAttach: function() {
89
+ var ret = sc_super();
90
+ // this.invokeLast(this.slideDown, this);
91
+ this.slideDown();
92
+
93
+ return ret;
94
+ },
95
+
96
+ slideDown: function(){
97
+ // setup other general state
98
+ this._start = Date.now();
99
+ this._end = this._start + this.get('transitionDuration');
100
+ this._state = this.ANIMATING;
101
+ this._direction = this.SLIDE_DOWN;
102
+ this.tick();
103
+ },
104
+
105
+ slideUp: function(){
106
+ // setup other general state
107
+ this._start = Date.now();
108
+ this._end = this._start + this.get('transitionDuration');
109
+ this._state = this.ANIMATING;
110
+ this._direction = this.SLIDE_UP;
111
+ this.tick();
112
+ },
113
+
114
+ // Needed because of the runLoop and that it is animated...must lose focus because will break if selection is change on text fields that don't move.
115
+ blurTo: function(pane) { this.setFirstResponder(''); },
116
+
117
+ /** @private - called while the animation runs. Will move the content view down until it is in position and then set the layout to the content layout
118
+ */
119
+ tick: function() {
120
+ this._timer = null ; // clear out
121
+
122
+ var now = Date.now();
123
+ var target = this;
124
+ var pct = (now-this._start)/(this._end-this._start);
125
+ var dir = this._direction, layout = this.get('layout'), newLayout, adjust;
126
+ if (pct<0) pct = 0;
127
+
128
+ // If we are done...
129
+ if (pct>=1) {
130
+ if (dir === this.SLIDE_DOWN){
131
+ target.adjust('top', 0);
132
+ } else {
133
+ target.adjust('top', -1*layout.height);
134
+ }
135
+ this._state = SC.SheetPane.READY;
136
+ this.updateLayout();
137
+ return this;
138
+ }
139
+
140
+ // ok, now let's compute the new layouts for the two views and set them
141
+ adjust = Math.floor(layout.height * pct);
142
+
143
+ // set the layout for the views, depending on the direction
144
+ if (dir == this.SLIDE_DOWN) {
145
+ target.adjust('top', 0-(layout.height-adjust));
146
+ } else if (dir == this.SLIDE_UP) {
147
+ target.adjust('top', 0-adjust);
148
+ }
53
149
 
150
+ this._timer = this.invokeLater(this.tick, 20);
151
+ target.updateLayout();
152
+ return this;
153
+ }
54
154
  });
@@ -338,7 +338,7 @@ SC.Drag = SC.Object.extend(
338
338
  mouseDragged: function(evt) {
339
339
  var scrolled = this._autoscroll(evt) ;
340
340
  var loc = this.get('location') ;
341
- if (!scrolled && (evt.pageX == loc.x) && (evt.pageY == loc.y)) {
341
+ if (!scrolled && (evt.pageX === loc.x) && (evt.pageY === loc.y)) {
342
342
  return ; // quickly ignore duplicate calls
343
343
  }
344
344
 
@@ -355,7 +355,7 @@ SC.Drag = SC.Object.extend(
355
355
  var target = this._findDropTarget(evt) ; // deepest drop target
356
356
  var op = SC.DRAG_NONE ;
357
357
 
358
- while (target && (target != last) && (op == SC.DRAG_NONE)) {
358
+ while (target && (target !== last) && (op === SC.DRAG_NONE)) {
359
359
  // make sure the drag source will permit a drop operation on the named
360
360
  // target
361
361
  if (target && source && source.dragSourceOperationMaskFor) {
@@ -363,18 +363,18 @@ SC.Drag = SC.Object.extend(
363
363
  } else op = SC.DRAG_ANY ; // assume drops are allowed
364
364
 
365
365
  // now, let's see if the target will accept the drag
366
- if ((op != SC.DRAG_NONE) && target && target.computeDragOperations) {
366
+ if ((op !== SC.DRAG_NONE) && target && target.computeDragOperations) {
367
367
  op = op & target.computeDragOperations(this, evt, op) ;
368
368
  } else op = SC.DRAG_NONE ; // assume drops AREN'T allowed
369
369
 
370
370
  this.allowedDragOperations = op ;
371
371
 
372
372
  // if DRAG_NONE, then look for the next parent that is a drop zone
373
- if (op == SC.DRAG_NONE) target = this._findNextDropTarget(target) ;
373
+ if (op === SC.DRAG_NONE) target = this._findNextDropTarget(target) ;
374
374
  }
375
375
 
376
376
  // STEP 2: Refocus the drop target if needed
377
- if (target != last) {
377
+ if (target !== last) {
378
378
  if (last && last.dragExited) last.dragExited(this, evt) ;
379
379
 
380
380
  if (target) {
@@ -228,12 +228,17 @@ SC.RootResponder = SC.RootResponder.extend(
228
228
  var keyPane = this.get('keyPane'), mainPane = this.get('mainPane'),
229
229
  mainMenu = this.get('mainMenu');
230
230
 
231
- // try the keyPane
232
- if (keyPane) ret = keyPane.performKeyEquivalent(keystring, evt) ;
231
+ // Try the keyPane. If it's modal, then try the equivalent there but on
232
+ // nobody else.
233
+ if (keyPane) {
234
+ ret = keyPane.performKeyEquivalent(keystring, evt) ;
235
+ if (ret || keyPane.get('isModal')) return ret ;
236
+ }
233
237
 
234
238
  // if not, then try the main pane
235
239
  if (!ret && mainPane && (mainPane!==keyPane)) {
236
240
  ret = mainPane.performKeyEquivalent(keystring, evt);
241
+ if (ret || mainPane.get('isModal')) return ret ;
237
242
  }
238
243
 
239
244
  // if not, then try the main menu
@@ -393,10 +398,8 @@ SC.RootResponder = SC.RootResponder.extend(
393
398
  the keypress event.
394
399
  */
395
400
  keydown: function(evt) {
396
- // This code is to check for the simulated keypressed event
397
- if(!evt.kindOf) this._ffevt=null;
398
- else evt=this._ffevt;
399
- if (SC.none(evt)) return YES;
401
+ if (SC.none(evt)) return YES;
402
+
400
403
  // Firefox does NOT handle delete here...
401
404
  if (SC.browser.mozilla && (evt.which === 8)) return true ;
402
405
 
@@ -414,18 +417,13 @@ SC.RootResponder = SC.RootResponder.extend(
414
417
  // responder can do something useful with the event.
415
418
  ret = YES ;
416
419
  if (this._isFunctionOrNonPrintableKey(evt)) {
417
- // Simulate keydown events for firefox since keypress only triggers once
418
- // We don't do it in keypress as it doesn't work in certain cases, ie.
419
- // Caret is at last position and you press down arrow key.
420
- if (SC.browser.mozilla && evt.keyCode>=37 && evt.keyCode<=40){
421
- this._ffevt=evt;
422
- SC.RunLoop.begin();
423
- this.invokeLater(this.keydown, 100);
424
- SC.RunLoop.end();
425
- }
426
420
  // otherwise, send as keyDown event. If no one was interested in this
427
421
  // keyDown event (probably the case), just let the browser do its own
428
422
  // processing.
423
+
424
+ // Arrow keys are handled in keypress for firefox
425
+ if (evt.keyCode>=37 && evt.keyCode<=40 && SC.browser.mozilla) return YES;
426
+
429
427
  ret = this.sendEvent('keyDown', evt) ;
430
428
 
431
429
  // attempt key equivalent if key not handled
@@ -453,12 +451,17 @@ SC.RootResponder = SC.RootResponder.extend(
453
451
 
454
452
  // delete is handled in keydown() for most browsers
455
453
  if (SC.browser.mozilla && (evt.which === 8)) {
454
+ //get the keycode and set it for which.
455
+ evt.which=evt.keyCode;
456
456
  ret = this.sendEvent('keyDown', evt);
457
457
  return ret ? (SC.allowsBackspaceToPreviousPage || evt.hasCustomEventHandling) : YES ;
458
458
 
459
- // normal processing. send keyDown for printable keys...
459
+ // normal processing. send keyDown for printable keys...
460
+ //there is a special case for arrow key repeating of events in FF.
460
461
  } else {
461
- if (evt.charCode !== undefined && evt.charCode === 0) return YES;
462
+ var isFirefoxArrowKeys = (evt.keyCode>=37 && evt.keyCode<=40 && SC.browser.mozilla);
463
+ if ((evt.charCode !== undefined && evt.charCode === 0) && !isFirefoxArrowKeys) return YES;
464
+ if (isFirefoxArrowKeys) evt.which=evt.keyCode;
462
465
  return this.sendEvent('keyDown', evt) ? evt.hasCustomEventHandling:YES;
463
466
  }
464
467
  },
@@ -476,7 +479,10 @@ SC.RootResponder = SC.RootResponder.extend(
476
479
  mousedown: function(evt) {
477
480
  try {
478
481
  // make sure the window gets focus no matter what. FF is inconsistant
479
- // about this.
482
+ // about this. You have to regain focus on the window for the key events
483
+ // to get triggered. This happens when we don't let the browser trigger
484
+ // the default action and we have something in the app like an iframe.
485
+ window.focus();
480
486
  this.focus();
481
487
  if(SC.browser.msie) {
482
488
  this._lastMouseDownX = evt.clientX;
@@ -495,6 +501,7 @@ SC.RootResponder = SC.RootResponder.extend(
495
501
  // the view. This is a special case as textfields are not supposed to loose
496
502
  // focus unless you click on a list, another textfield or an special
497
503
  // view/control.
504
+
498
505
  if(view) fr=view.get('pane').get('firstResponder');
499
506
 
500
507
  if(fr && fr.kindOf(SC.InlineTextFieldView) && fr!==view){
@@ -605,14 +612,15 @@ SC.RootResponder = SC.RootResponder.extend(
605
612
  trigger calls to mouseDragged.
606
613
  */
607
614
  mousemove: function(evt) {
608
- if(SC.browser.msie){
609
- if(this._lastMoveX === evt.clientX && this._lastMoveY === evt.clientY) return;
610
- else {
611
- this._lastMoveX = evt.clientX;
612
- this._lastMoveY = evt.clientY;
613
- }
615
+ if (SC.browser.msie) {
616
+ if (this._lastMoveX === evt.clientX && this._lastMoveY === evt.clientY) return;
614
617
  }
615
-
618
+
619
+ // We'll record the last positions in all browsers, in case a special pane
620
+ // or some such UI absolutely needs this information.
621
+ this._lastMoveX = evt.clientX;
622
+ this._lastMoveY = evt.clientY;
623
+
616
624
  SC.RunLoop.begin();
617
625
  try {
618
626
  // make sure the view gets focus no matter what. FF is inconsistant
@@ -0,0 +1,41 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
4
+ // portions copyright @2009 Apple Inc.
5
+ // License: Licened under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ /*global module test htmlbody ok equals same stop start */
9
+
10
+ module('SC.Pane-SC.Page') ;
11
+
12
+ test("isVisible changes should update views that are instantiated in a page", function() {
13
+ var page = SC.Page.design({
14
+ inspector: SC.PickerPane.design({
15
+ layout: { width: 300, height: 300, centerX: 0 },
16
+ contentView: SC.View.extend({
17
+ layout: { top: 0, left: 0, bottom: 0, right: 0 },
18
+ childViews: 'labelView'.w(),
19
+
20
+ labelView: SC.LabelView.extend({
21
+ layout: { centerY: -10, height: 24, left: 0, right: 0 },
22
+ value: "PrefPane"
23
+ })
24
+ })
25
+ })
26
+ }) ;
27
+
28
+
29
+ var pp = page.get('inspector');
30
+ pp.append();
31
+ SC.RunLoop.begin().end();
32
+ pp.remove();
33
+ SC.RunLoop.begin().end();
34
+ pp.childViews[0].childViews[0].set('isVisible', NO);
35
+ SC.RunLoop.begin().end();
36
+ pp.append();
37
+ SC.RunLoop.begin().end();
38
+ var res = pp.childViews[0].childViews[0].$().hasClass('hidden');
39
+ ok(res, "The view (isVisible) has been properly rerendered even though it was part of a page, the pane was detached and the visibility was changed while detached");
40
+
41
+ });
@@ -52,6 +52,18 @@ module("SC.SelectButtonView",{
52
52
  valueKey: 'title',
53
53
  nameKey: 'title',
54
54
  sortKey: 'pos'
55
+ }),
56
+
57
+ //view5
58
+ SC.SelectButtonView.extend({
59
+ objects: ["My","New", "List"]
60
+ }),
61
+
62
+ //view6
63
+ SC.SelectButtonView.extend({
64
+ objects: ["My","New", "List"],
65
+ customViewClassName: 'custom-menu-item',
66
+ customViewMenuOffsetWidth: 46
55
67
  })
56
68
  ]
57
69
  });
@@ -60,7 +72,9 @@ module("SC.SelectButtonView",{
60
72
  view2 = pane.childViews[1] ;
61
73
  view3 = pane.childViews[2] ;
62
74
  view4 = pane.childViews[3] ;
63
-
75
+ view5 = pane.childViews[4] ;
76
+ view6 = pane.childViews[5] ;
77
+
64
78
  pane.append(); // make sure there is a layer...
65
79
  SC.RunLoop.end();
66
80
  },
@@ -163,3 +177,18 @@ test("objects should change on changing the binding", function() {
163
177
  ok(objects===newObjects, 'Objects should be bound') ;
164
178
  });
165
179
 
180
+ //test11
181
+ test("The properties for select button should take default values unless specified", function() {
182
+ var prop1 = view5.get('customViewClassName');
183
+ var prop2 = view5.get('customViewMenuOffsetWidth');
184
+ equals(prop1,null,'Custom view class name should be null');
185
+ equals(prop2,0,'Custom view menu off set width should be 0');
186
+ });
187
+
188
+ //test12
189
+ test("The properties for select button should take the specified values", function() {
190
+ var prop1 = view6.get('customViewClassName');
191
+ var prop2 = view6.get('customViewMenuOffsetWidth');
192
+ equals(prop1,'custom-menu-item','Custom view class name should be custom-menu-item');
193
+ equals(prop2,46,'Custom view menu off set width should be 46');
194
+ });
@@ -70,6 +70,19 @@ var pane = SC.ControlTestPane.design()
70
70
  useStaticLayout: YES,
71
71
  objects:['None', 'Low', 'Medium', 'High'],
72
72
  layout: { width: '150', right: '0' }
73
+ })
74
+
75
+ //sample10
76
+ .add("DisableItem", SC.SelectButtonView, {
77
+ objects: [{ title: "None", pos: 3, isEnabled: YES },
78
+ { title: "Low", pos: 1, isEnabled: NO },
79
+ { title: "Medium", pos: 2, isEnabled: YES },
80
+ { title: "High", pos: 4, isEnabled: NO }],
81
+ nameKey: 'title',
82
+ disableSort: NO,
83
+ isEnabledKey: 'isEnabled',
84
+ sortKey: 'pos',
85
+ checkboxEnabled: YES
73
86
  }) ;
74
87
 
75
88
  pane.show();
@@ -9,30 +9,36 @@
9
9
 
10
10
  module("SC.SheetPane UI");
11
11
 
12
- var pane ;
12
+ var slidePane;
13
13
 
14
- test("verify sheet pane content container is visible at correct location with right size", function() {
15
- pane = SC.SheetPane.create({
16
- layout: { width: 400, height: 200, centerX: 0 },
17
- contentView: SC.View.extend({
14
+ test("verify sheet pane slide down works", function() {
15
+ slidePane = SC.SheetPane.create({
16
+ layout: { top: 60, width: 400, height: 200, centerX: 0 },
17
+ contentView: SC.LabelView.extend({
18
+ escapeHTML: NO,
19
+ value: '<h1>Slide Down!</h1>'
18
20
  })
19
21
  });
20
- pane.append();
21
-
22
- ok(pane.get('isVisibleInWindow'), 'pane.isVisibleInWindow should be YES');
23
- ok(pane.$().hasClass('sc-sheet'), 'pane should have sc-sheet class');
24
- ok(pane.childViews[0].get('isVisibleInWindow'), 'pane.div.isVisibleInWindow should be YES');
25
- ok(pane.childViews[0].$().hasClass('sc-view'), 'pane.div should have sc-view class');
26
22
 
27
- var pw = pane.layout.width;
28
- var ph = pane.layout.height;
29
- var ret = pane.layoutStyle();
30
-
31
- equals(ret.top, '0px', 'pane should be displayed at default position top');
32
- equals(ret.left, '50%', 'pane should center horizontally');
33
- equals(ret.width, '400px', 'pane should have width 400px');
34
- equals(ret.height, '200px', 'pane should have height 200px');
35
- equals(ret.marginLeft, -pw/2+'px', 'pane should shift-left %@ px'.fmt(-pw/2));
23
+ var layout = slidePane.get('layout');
24
+ var pt = layout.top;
25
+ var pl = layout.left;
26
+ var pw = layout.width;
27
+ var ph = layout.height;
28
+ var ret = slidePane.layoutStyle();
36
29
 
37
- pane.remove();
30
+ slidePane.append();
31
+ var f = function() {
32
+ // make sure all fo the timers have had an opportunity to fire
33
+ SC.RunLoop.begin().end();
34
+ equals(slidePane.get('layout').top, 0, 'pane should be displayed at default position top after animating');
35
+ ok(slidePane.get('isVisibleInWindow'), 'pane.isVisibleInWindow should be YES');
36
+ ok(slidePane.$().hasClass('sc-sheet'), 'pane should have sc-sheet class');
37
+ ok(slidePane.childViews[0].get('isVisibleInWindow'), 'pane.div.isVisibleInWindow should be YES');
38
+ ok(slidePane.childViews[0].$().hasClass('sc-view'), 'pane.div should have sc-view class');
39
+ window.start();
40
+ slidePane.remove();
41
+ };
42
+ stop();
43
+ setTimeout(f, 250);
38
44
  }) ;