sproutcore 1.5.0.pre.4.1 → 1.5.0.pre.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. data/CHANGELOG +7 -0
  2. data/VERSION.yml +1 -1
  3. data/lib/buildtasks/manifest.rake +4 -3
  4. data/lib/frameworks/sproutcore/Buildfile +1 -2
  5. data/lib/frameworks/sproutcore/CHANGELOG.md +8 -3
  6. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/app-selector.css +19 -23
  7. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/button.css +139 -135
  8. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/dock.css +5 -0
  9. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/general.css +0 -1
  10. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/menu.css +10 -13
  11. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/modal.css +9 -8
  12. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/picker.css +19 -12
  13. data/lib/frameworks/sproutcore/apps/greenhouse/models/design.js +2 -2
  14. data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +1 -1
  15. data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +2 -2
  16. data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +3 -1
  17. data/lib/frameworks/sproutcore/frameworks/animation/core.js +1 -1
  18. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +31 -20
  19. data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +15 -9
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +5 -5
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +1 -1
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +23 -45
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +1 -1
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +60 -5
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/ready.js +1 -1
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +2 -2
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +4 -4
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/ready/done.js +32 -0
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +5 -2
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +8 -3
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/layout.js +4 -4
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +51 -5
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +18 -0
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +261 -0
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +55 -0
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +2 -19
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +3 -1
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +17 -0
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +96 -1
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/prepareContext.js +15 -0
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/updateLayerLocation.js +19 -0
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +8 -1
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +179 -4
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +8 -14
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +7 -0
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +4 -4
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +51 -114
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +84 -36
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +4 -67
  50. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +244 -1
  51. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +1 -1
  52. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +1 -1
  53. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +7 -1
  54. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +1 -1
  55. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +2 -2
  56. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +23 -1
  57. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +4 -2
  58. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +4 -0
  59. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +4 -1
  60. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +4 -0
  61. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +4 -0
  62. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +4 -0
  63. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +4 -0
  64. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +5 -1
  65. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +5 -1
  66. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/loadRecord.js +64 -0
  67. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +38 -35
  68. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js +4 -0
  69. data/lib/frameworks/sproutcore/frameworks/datetime/system/datetime.js +7 -4
  70. data/lib/frameworks/sproutcore/frameworks/datetime/tests/system/datetime.js +2 -2
  71. data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
  72. data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +5 -5
  73. data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +1 -1
  74. data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +11 -3
  75. data/lib/frameworks/sproutcore/frameworks/designer/ext/binding.js +33 -0
  76. data/lib/frameworks/sproutcore/frameworks/designer/ext/object.js +1 -1
  77. data/lib/frameworks/sproutcore/frameworks/designer/ext/page.js +5 -33
  78. data/lib/frameworks/sproutcore/frameworks/designer/ext/view.js +0 -27
  79. data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +54 -0
  80. data/lib/frameworks/sproutcore/frameworks/designer/tests/designers/view_designer.js +47 -0
  81. data/lib/frameworks/sproutcore/frameworks/designer/views/drawing.js +4 -4
  82. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +19 -6
  83. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +1 -1
  84. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +1 -1
  85. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
  86. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +133 -39
  87. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +3 -3
  88. data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/border.js +6 -5
  89. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +8 -2
  90. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +10 -2
  91. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +8 -2
  92. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +10 -2
  93. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +15 -9
  94. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +8 -2
  95. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +8 -2
  96. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +10 -2
  97. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +10 -2
  98. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +31 -0
  99. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +10 -3
  100. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +10 -3
  101. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +10 -3
  102. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +15 -8
  103. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +10 -3
  104. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +1 -1
  105. data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +1 -1
  106. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +1 -7
  107. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +10 -0
  108. data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +3 -3
  109. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +2 -2
  110. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +17 -5
  111. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +60 -27
  112. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
  113. data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +4 -4
  114. data/lib/frameworks/sproutcore/frameworks/foundation/system/cookie.js +29 -18
  115. data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +18 -18
  116. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +5 -5
  117. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +62 -1
  118. data/lib/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +8 -3
  119. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js +4 -3
  120. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +5 -3
  121. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +5 -3
  122. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/cookie.js +20 -4
  123. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +235 -0
  124. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +5 -0
  125. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +0 -2
  126. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +8 -3
  127. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +2 -2
  128. data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +19 -11
  129. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +6 -13
  130. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +23 -117
  131. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/bind.js +136 -0
  132. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/collection.js +75 -0
  133. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/localization.js +5 -0
  134. data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/view.js +115 -0
  135. data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +143 -80
  136. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +1 -1
  137. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +4 -4
  138. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +5 -5
  139. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array.js +14 -0
  140. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
  141. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +13 -13
  142. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +4 -4
  143. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
  144. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +1 -1
  145. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +25 -17
  146. data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/pointers.psd +0 -0
  147. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/18px/button.css +18 -12
  148. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/24px/button.css +30 -16
  149. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/30px/button.css +27 -15
  150. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +5 -0
  151. data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/button.css +8 -0
  152. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/24px/button.css +25 -16
  153. data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/30px/button.css +21 -15
  154. data/lib/frameworks/sproutcore/themes/ace/resources/imagebutton/ace/imagebutton.css +11 -0
  155. data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/panel.png +0 -0
  156. data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/picker.css +41 -0
  157. data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/pointers.png +0 -0
  158. data/lib/sproutcore.rb +2 -0
  159. data/lib/sproutcore/buildfile.rb +17 -17
  160. data/lib/sproutcore/buildfile/task.rb +4 -12
  161. data/lib/sproutcore/buildfile/task_manager.rb +13 -4
  162. data/lib/sproutcore/models/manifest.rb +3 -3
  163. data/lib/sproutcore/models/target.rb +1 -1
  164. data/spec/fixtures/real_world/Buildfile +1 -1
  165. data/vendor/chance/lib/chance/imagers/data_url.rb +38 -19
  166. data/vendor/chance/lib/chance/instance.rb +4 -7
  167. data/vendor/chance/lib/chance/slicing.rb +6 -10
  168. metadata +18 -5
  169. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/tabbed.css +0 -68
  170. data/lib/frameworks/sproutcore/frameworks/designer/coders/localization.js +0 -19
  171. data/lib/sproutcore/buildfile/cloneable.rb +0 -34
@@ -62,7 +62,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
62
62
  }
63
63
 
64
64
  if (log) {
65
- console.log("SC.Module: Attempting to load '%@'".fmt(moduleName));
65
+ SC.Logger.log("SC.Module: Attempting to load '%@'".fmt(moduleName));
66
66
  }
67
67
 
68
68
  // If we couldn't find anything in the SC.MODULE_INFO hash, we don't have any record of the
@@ -78,12 +78,12 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
78
78
  // If the module is already loaded, execute the callback immediately if SproutCore is loaded,
79
79
  // or else as soon as SC has finished loading.
80
80
  if (module.isLoaded) {
81
- if (log) console.log("SC.Module: Module '%@' already loaded.".fmt(moduleName));
81
+ if (log) SC.Logger.log("SC.Module: Module '%@' already loaded.".fmt(moduleName));
82
82
 
83
83
  // If the module has finished loading and we have the string
84
84
  // representation, try to evaluate it now.
85
85
  if (module.source) {
86
- if (log) console.log("SC.Module: Evaluating JavaScript for module '%@'.".fmt(moduleName));
86
+ if (log) SC.Logger.log("SC.Module: Evaluating JavaScript for module '%@'.".fmt(moduleName));
87
87
  this._evaluateStringLoadedModule(module);
88
88
  }
89
89
 
@@ -101,7 +101,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
101
101
  // The module is not yet loaded, so register the callback and, if necessary, begin loading
102
102
  // the code.
103
103
  else {
104
- if (log) console.log("SC.Module: Module '%@' is not loaded, loading now.".fmt(moduleName));
104
+ if (log) SC.Logger.log("SC.Module: Module '%@' is not loaded, loading now.".fmt(moduleName));
105
105
 
106
106
  // If this method is called more than once for the same module before it is finished
107
107
  // loading, we might have multiple callbacks that need to be executed once it loads.
@@ -146,7 +146,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
146
146
 
147
147
  if (module.isLoading || module.isLoaded) return;
148
148
 
149
- if (SC.LOG_MODULE_LOADING) console.log("SC.Module: Prefetching module '%@'.".fmt(moduleName));
149
+ if (SC.LOG_MODULE_LOADING) SC.Logger.log("SC.Module: Prefetching module '%@'.".fmt(moduleName));
150
150
  this._loadDependenciesForModule(moduleName);
151
151
  this._loadCSSForModule(moduleName);
152
152
  this._loadJavaScriptForModule(moduleName);
@@ -169,7 +169,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
169
169
  var idx, len;
170
170
 
171
171
  if (SC.LOG_MODULE_LOADING) {
172
- console.log("SC.Module: Module '%@' is marked for lazy instantiation, instantiating it now…".fmt(moduleName));
172
+ SC.Logger.log("SC.Module: Module '%@' is marked for lazy instantiation, instantiating it now…".fmt(moduleName));
173
173
  }
174
174
 
175
175
  len = lazyInfo.length;
@@ -178,7 +178,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
178
178
  try {
179
179
  lazyInfo[idx]();
180
180
  } catch(e) {
181
- console.error("SC.Module: Failed to lazily instatiate entry for '%@'".fmt(moduleName));
181
+ SC.Logger.error("SC.Module: Failed to lazily instatiate entry for '%@'".fmt(moduleName));
182
182
  }
183
183
  }
184
184
 
@@ -232,7 +232,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
232
232
  url = styles[idx] ;
233
233
 
234
234
  if (url.length > 0) {
235
- if (SC.LOG_MODULE_LOADING) console.log("SC.Module: Loading CSS file in '%@' -> '%@'".fmt(moduleName, url));
235
+ if (SC.LOG_MODULE_LOADING) SC.Logger.log("SC.Module: Loading CSS file in '%@' -> '%@'".fmt(moduleName, url));
236
236
  el = document.createElement('link') ;
237
237
  el.setAttribute('href', url) ;
238
238
  el.setAttribute('rel', "stylesheet") ;
@@ -273,7 +273,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
273
273
  }
274
274
 
275
275
  if (url.length > 0) {
276
- if (SC.LOG_MODULE_LOADING) console.log("SC.Module: Loading JavaScript file in '%@' -> '%@'".fmt(moduleName, url));
276
+ if (SC.LOG_MODULE_LOADING) SC.Logger.log("SC.Module: Loading JavaScript file in '%@' -> '%@'".fmt(moduleName, url));
277
277
 
278
278
  el = document.createElement('script') ;
279
279
  el.setAttribute('type', "text/javascript") ;
@@ -371,7 +371,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
371
371
 
372
372
  dependents.push(moduleName) ;
373
373
 
374
- if (log) console.log("SC.Module: '%@' depends on '%@', loading dependency…".fmt(moduleName, requiredModuleName));
374
+ if (log) SC.Logger.log("SC.Module: '%@' depends on '%@', loading dependency…".fmt(moduleName, requiredModuleName));
375
375
 
376
376
  // Load dependencies
377
377
  SC.Module.loadModule(requiredModuleName) ;
@@ -427,7 +427,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
427
427
  var moduleInfo = SC.MODULE_INFO[moduleName], callbacks ;
428
428
  if (!moduleInfo) return ; // shouldn't happen, but recover anyway
429
429
 
430
- if (SC.LOG_MODULE_LOADING) console.log("SC.Module: Module '%@' has completed loading, invoking callbacks.".fmt(moduleName));
430
+ if (SC.LOG_MODULE_LOADING) SC.Logger.log("SC.Module: Module '%@' has completed loading, invoking callbacks.".fmt(moduleName));
431
431
 
432
432
  callbacks = moduleInfo.callbacks || [] ;
433
433
 
@@ -441,7 +441,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
441
441
  var module = moduleInfo[moduleName];
442
442
  var log = SC.LOG_MODULE_LOADING;
443
443
 
444
- if (log) console.log("SC.Module: Evaluating and invoking callbacks for '%@'.".fmt(moduleName));
444
+ if (log) SC.Logger.log("SC.Module: Evaluating and invoking callbacks for '%@'.".fmt(moduleName));
445
445
 
446
446
  if (module.source) {
447
447
  this._evaluateStringLoadedModule(module);
@@ -466,7 +466,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
466
466
  dependentName = dependents[idx];
467
467
  dependent = moduleInfo[dependentName];
468
468
  if (dependent.isLoaded && this._dependenciesMetForModule(dependentName)) {
469
- if (log) console.log("SC.Module: Now that %@ has loaded, all dependencies for a dependent %@ are met.".fmt(moduleName, dependentName));
469
+ if (log) SC.Logger.log("SC.Module: Now that %@ has loaded, all dependencies for a dependent %@ are met.".fmt(moduleName, dependentName));
470
470
  this._evaluateAndInvokeCallbacks(dependentName);
471
471
  }
472
472
  }
@@ -487,16 +487,16 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
487
487
  var dependenciesMet;
488
488
  var callbacks, targets;
489
489
 
490
- if (log) console.log("SC.Module: Module '%@' finished loading.".fmt(moduleName));
490
+ if (log) SC.Logger.log("SC.Module: Module '%@' finished loading.".fmt(moduleName));
491
491
 
492
492
  if (!module) {
493
- if (log) console.log("SC._moduleDidLoad() called for unknown module '@'.".fmt(moduleName));
493
+ if (log) SC.Logger.log("SC._moduleDidLoad() called for unknown module '@'.".fmt(moduleName));
494
494
  module = SC.MODULE_INFO[moduleName] = { isLoaded: YES, isReady: YES } ;
495
495
  return;
496
496
  }
497
497
 
498
498
  if (module.isLoaded) {
499
- if (log) console.log("SC._moduleDidLoad() called more than once for module '%@'. Skipping.".fmt(moduleName));
499
+ if (log) SC.Logger.log("SC._moduleDidLoad() called more than once for module '%@'. Skipping.".fmt(moduleName));
500
500
  return ;
501
501
  }
502
502
 
@@ -509,11 +509,11 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
509
509
  if (dependenciesMet) {
510
510
  this._evaluateAndInvokeCallbacks(moduleName);
511
511
  } else {
512
- if (log) console.log("SC.Module: Dependencies for '%@' not met yet, waiting to evaluate.".fmt(moduleName));
512
+ if (log) SC.Logger.log("SC.Module: Dependencies for '%@' not met yet, waiting to evaluate.".fmt(moduleName));
513
513
  }
514
514
  } else {
515
515
  delete module.isPrefetching;
516
- if (log) console.log("SC.Module: Module '%@' was prefetched, not evaluating until needed.".fmt(moduleName));
516
+ if (log) SC.Logger.log("SC.Module: Module '%@' was prefetched, not evaluating until needed.".fmt(moduleName));
517
517
  }
518
518
  },
519
519
 
@@ -84,7 +84,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
84
84
  try{
85
85
  localStorage.load("SC.UserDefaults");
86
86
  }catch(e){
87
- console.err("Couldn't load userDefaults in IE7: "+e.description);
87
+ SC.Logger.error("Couldn't load userDefaults in IE7: "+e.description);
88
88
  }
89
89
  }else if(this.HTML5DB_noLocalStorage){
90
90
  storageSafari3 = this._safari3DB;
@@ -179,7 +179,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
179
179
  try{
180
180
  localStorage[key] = encodedValue;
181
181
  }catch(e){
182
- console.error("Failed using localStorage. "+e);
182
+ SC.Logger.error("Failed using localStorage. "+e);
183
183
  }
184
184
  }
185
185
  }
@@ -241,7 +241,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
241
241
  try{
242
242
  delete localStorage[key];
243
243
  } catch(e) {
244
- console.warn('Deleting local storage encountered a problem. '+e);
244
+ SC.Logger.warn('Deleting local storage encountered a problem. '+e);
245
245
  }
246
246
  }
247
247
  }
@@ -326,7 +326,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
326
326
  var myDB;
327
327
  try {
328
328
  if (!window.openDatabase) {
329
- console.error("Trying to load a database with safari version 3.1 "+
329
+ SC.Logger.error("Trying to load a database with safari version 3.1 "+
330
330
  "to get SC.UserDefaults to work. You are either in a"+
331
331
  " previous version or there is a problem with your browser.");
332
332
  return;
@@ -341,7 +341,7 @@ SC.UserDefaults = SC.Object.extend(/** @scope SC.UserDefaults.prototype */ {
341
341
 
342
342
  }
343
343
  } catch(e) {
344
- console.error("Trying to load a database with safari version 3.1 "+
344
+ SC.Logger.error("Trying to load a database with safari version 3.1 "+
345
345
  "to get SC.UserDefaults to work. You are either in a"+
346
346
  " previous version or there is a problem with your browser.");
347
347
  return;
@@ -70,7 +70,68 @@ SC.mixin( /** @scope SC */ {
70
70
  cString = cString + String.fromCharCode(nChar);
71
71
  }
72
72
  return cString;
73
- }
73
+ },
74
+
75
+ /**
76
+ Determines if the given point is within the given element.
77
+
78
+ The test rect will include the element's padding and can be configured to
79
+ optionally include the border or border and margin.
80
+
81
+ @param {Object} point the point as an Object (ie. Hash) in the form { x: value, y: value }.
82
+ @param {DOMElement|jQuery|String} elem the element to test inclusion within.
83
+ This is passed to `jQuery()`, so any value supported by `jQuery()` will work.
84
+ @param {String} includeFlag flag to determine the dimensions of the element to test within.
85
+ One of either: 'padding', 'border' or 'margin' (default: 'border').
86
+ @param {String} relativeToFlag flag to determine which relative element to determine offset by.
87
+ One of either: 'document', 'viewport' or 'parent' (default: 'document').
88
+ @returns {Boolean} YES if the point is within the element; NO otherwise
89
+ */
90
+
91
+ // Note: This method is the most correct way to test the inclusion of a point within a DOM element.
92
+ // First, it uses SC.offset which is a slightly improved version of jQuery's offset and much more reliable
93
+ // than writing your own offset determination code.
94
+ // Second, the offset must be adjusted to account for the element's left and top border
95
+ // if not including the border or to account for the left and top margins when including the margins.
96
+ pointInElement: function(point, elem, includeFlag, relativeToFlag) {
97
+ var offset,
98
+ width,
99
+ height,
100
+ rect;
74
101
 
102
+ elem = jQuery(elem);
103
+ includeFlag = includeFlag || 'border';
104
+
105
+ // Find the offset
106
+ offset = SC.offset(elem, relativeToFlag);
107
+
108
+ // Find the dimensions
109
+ if (includeFlag === 'padding') {
110
+ width = elem.innerWidth();
111
+ height = elem.innerHeight();
112
+
113
+ // Adjust offset to account for top & left borders
114
+ offset.top += window.parseInt(elem.css('border-top-width').replace('px', ''));
115
+ offset.left += window.parseInt(elem.css('border-left-width').replace('px', ''));
116
+ } else {
117
+ width = elem.outerWidth(includeFlag === 'margin');
118
+ height = elem.outerHeight(includeFlag === 'margin');
119
+
120
+ if (includeFlag === 'margin') {
121
+ // Adjust offset to account for top & left margins
122
+ offset.top -= window.parseInt(elem.css('margin-top').replace('px', ''));
123
+ offset.left -= window.parseInt(elem.css('margin-left').replace('px', ''));
124
+ }
125
+ }
126
+
127
+ rect = {
128
+ x: offset.left,
129
+ y: offset.top,
130
+ width: width,
131
+ height: height
132
+ };
133
+
134
+ return SC.pointInRect(point, rect);
135
+ }
75
136
 
76
137
  });
@@ -6,9 +6,14 @@
6
6
 
7
7
  /*global module test equals context ok same htmlbody */
8
8
 
9
- module("Create a pane with some custom views and adding it to the window");
10
-
11
- htmlbody('<style>.sc-view { border: 1px red solid; z-index: -1; position: absolute; }</style>');
9
+ module("Create a pane with some custom views and adding it to the window", {
10
+ setup: function(){
11
+ htmlbody('<style>.sc-view { border: 1px red solid; z-index: -1; position: absolute; }</style>');
12
+ },
13
+ teardown: function(){
14
+ clearHtmlbody();
15
+ }
16
+ });
12
17
 
13
18
  test("layer creation and management", function() {
14
19
 
@@ -6,9 +6,6 @@
6
6
 
7
7
  /*global module test equals context ok same */
8
8
 
9
- htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
10
-
11
-
12
9
  var pane = SC.ControlTestPane.design()
13
10
  .add("basic", SC.View.extend(SC.Control, SC.Button,
14
11
  {
@@ -25,7 +22,11 @@ pane.show();
25
22
 
26
23
  module('SC.Button ui', {
27
24
  setup: function() {
25
+ htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
28
26
  var view = pane.view('basic');
27
+ },
28
+ teardown: function(){
29
+ clearHtmlbody();
29
30
  }
30
31
  });
31
32
 
@@ -6,8 +6,6 @@
6
6
 
7
7
  /*global module test equals context ok same */
8
8
 
9
- htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
10
-
11
9
 
12
10
  var pane = SC.ControlTestPane.design()
13
11
  .add("aria-role", SC.FieldView.extend(SC.StaticLayout, SC.Editable,
@@ -25,7 +23,11 @@ var pane = SC.ControlTestPane.design()
25
23
  pane.show();
26
24
  module('SC.Editable ui', {
27
25
  setup: function() {
26
+ htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
28
27
  var view = pane.view('aria-role');
28
+ },
29
+ teardown: function(){
30
+ clearHtmlbody();
29
31
  }
30
32
  });
31
33
 
@@ -39,4 +41,4 @@ test("should have aria-multiline as YES", function() {
39
41
  var view = pane.view('aria-multiline');
40
42
  var label = view.$();
41
43
  equals(label.attr('aria-multiline'), 'true', 'aria-multiline should be true');
42
- });
44
+ });
@@ -6,8 +6,6 @@
6
6
 
7
7
  /*global module test equals context ok same */
8
8
 
9
- htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
10
-
11
9
 
12
10
  var pane = SC.ControlTestPane.design()
13
11
  .add("aria-role", SC.InlineTextFieldView.extend({
@@ -33,7 +31,11 @@ pane.show();
33
31
 
34
32
  module('SC.InlineTextFieldView ui', {
35
33
  setup: function() {
34
+ htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
36
35
  var view = pane.view('aria-role');
36
+ },
37
+ teardown: function(){
38
+ clearHtmlbody();
37
39
  }
38
40
  });
39
41
 
@@ -59,4 +61,4 @@ test("should have aria-invalid as YES", function() {
59
61
  var view = pane.view('aria-invalid');
60
62
  var label = view.$();
61
63
  equals(label.attr('aria-invalid'), 'true', 'aria-invalid should be true');
62
- });
64
+ });
@@ -2,13 +2,13 @@
2
2
  // SC.Cookie Unit Test
3
3
  // ==========================================================================
4
4
 
5
- /*globals module test equals */
5
+ /*globals module test equals createCookie readCookie eraseCookies */
6
6
 
7
- var setCookies = ['cookie', 'cookie2', 'cookie-hashincreate', 'cookie-usingset', 'cookie-2-1', 'cookie-2-2', 'cookie-2-3', 'cookie-expires', 'cookie-destroy', 'cookie-find'];
7
+ var setCookies = ['cookie', 'cookie2', 'cookie-hashincreate', 'cookie-number', 'cookie-usingset', 'cookie-2-1', 'cookie-2-2', 'cookie-2-3', 'cookie-expires', 'cookie-destroy', 'cookie-find'];
8
8
  eraseCookies();
9
9
  setCookies = [];
10
10
 
11
- if (document.cookie != "") {
11
+ if (document.cookie !== "") {
12
12
  SC.Logger.warn("document.cookie not empty -- test results may be contaminated -- %@".fmt(document.cookie));
13
13
  }
14
14
 
@@ -42,7 +42,7 @@ function readCookie(name) {
42
42
  for(var i=0;i < ca.length;i++) {
43
43
  var c = ca[i];
44
44
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
45
- if (c.indexOf(nameEQ) == 0) return decodeURIComponent(c.substring(nameEQ.length,c.length));
45
+ if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length,c.length));
46
46
  }
47
47
  return null;
48
48
  }
@@ -87,6 +87,14 @@ test("Setting a cookie - no write", function() {
87
87
  setCookies = ["cookie-nowrite"];
88
88
  });
89
89
 
90
+ test("Setting a cookie - using an numeral expires", function() {
91
+ var cookie = SC.Cookie.create({name: "cookie-number", value: "testing value", expires: 1}).write();
92
+ var result = readCookie('cookie-number');
93
+ equals(result, "testing value", "value from document.cookie should be 'testing value'");
94
+
95
+ setCookies = ["cookie-number"];
96
+ });
97
+
90
98
  test("Setting 2 cookies", function() {
91
99
  var date = new Date();
92
100
  date.setTime(date.getTime() + 1000);
@@ -160,4 +168,12 @@ test("find", function() {
160
168
  equals(result.get('value'), cookie.get('value'), "cookie values should be equal");
161
169
 
162
170
  setCookies = ["cookie-find"];
171
+ });
172
+
173
+ test("Coooooooookie", function() {
174
+ var cookie = SC.Cookie.create({name: "yummy!"}),
175
+ FakeCookie = SC.Object.extend();
176
+
177
+ ok(SC.CookieMonster.nomNomNom(cookie) == null, "SC.CookieMonster nom nomed cookie");
178
+ equals(SC.CookieMonster.nomNomNom(FakeCookie.create()), NO, "SC.CookieMonster doesn't like fake cookies!");
163
179
  });
@@ -0,0 +1,235 @@
1
+ // ========================================================================
2
+ // SC Miscellaneous Utils Tests - pointInElement
3
+ // ========================================================================
4
+
5
+ /*global module test htmlbody ok equals same */
6
+
7
+
8
+ (function() {
9
+
10
+ var view;
11
+
12
+ var CustomView = SC.View.extend({
13
+ classNames: 'custom'.w(),
14
+ displayProperties: 'childClasses'.w(),
15
+
16
+ render: function(context, firstTime) {
17
+ context = context.begin().addClass('child').setClass(this.get('childClasses'));
18
+ context = context.end();
19
+ }
20
+ });
21
+
22
+ var pane = SC.ControlTestPane.extend()
23
+ .add("plain child", CustomView, {
24
+ classNames: ''.w(),
25
+ childClasses: {},
26
+ layout: { left: 10, top: 10, width: 100, height: 50 }
27
+ })
28
+ .add("padded child", CustomView, {
29
+ classNames: ''.w(),
30
+ childClasses: {padding: true},
31
+ layout: { left: 10, top: 10, width: 100, height: 50 }
32
+ })
33
+ .add("bordered child", CustomView, {
34
+ classNames: ''.w(),
35
+ childClasses: {border: true},
36
+ layout: { left: 10, top: 10, width: 100, height: 50 }
37
+ })
38
+ .add("margined child", CustomView, {
39
+ classNames: ''.w(),
40
+ childClasses: {margin: true},
41
+ layout: { left: 10, top: 10, width: 100, height: 50 }
42
+ })
43
+ .add("margined positioned child", CustomView, {
44
+ classNames: ''.w(),
45
+ childClasses: {absolute: true, margin: true},
46
+ layout: { left: 10, top: 10, width: 100, height: 50 }
47
+ })
48
+ .add("padded bordered child", CustomView, {
49
+ classNames: ''.w(),
50
+ childClasses: {padding: true, border: true},
51
+ layout: { left: 10, top: 10, width: 100, height: 50 }
52
+ })
53
+ .add("bordered margined child", CustomView, {
54
+ classNames: ''.w(),
55
+ childClasses: {border: true, margin: true},
56
+ layout: { left: 10, top: 10, width: 100, height: 50 }
57
+ })
58
+ .add("padded margined child", CustomView, {
59
+ classNames: ''.w(),
60
+ childClasses: {padding: true, margin: true},
61
+ layout: { left: 10, top: 10, width: 100, height: 50 }
62
+ })
63
+ .add("padded bordered margined child", CustomView, {
64
+ classNames: ''.w(),
65
+ childClasses: {padding: true, border: true, margin: true},
66
+ layout: { left: 10, top: 10, width: 100, height: 50 }
67
+ })
68
+ .add("padded parent plain child", CustomView, {
69
+ classNames: 'padded'.w(),
70
+ childClasses: {},
71
+ layout: { left: 10, top: 10, width: 100, height: 50 }
72
+ });
73
+
74
+ pane.show();
75
+
76
+
77
+ module("SC.pointInElement()", {
78
+ setup: function(){
79
+ htmlbody('<style> .custom { background-color: #BBF; } .padding { padding: 10px !important; } .border { border: 10px red solid !important;} .margin { margin: 10px !important; } .padding-em { padding: 10em !important; } .border-em { border: 10em red solid !important;} .margin-em { margin: 10em !important; } .child { background-color: #AAA; width: 80px; height: 80px; } .absolute { position: absolute; top: 10px; left: 10px; } </style>');
80
+ pane.standardSetup().setup();
81
+ },
82
+ teardown: function(){
83
+ pane.standardSetup().teardown();
84
+ clearHtmlbody();
85
+ }
86
+ });
87
+
88
+
89
+
90
+ function runChecks(element, offsetAdjust, values) {
91
+ var jqOffset = jQuery(element).offset(),
92
+ left = jqOffset.left,
93
+ top = jqOffset.top;
94
+
95
+ equals(SC.pointInElement({x: left + offsetAdjust, y: top + offsetAdjust}, element, 'padding'), values[0], 'point {left: %@, top: %@} within the element\'s padding'.fmt(offsetAdjust, offsetAdjust));
96
+ equals(SC.pointInElement({x: left + offsetAdjust, y: top + offsetAdjust}, element, 'border'), values[1], 'point {left: %@, top: %@} within the element\'s padding'.fmt(offsetAdjust, offsetAdjust));
97
+ equals(SC.pointInElement({x: left + offsetAdjust, y: top + offsetAdjust}, element, 'margin'), values[2], 'point {left: %@, top: %@} within the element\'s padding'.fmt(offsetAdjust, offsetAdjust));
98
+ }
99
+
100
+ test("A plain child element", function() {
101
+ var view = pane.view('plain child'),
102
+ parentEl = view.$(),
103
+ childEl = view.$('.child');
104
+
105
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
106
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
107
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
108
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
109
+ runChecks(childEl, -1, [false, false, false]); // Test 1px off the top left corner of the child
110
+ runChecks(childEl, 0, [true, true, true]); // Test the top left corner of the child
111
+ runChecks(childEl, 1, [true, true, true]); // Test 1px in the top left corner of the child
112
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
113
+ });
114
+
115
+ test("A padded child element", function() {
116
+ var view = pane.view('padded child'),
117
+ parentEl = view.$(),
118
+ childEl = view.$('.child');
119
+
120
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
121
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
122
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
123
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
124
+ runChecks(childEl, -1, [false, false, false]); // Test 1px off the top left corner of the child
125
+ runChecks(childEl, 0, [true, true, true]); // Test the top left corner of the child
126
+ runChecks(childEl, 1, [true, true, true]); // Test 1px in the top left corner of the child
127
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
128
+ });
129
+
130
+ test("A bordered child element", function() {
131
+ var view = pane.view('bordered child'),
132
+ parentEl = view.$(),
133
+ childEl = view.$('.child');
134
+
135
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
136
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
137
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
138
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
139
+ runChecks(childEl, -1, [false, false, false]); // Test 1px off the top left corner of the child
140
+ runChecks(childEl, 0, [false, true, true]); // Test the top left corner of the child
141
+ runChecks(childEl, 1, [false, true, true]); // Test 1px in the top left corner of the child
142
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
143
+ });
144
+
145
+ test("A margined child element", function() {
146
+ var view = pane.view('margined child'),
147
+ parentEl = view.$(),
148
+ childEl = view.$('.child');
149
+
150
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
151
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
152
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
153
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
154
+ runChecks(childEl, -1, [false, false, true]); // Test 1px off the top left corner of the child
155
+ runChecks(childEl, 0, [true, true, true]); // Test the top left corner of the child
156
+ runChecks(childEl, 1, [true, true, true]); // Test 1px in the top left corner of the child
157
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
158
+ });
159
+
160
+ test("A margined positioned child element", function() {
161
+ var view = pane.view('margined positioned child'),
162
+ parentEl = view.$(),
163
+ childEl = view.$('.child');
164
+
165
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
166
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
167
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
168
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
169
+ runChecks(childEl, -1, [false, false, true]); // Test 1px off the top left corner of the child
170
+ runChecks(childEl, 0, [true, true, true]); // Test the top left corner of the child
171
+ runChecks(childEl, 1, [true, true, true]); // Test 1px in the top left corner of the child
172
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
173
+ });
174
+
175
+ test("A padded bordered child element", function() {
176
+ var view = pane.view('padded bordered child'),
177
+ parentEl = view.$(),
178
+ childEl = view.$('.child');
179
+
180
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
181
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
182
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
183
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
184
+ runChecks(childEl, -1, [false, false, false]); // Test 1px off the top left corner of the child
185
+ runChecks(childEl, 0, [false, true, true]); // Test the top left corner of the child
186
+ runChecks(childEl, 1, [false, true, true]); // Test 1px in the top left corner of the child
187
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
188
+ });
189
+
190
+ test("A bordered margined child element", function() {
191
+ var view = pane.view('bordered margined child'),
192
+ parentEl = view.$(),
193
+ childEl = view.$('.child');
194
+
195
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
196
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
197
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
198
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
199
+ runChecks(childEl, -1, [false, false, true]); // Test 1px off the top left corner of the child
200
+ runChecks(childEl, 0, [false, true, true]); // Test the top left corner of the child
201
+ runChecks(childEl, 1, [false, true, true]); // Test 1px in the top left corner of the child
202
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
203
+ });
204
+
205
+ test("A padded margined child element", function() {
206
+ var view = pane.view('padded margined child'),
207
+ parentEl = view.$(),
208
+ childEl = view.$('.child');
209
+
210
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
211
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
212
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
213
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
214
+ runChecks(childEl, -1, [false, false, true]); // Test 1px off the top left corner of the child
215
+ runChecks(childEl, 0, [true, true, true]); // Test the top left corner of the child
216
+ runChecks(childEl, 1, [true, true, true]); // Test 1px in the top left corner of the child
217
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
218
+ });
219
+
220
+ test("A padded bordered margined child element", function() {
221
+ var view = pane.view('padded bordered margined child'),
222
+ parentEl = view.$(),
223
+ childEl = view.$('.child');
224
+
225
+ runChecks(parentEl, -1, [false, false, false]); // Test 1px off the top left corner of the parent
226
+ runChecks(parentEl, 0, [true, true, true]); // Test the top left corner of the parent
227
+ runChecks(parentEl, 1, [true, true, true]); // Test 1px in the top left corner of the parent
228
+ runChecks(childEl, -11, [false, false, false]); // Test 11px off the top left corner of the child
229
+ runChecks(childEl, -1, [false, false, true]); // Test 1px off the top left corner of the child
230
+ runChecks(childEl, 0, [false, true, true]); // Test the top left corner of the child
231
+ runChecks(childEl, 1, [false, true, true]); // Test 1px in the top left corner of the child
232
+ runChecks(childEl, 11, [true, true, true]); // Test 11px in the top left corner of the child
233
+ });
234
+
235
+ })();