sproutcore 1.0.1003 → 1.0.1008
Sign up to get free protection for your applications and to get access to all the features.
- data/Buildfile +15 -3
- data/Rakefile +3 -7
- data/VERSION.yml +2 -2
- data/buildtasks/manifest.rake +2 -0
- data/frameworks/sproutcore/Buildfile +2 -0
- data/frameworks/sproutcore/HISTORY +218 -203
- data/frameworks/sproutcore/README +47 -6
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
- data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
- data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
- data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
- data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
- data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
- data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
- data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
- data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
- data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
- data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
- data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
- data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
- data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
- data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
- data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
- data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
- data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
- data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
- data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
- data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
- data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
- data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
- data/frameworks/sproutcore/lib/index.rhtml +6 -20
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
- data/gen/data-source/Buildfile +18 -0
- data/gen/data-source/README +1 -0
- data/gen/data-source/USAGE +15 -0
- data/gen/data-source/templates/data_sources/@filename@.js +64 -0
- data/lib/sproutcore/builders/combine.rb +23 -0
- data/lib/sproutcore/builders/javascript.rb +27 -2
- data/lib/sproutcore/buildfile/task.rb +1 -1
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +79 -0
- data/lib/sproutcore/models/manifest.rb +2 -2
- data/lib/sproutcore/models/target.rb +1 -1
- data/lib/sproutcore/tools/build.rb +1 -1
- data/lib/sproutcore/tools/docs.rb +3 -3
- data/lib/sproutcore/tools/gen.rb +17 -15
- data/lib/sproutcore/tools/manifest.rb +9 -9
- data/lib/sproutcore/tools/server.rb +3 -3
- data/lib/sproutcore/tools.rb +259 -250
- data/lib/sproutcore.rb +9 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
- data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
- data/spec/lib/models/manifest/find_entry.rb +12 -0
- data/spec/lib/tools/gen_spec.rb +1 -0
- data/spec/lib/tools/tools_spec.rb +1 -0
- data/sproutcore-abbot.gemspec +36 -44
- metadata +43 -44
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/lib/thor/CHANGELOG.rdoc +0 -52
- data/lib/thor/LICENSE +0 -20
- data/lib/thor/README.markdown +0 -76
- data/lib/thor/Rakefile +0 -6
- data/lib/thor/Thorfile +0 -45
- data/lib/thor/bin/rake2thor +0 -83
- data/lib/thor/bin/thor +0 -7
- data/lib/thor/lib/thor/error.rb +0 -3
- data/lib/thor/lib/thor/options.rb +0 -267
- data/lib/thor/lib/thor/ordered_hash.rb +0 -64
- data/lib/thor/lib/thor/runner.rb +0 -305
- data/lib/thor/lib/thor/task.rb +0 -83
- data/lib/thor/lib/thor/task_hash.rb +0 -22
- data/lib/thor/lib/thor/tasks/package.rb +0 -18
- data/lib/thor/lib/thor/tasks.rb +0 -77
- data/lib/thor/lib/thor/util.rb +0 -75
- data/lib/thor/lib/thor.rb +0 -170
- data/lib/thor/script/destroy +0 -14
- data/lib/thor/script/generate +0 -14
- data/lib/thor/spec/fixtures/task.thor +0 -10
- data/lib/thor/spec/options_spec.rb +0 -271
- data/lib/thor/spec/ordered_hash_spec.rb +0 -84
- data/lib/thor/spec/spec.opts +0 -1
- data/lib/thor/spec/spec_helper.rb +0 -30
- data/lib/thor/spec/task_spec.rb +0 -11
- data/lib/thor/spec/tasks_spec.rb +0 -28
- data/lib/thor/spec/thor_runner_spec.rb +0 -194
- data/lib/thor/spec/thor_spec.rb +0 -206
- data/lib/thor/spec/util_spec.rb +0 -99
- data/lib/thor/task.thor +0 -15
- data/lib/thor/thor.gemspec +0 -29
@@ -133,7 +133,7 @@ SC.mixin( /** @scope SC */ {
|
|
133
133
|
rectsEqual: function(r1, r2, delta) {
|
134
134
|
if (!r1 || !r2) return (r1 == r2) ;
|
135
135
|
|
136
|
-
if (delta
|
136
|
+
if (delta === null) delta = 0.1;
|
137
137
|
if ((r1.y != r2.y) && (Math.abs(r1.y - r2.y) > delta)) return NO ;
|
138
138
|
if ((r1.x != r2.x) && (Math.abs(r1.x - r2.x) > delta)) return NO ;
|
139
139
|
if ((r1.width != r2.width) && (Math.abs(r1.width - r2.width) > delta)) return NO ;
|
@@ -243,6 +243,44 @@ SC.mixin( /** @scope SC */ {
|
|
243
243
|
return '{' + keyValues.join(', ') + '}';
|
244
244
|
},
|
245
245
|
|
246
|
+
/**
|
247
|
+
Given a string and a fixed width, calculates the height of that
|
248
|
+
block of text using a style string, a set of class names,
|
249
|
+
or both.
|
250
|
+
|
251
|
+
@param str {String} The text to calculate
|
252
|
+
@param width {Number} The fixed width to assume the text will fill
|
253
|
+
@param style {String} A CSS style declaration. E.g., 'font-weight: bold'
|
254
|
+
@param classNames {Array} An array of class names that may affect the style
|
255
|
+
@returns {Number} The height of the text given the passed parameters
|
256
|
+
*/
|
257
|
+
heightForString: function(str, width, style, classNames) {
|
258
|
+
var elem = this._heightCalcElement, classes, height;
|
259
|
+
|
260
|
+
// Coalesce the array of class names to one string, if the array exists
|
261
|
+
classes = (classNames && SC.typeOf(classNames) === SC.T_ARRAY) ? classNames.join(' ') : '';
|
262
|
+
|
263
|
+
if (!width) width = 100; // default to 100 pixels
|
264
|
+
|
265
|
+
// Only create the offscreen element once, then cache it
|
266
|
+
if (!elem) {
|
267
|
+
elem = this._heightCalcElement = document.createElement('div');
|
268
|
+
document.body.insertBefore(elem, null);
|
269
|
+
}
|
270
|
+
|
271
|
+
style = '%@; width: %@px; left: %@px; position: absolute'.fmt(style, width, (-1*width));
|
272
|
+
elem.setAttribute('style', style);
|
273
|
+
|
274
|
+
if (classes !== '') {
|
275
|
+
elem.setAttribute('class', classes);
|
276
|
+
}
|
277
|
+
|
278
|
+
elem.textContent = str;
|
279
|
+
height = elem.clientHeight;
|
280
|
+
|
281
|
+
elem = null; // don't leak memory
|
282
|
+
return height;
|
283
|
+
},
|
246
284
|
|
247
285
|
/** Finds the absolute viewportOffset for a given element.
|
248
286
|
This method is more accurate than the version provided by prototype.
|
@@ -340,8 +378,8 @@ SC.mixin( /** @scope SC */ {
|
|
340
378
|
/** Returns the union of two ranges. If one range is null, the other
|
341
379
|
range will be returned. */
|
342
380
|
unionRanges: function(r1, r2) {
|
343
|
-
if ((r1
|
344
|
-
if ((r2
|
381
|
+
if ((r1 === null) || (r1.length < 0)) return r2 ;
|
382
|
+
if ((r2 === null) || (r2.length < 0)) return r1 ;
|
345
383
|
|
346
384
|
var min = Math.min(r1.start, r2.start) ;
|
347
385
|
var max = Math.max(SC.maxRange(r1), SC.maxRange(r2)) ;
|
@@ -350,7 +388,7 @@ SC.mixin( /** @scope SC */ {
|
|
350
388
|
|
351
389
|
/** Returns the intersection of the two ranges or SC.RANGE_NOT_FOUND */
|
352
390
|
intersectRanges: function(r1, r2) {
|
353
|
-
if ((r1
|
391
|
+
if ((r1 === null) || (r2 === null)) return SC.RANGE_NOT_FOUND ;
|
354
392
|
if ((r1.length < 0) || (r2.length < 0)) return SC.RANGE_NOT_FOUND;
|
355
393
|
var min = Math.max(SC.minRange(r1), SC.minRange(r2)) ;
|
356
394
|
var max = Math.min(SC.maxRange(r1), SC.maxRange(r2)) ;
|
@@ -360,7 +398,7 @@ SC.mixin( /** @scope SC */ {
|
|
360
398
|
|
361
399
|
/** Returns the difference of the two ranges or SC.RANGE_NOT_FOUND */
|
362
400
|
subtractRanges: function(r1, r2) {
|
363
|
-
if ((r1
|
401
|
+
if ((r1 === null) || (r2 === null)) return SC.RANGE_NOT_FOUND ;
|
364
402
|
if ((r1.length < 0) || (r2.length < 0)) return SC.RANGE_NOT_FOUND;
|
365
403
|
var max = Math.max(SC.minRange(r1), SC.minRange(r2)) ;
|
366
404
|
var min = Math.min(SC.maxRange(r1), SC.maxRange(r2)) ;
|
@@ -378,8 +416,8 @@ SC.mixin( /** @scope SC */ {
|
|
378
416
|
*/
|
379
417
|
rangesEqual: function(r1, r2) {
|
380
418
|
if (r1===r2) return true ;
|
381
|
-
if (r1
|
382
|
-
if (r2
|
419
|
+
if (r1 === null) return r2.length < 0 ;
|
420
|
+
if (r2 === null) return r1.length < 0 ;
|
383
421
|
return (r1.start == r2.start) && (r1.length == r2.length) ;
|
384
422
|
},
|
385
423
|
|
@@ -411,7 +449,7 @@ SC.mixin( /** @scope SC */ {
|
|
411
449
|
|
412
450
|
var h = (max == min) ? 0 : ((max == rgb[0]) ? ((rgb[1]-rgb[2])/(max-min)/6) : ((max == rgb[1]) ? ((rgb[2]-rgb[0])/(max-min)/6+1/3) : ((rgb[0]-rgb[1])/(max-min)/6+2/3)));
|
413
451
|
h = (h < 0) ? (h + 1) : ((h > 1) ? (h - 1) : h);
|
414
|
-
var s = (max
|
452
|
+
var s = (max === 0) ? 0 : (1 - min/max);
|
415
453
|
var v = max/255;
|
416
454
|
return [h, s, v];
|
417
455
|
},
|
@@ -163,11 +163,28 @@ test("arrangedObjects", function() {
|
|
163
163
|
equals(controller.get("arrangedObjects"), controller, 'c.arrangedObjects should return receiver');
|
164
164
|
});
|
165
165
|
|
166
|
+
test("array orderBy using function", function(){
|
167
|
+
var testFunc = function(a,b){
|
168
|
+
if(a.get('title') > b.get('title')) return -1;
|
169
|
+
else if (a.get('title') == b.get('title')) return 0;
|
170
|
+
else return 1;
|
171
|
+
};
|
172
|
+
var expected = content.slice();
|
173
|
+
expected.sort(testFunc);
|
174
|
+
|
175
|
+
var testController = SC.ArrayController.create({
|
176
|
+
content: content,
|
177
|
+
orderBy: testFunc
|
178
|
+
});
|
179
|
+
same(testController.get('arrangedObjects').toArray(), expected, 'arrangedObjects should be sortable by a custom function');
|
180
|
+
});
|
181
|
+
|
166
182
|
// ..........................................................
|
167
183
|
// ADD SPECIAL CASES HERE
|
168
184
|
//
|
169
185
|
|
170
186
|
|
187
|
+
|
171
188
|
// ..........................................................
|
172
189
|
// VERIFY SC.ARRAY COMPLIANCE
|
173
190
|
//
|
@@ -5,12 +5,13 @@
|
|
5
5
|
// License: Licened under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
/*globals throws */
|
8
|
+
/*globals throws should_throw*/
|
9
9
|
|
10
10
|
var content, controller, extra;
|
11
11
|
|
12
12
|
var TestObject = SC.Object.extend({
|
13
13
|
title: "test",
|
14
|
+
xFactor: "THETA",
|
14
15
|
toString: function() { return "TestObject(%@)".fmt(this.get("title")); }
|
15
16
|
});
|
16
17
|
|
@@ -25,7 +26,7 @@ module("SC.ArrayController - enum_case - EMPTY SET", {
|
|
25
26
|
controller = SC.ArrayController.create({
|
26
27
|
content: content, orderBy: "title"
|
27
28
|
});
|
28
|
-
extra = TestObject.create({ title: "FOO" });
|
29
|
+
extra = TestObject.create({ title: "FOO", xFactor: "ZED" });
|
29
30
|
},
|
30
31
|
|
31
32
|
teardown: function() {
|
@@ -81,7 +82,6 @@ test("arrangedObjects", function() {
|
|
81
82
|
equals(controller.get("arrangedObjects"), controller, 'c.arrangedObjects should return receiver');
|
82
83
|
});
|
83
84
|
|
84
|
-
|
85
85
|
// ..........................................................
|
86
86
|
// NON-EMPTY SET
|
87
87
|
//
|
@@ -90,13 +90,13 @@ module("SC.ArrayController - enum_case - NON-EMPTY SET", {
|
|
90
90
|
setup: function() {
|
91
91
|
content = SC.Set.create();
|
92
92
|
"1 2 3 4 5".w().forEach(function(x) {
|
93
|
-
content.add(TestObject.create({ title: x }));
|
93
|
+
content.add(TestObject.create({ title: x, xFactor: (5-x) }));
|
94
94
|
});
|
95
95
|
|
96
96
|
controller = SC.ArrayController.create({
|
97
97
|
content: content, orderBy: "title"
|
98
98
|
});
|
99
|
-
extra = TestObject.create({ title: "FOO" });
|
99
|
+
extra = TestObject.create({ title: "FOO", xFactor: 0 });
|
100
100
|
},
|
101
101
|
|
102
102
|
teardown: function() {
|
@@ -187,6 +187,19 @@ test("arrangedObjects", function() {
|
|
187
187
|
equals(controller.get("arrangedObjects"), controller, 'c.arrangedObjects should return receiver');
|
188
188
|
});
|
189
189
|
|
190
|
+
|
191
|
+
test("modifying orderBy should build order", function() {
|
192
|
+
|
193
|
+
var cnt = 0 ;
|
194
|
+
controller.addObserver('[]', this, function() { cnt++; });
|
195
|
+
same(controller.getEach('title'), '1 2 3 4 5'.w(), 'initially should be ordered by title');
|
196
|
+
|
197
|
+
cnt = 0;
|
198
|
+
controller.set('orderBy', 'xFactor');
|
199
|
+
equals(cnt, 1, 'should have fired observer on enumerable');
|
200
|
+
same(controller.getEach('title'), '5 4 3 2 1'.w(), 'should be ordered reverse');
|
201
|
+
});
|
202
|
+
|
190
203
|
// ..........................................................
|
191
204
|
// ADD SPECIAL CASES HERE
|
192
205
|
//
|
@@ -42,7 +42,6 @@ function performLayoutTest(layout, no_f, no_s, with_f, with_s) {
|
|
42
42
|
child.set('layout', layout) ;
|
43
43
|
|
44
44
|
// test
|
45
|
-
same(child.get('frame'), no_f, "FRAME NO PARENT".fmt(SC.inspect(child.get('frame')), SC.inspect(no_f))) ;
|
46
45
|
keys.forEach(function(key) {
|
47
46
|
equals(child.get('layoutStyle')[key], no_s[key], "STYLE NO PARENT %@".fmt(key)) ;
|
48
47
|
});
|
@@ -53,7 +52,6 @@ function performLayoutTest(layout, no_f, no_s, with_f, with_s) {
|
|
53
52
|
SC.RunLoop.end();
|
54
53
|
|
55
54
|
// test again
|
56
|
-
same(child.get('frame'), with_f, "FRAME WITH PARENT".fmt(SC.inspect(child.get('frame')), SC.inspect(with_f))) ;
|
57
55
|
keys.forEach(function(key) {
|
58
56
|
equals(child.get('layoutStyle')[key], with_s[key], "STYLE NO PARENT %@".fmt(key)) ;
|
59
57
|
});
|
@@ -15,3 +15,14 @@ test("'one two three'.w() with extra spaces between words => ['one','two',
|
|
15
15
|
same('one two three'.w(), ['one','two','three'], "should be equal");
|
16
16
|
});
|
17
17
|
|
18
|
+
test("Trim ' spaces on both sides '", function() {
|
19
|
+
same(' spaces on both sides '.trim(), 'spaces on both sides', "should be equal");
|
20
|
+
});
|
21
|
+
|
22
|
+
test("Trim ' spaces on both sides ' on left only", function() {
|
23
|
+
same(' spaces on both sides '.trimLeft(), 'spaces on both sides ', "should be equal");
|
24
|
+
});
|
25
|
+
|
26
|
+
test("Trim ' spaces on both sides ' on right only", function() {
|
27
|
+
same(' spaces on both sides '.trimRight(), ' spaces on both sides', "should be equal");
|
28
|
+
});
|
data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
8
|
// The TreeItemObserver is tested based on the common use cases.
|
9
|
-
/*globals throws */
|
9
|
+
/*globals throws should_throw*/
|
10
10
|
|
11
11
|
var content, delegate, flattened, obs, extra, extrachild, root;
|
12
12
|
|
@@ -126,19 +126,19 @@ module("SC.TreeItemObserver - Group Use Case", {
|
|
126
126
|
});
|
127
127
|
|
128
128
|
flattened = [
|
129
|
-
content[0],
|
130
|
-
content[0].children[0],
|
131
|
-
content[0].children[1],
|
132
|
-
content[0].children[2],
|
133
|
-
content[0].children[3],
|
134
|
-
content[0].children[4],
|
135
|
-
content[1],
|
136
|
-
content[1].children[0],
|
137
|
-
content[1].children[1],
|
138
|
-
content[1].children[2],
|
139
|
-
content[1].children[3],
|
140
|
-
content[1].children[4],
|
141
|
-
content[2]];
|
129
|
+
content[0], // 0
|
130
|
+
content[0].children[0], // 1
|
131
|
+
content[0].children[1], // 2
|
132
|
+
content[0].children[2], // 3
|
133
|
+
content[0].children[3], // 4
|
134
|
+
content[0].children[4], // 5
|
135
|
+
content[1], // 6
|
136
|
+
content[1].children[0], // 7
|
137
|
+
content[1].children[1], // 8
|
138
|
+
content[1].children[2], // 9
|
139
|
+
content[1].children[3], // 10
|
140
|
+
content[1].children[4], // 11
|
141
|
+
content[2]]; // 12
|
142
142
|
|
143
143
|
delegate = Delegate.create();
|
144
144
|
|
@@ -29,13 +29,13 @@ test("To check if the set of array elements are pushed into stack",function(){
|
|
29
29
|
|
30
30
|
test("create a new builder subclass with any passed properties copied to the builder's 'fn' property",function(){
|
31
31
|
obj =SC.Builder.create({ name : 'Charles'});
|
32
|
-
fn_name =obj.fn.name;
|
32
|
+
var fn_name =obj.fn.name;
|
33
33
|
equals(fn_name,"Charles","name should match");
|
34
34
|
});
|
35
35
|
|
36
36
|
test("instantiate the builder, any passed args will be forwarded onto an internal init() method",function(){
|
37
37
|
obj = new SC.Builder({name : 'Charles',age :23, sex :'M'});
|
38
|
-
objA =obj.fn.init();
|
38
|
+
var objA =obj.fn.init();
|
39
39
|
equals(objA.name,obj.fn.name);
|
40
40
|
equals(objA.age,obj.fn.age);
|
41
41
|
equals(objA.sex,obj.fn.sex);
|
@@ -659,10 +659,16 @@ test("width()", function() {
|
|
659
659
|
equals($div.width(), 30, "Test padding specified with pixels");
|
660
660
|
$div.css("border", "2px solid #fff");
|
661
661
|
equals($div.width(), 30, "Test border specified with pixels");
|
662
|
+
|
663
|
+
// IE is off by one on this. We don't really care at this point since ems
|
664
|
+
// is not really central to most SC apps.
|
662
665
|
$div.css("padding", "2em");
|
663
|
-
|
666
|
+
var e = SC.browser.msie ? 29 : 30;
|
667
|
+
equals($div.width(), e, "Test padding specified with ems");
|
668
|
+
|
664
669
|
$div.css("border", "1em solid #fff");
|
665
670
|
equals($div.width(), 30, "Test border specified with ems");
|
671
|
+
|
666
672
|
$div.css("padding", "2%");
|
667
673
|
equals($div.width(), 30, "Test padding specified with percent");
|
668
674
|
$div.hide();
|
@@ -687,8 +693,13 @@ test("height()", function() {
|
|
687
693
|
equals($div.height(), 30, "Test padding specified with pixels");
|
688
694
|
$div.css("border", "2px solid #fff");
|
689
695
|
equals($div.height(), 30, "Test border specified with pixels");
|
696
|
+
|
697
|
+
// IE is off by one on this. We don't really care at this point since ems
|
698
|
+
// is not really central to most SC apps.
|
690
699
|
$div.css("padding", "2em");
|
691
|
-
|
700
|
+
var e = SC.browser.msie ? 29 : 30;
|
701
|
+
equals($div.height(), e, "Test padding specified with ems");
|
702
|
+
|
692
703
|
$div.css("border", "1em solid #fff");
|
693
704
|
equals($div.height(), 30, "Test border specified with ems");
|
694
705
|
$div.css("padding", "2%");
|
@@ -1064,9 +1075,10 @@ test("filter()", function() {
|
|
1064
1075
|
});
|
1065
1076
|
|
1066
1077
|
test("not()", function() {
|
1067
|
-
expect(
|
1078
|
+
expect(8);
|
1068
1079
|
|
1069
1080
|
// NOTE: These two tests were altered to use simpler selectors.
|
1081
|
+
equals( SC.$("#main p#ap a").length, 4, 'base before not should return A');
|
1070
1082
|
equals( SC.$("#main p#ap a").not("#google").length, 3, "not('selector')" );
|
1071
1083
|
equals( SC.$("#main p#ap a").not(document.getElementById("google")).length, 3, "not(DOMElement)" );
|
1072
1084
|
|
@@ -10,7 +10,7 @@ var ms, options, dt, timezones;
|
|
10
10
|
|
11
11
|
module("SC.DateTime", {
|
12
12
|
setup: function() {
|
13
|
-
ms =
|
13
|
+
ms = 484387222925; // 1985-05-08T01:00:22-07:00
|
14
14
|
options = {year: 1985, month: 5, day: 8, hour: 1, minute: 0, second: 22, millisecond: 925, timezone: SC.DateTime.timezone};
|
15
15
|
dt = SC.DateTime.create(options);
|
16
16
|
timezones = [480, 420, 0, -60, -120, -330]; // PST, PDT, UTC, CET, CEST, Mumbai
|
@@ -1,3 +1,5 @@
|
|
1
|
+
|
2
|
+
var LocaleObject;
|
1
3
|
module("object.SC.Locale()", {
|
2
4
|
setup: function() {
|
3
5
|
|
@@ -5,7 +7,7 @@ module("object.SC.Locale()", {
|
|
5
7
|
init: function(){
|
6
8
|
sc_super();
|
7
9
|
//hash of new languages
|
8
|
-
newLocales = { deflang: 'dl'};
|
10
|
+
var newLocales = { deflang: 'dl'};
|
9
11
|
|
10
12
|
//Added the new languages to the existing list of locales
|
11
13
|
SC.Locale.addStrings(newLocales);
|
@@ -37,7 +39,7 @@ test("Locale.addStrings() : Should be able to add the passed hash of strings to
|
|
37
39
|
equals(false, SC.Locale.options().strings.chinese === 'zh' && SC.Locale.options().strings.dutch === 'nl') ;
|
38
40
|
|
39
41
|
//hash of new languages
|
40
|
-
newLocales = { chinese: 'zh', czech: 'cs', dutch: 'nl'};
|
42
|
+
var newLocales = { chinese: 'zh', czech: 'cs', dutch: 'nl'};
|
41
43
|
|
42
44
|
//Added the new languages to the existing list of locales
|
43
45
|
SC.Locale.addStrings(newLocales);
|
@@ -49,7 +51,7 @@ test("Locale.addStrings() : Should be able to add the passed hash of strings to
|
|
49
51
|
test("Locale.options() : Should provide the registered locales that have not been instantiated", function() {
|
50
52
|
|
51
53
|
//hash of new languages
|
52
|
-
newLocales = { jamican: 'ji', korean: 'ko'};
|
54
|
+
var newLocales = { jamican: 'ji', korean: 'ko'};
|
53
55
|
|
54
56
|
//Added the new languages to the existing list of locales
|
55
57
|
SC.Locale.addStrings(newLocales);
|
@@ -69,7 +71,7 @@ test("Locale.normalizeLanguage() : Should provide the two character language cod
|
|
69
71
|
equals(SC.Locale.normalizeLanguage('English'), 'en') ;
|
70
72
|
|
71
73
|
//For any other code passed which is not in the default code it should return as it was passed
|
72
|
-
equals(SC.Locale.normalizeLanguage('ab'), 'ab') ;
|
74
|
+
equals(SC.Locale.normalizeLanguage('ab'), 'ab') ;
|
73
75
|
});
|
74
76
|
|
75
77
|
test("Locale.toString() : Should retrun the current language set with the guid value", function() {
|
@@ -78,8 +80,7 @@ test("Locale.toString() : Should retrun the current language set with the guid v
|
|
78
80
|
|
79
81
|
//Result should retrun the chinese object
|
80
82
|
equals(SC.Locale.locales.mx.currentLocale.isObject, true) ;
|
81
|
-
|
82
|
-
equals(SC.Locale.locales.mx.toString(), 'SC.Locale[mx]') ;
|
83
|
+
|
83
84
|
});
|
84
85
|
|
85
86
|
test("Locale.createCurrentLocale() : Should create the Lacale Object for the language selected", function() {
|
@@ -119,7 +120,7 @@ test("Locale.extend() : Should make sure important properties of Locale object a
|
|
119
120
|
SC.Locale.locales['mn'] = SC.Locale.extend({ _deprecatedLanguageCodes: ['newlang'] }) ;
|
120
121
|
|
121
122
|
//hash of new languages
|
122
|
-
testLocales = { test: 'te', newtest: 'nt'};
|
123
|
+
var testLocales = { test: 'te', newtest: 'nt'};
|
123
124
|
//Added the new languages to the existing list of locales through the new locale object
|
124
125
|
SC.Locale.locales.mn.addStrings(testLocales);
|
125
126
|
|
@@ -22,8 +22,9 @@ test("should emit a self closing tag. like calling begin().end()", function() {
|
|
22
22
|
|
23
23
|
test("should respect passed opts when emitting", function() {
|
24
24
|
context.tag("foo") ;
|
25
|
-
equals(context.length,
|
26
|
-
equals(context.get(1), "<foo
|
25
|
+
equals(context.length, 3);
|
26
|
+
equals(context.get(1), "<foo>");
|
27
|
+
equals(context.get(2), '<'+'/foo>');
|
27
28
|
});
|
28
29
|
|
29
30
|
test("should NOT emit self closing tag if tag is script", function() {
|
@@ -14,100 +14,107 @@ module("SC.Request", {
|
|
14
14
|
},
|
15
15
|
|
16
16
|
teardown: function() {
|
17
|
-
|
18
|
-
delete request ;
|
19
|
-
delete contents ;
|
17
|
+
url = request = contents;
|
20
18
|
}
|
21
19
|
|
22
20
|
});
|
23
21
|
|
24
22
|
test("Basic Requirements", function() {
|
25
23
|
ok(SC.Request, "SC.Request is defined") ;
|
26
|
-
ok(""
|
24
|
+
ok("" !== url, "url variable is not empty") ;
|
27
25
|
ok(request !== null, "request object is not null") ;
|
28
26
|
ok(contents === null, "contents is null" ) ;
|
29
27
|
});
|
30
28
|
|
31
29
|
test("Test Asynchronous GET Request", function() {
|
32
|
-
|
33
|
-
|
30
|
+
|
31
|
+
var response, timer;
|
32
|
+
|
33
|
+
timer = setTimeout(function() {
|
34
|
+
ok(false, 'response did not invoke notify() withint 2sec');
|
35
|
+
window.start();
|
36
|
+
}, 2000);
|
37
|
+
|
38
|
+
request.notify(this, function(response) {
|
39
|
+
ok(SC.ok(response), 'response should not be an error');
|
40
|
+
equals(response.get('body'), '{"message": "Yay!"}', 'should match retrieved message');
|
41
|
+
clearTimeout(timer);
|
42
|
+
window.start();
|
34
43
|
});
|
35
44
|
|
36
|
-
request.send()
|
45
|
+
response = request.send();
|
46
|
+
ok(response !== null, 'request.send() should return a response object');
|
47
|
+
ok(response.get('status')<0, 'response should still not have a return code since this should be async');
|
37
48
|
|
38
|
-
stop() ; // stops the test runner
|
39
|
-
setTimeout( function(){
|
40
|
-
ok(contents !== null, 'request.send() should return a response') ;
|
41
|
-
ok(SC.$ok(contents), 'contents should not be an error ');
|
42
|
-
if (SC.$ok(contents)) equals(contents.responseText, '{"message": "Yay!"}', "should match retrieved message") ;
|
43
|
-
window.start() ; // starts the test runner
|
44
|
-
}, 2000); // a shorter timeout fails when a lot of unit tests are running...
|
49
|
+
stop() ; // stops the test runner - wait for response
|
45
50
|
});
|
46
51
|
|
47
52
|
test("Test Synchronous GET Request", function() {
|
48
53
|
|
49
54
|
request.set("isAsynchronous", NO);
|
50
|
-
request.send();
|
51
|
-
contents = request.get("rawResponse");
|
55
|
+
var response = request.send();
|
52
56
|
|
53
|
-
ok(
|
54
|
-
ok(SC.$ok(
|
55
|
-
|
57
|
+
ok(response !== null, 'send() should return response') ;
|
58
|
+
ok(SC.$ok(response), 'contents should not be an error ');
|
59
|
+
equals(response.get('body'), '{"message": "Yay!"}', 'should match retrieved message') ;
|
56
60
|
});
|
57
61
|
|
58
62
|
test("Test Asynchronous GET Request, auto-deserializing JSON", function() {
|
59
63
|
request.set("isJSON", YES);
|
64
|
+
|
65
|
+
|
66
|
+
var timer;
|
67
|
+
|
68
|
+
timer = setTimeout( function(){
|
69
|
+
ok(false, 'response did not invoke notify()');
|
70
|
+
window.start();
|
71
|
+
}, 1000);
|
60
72
|
|
61
|
-
request.
|
62
|
-
|
73
|
+
request.notify(this, function(response) {
|
74
|
+
ok(SC.ok(response), 'response should not be error');
|
75
|
+
same(response.get('body'), {"message": "Yay!"}, 'repsonse.body');
|
76
|
+
clearTimeout(timer);
|
77
|
+
window.start();
|
63
78
|
});
|
64
79
|
|
65
80
|
request.send();
|
66
81
|
|
67
82
|
stop() ; // stops the test runner
|
68
|
-
|
69
|
-
ok(contents !== null) ;
|
70
|
-
ok(SC.$ok(contents), 'contents should not be an error ');
|
71
|
-
if (SC.$ok(contents)) same({"message": "Yay!"}, contents) ;
|
72
|
-
window.start() ; // starts the test runner
|
73
|
-
}, 1000);
|
83
|
+
|
74
84
|
});
|
75
85
|
|
76
86
|
test("Test Synchronous GET Request, auto-deserializing JSON", function() {
|
77
87
|
request.set("isAsynchronous", false);
|
78
88
|
request.set("isJSON", true);
|
79
89
|
|
80
|
-
request.send();
|
81
|
-
|
82
|
-
var contents = request.get("response");
|
90
|
+
var response = request.send();
|
83
91
|
|
84
|
-
ok(
|
85
|
-
ok(SC
|
86
|
-
|
92
|
+
ok(response !== null, 'response should not be null') ;
|
93
|
+
ok(SC.ok(response), 'contents should not be an error');
|
94
|
+
same(response.get('body'), {"message": "Yay!"}, 'contents should have message') ;
|
87
95
|
});
|
88
96
|
|
89
97
|
|
90
98
|
test("Test if Request body is being auto-serializing to JSON", function() {
|
91
|
-
request.set("isAsynchronous", false);
|
92
|
-
request.set("isJSON", true);
|
93
99
|
var objectToPost={"content": "garbage"};
|
94
|
-
|
95
|
-
|
96
|
-
var jsonEncoded = request.get('
|
97
|
-
var contents = request.get("response");
|
100
|
+
request.set("isJSON", true).set('body', objectToPost);
|
101
|
+
|
102
|
+
var jsonEncoded = request.get('encodedBody');
|
98
103
|
|
99
104
|
equals(jsonEncoded, '{"content":"garbage"}', "The json object passed in send should be encoded and set as the body");
|
100
105
|
});
|
101
106
|
|
102
|
-
|
107
|
+
|
103
108
|
test("Test Multiple Asynchronous GET Request - two immediate, and two in serial", function() {
|
104
109
|
var requestCount = 3;
|
105
110
|
var responseCount = 0;
|
111
|
+
var serialCount = 0;
|
106
112
|
|
107
113
|
var observer = function(response) {
|
108
114
|
responseCount++;
|
109
|
-
if(
|
110
|
-
|
115
|
+
if (serialCount<=2) {
|
116
|
+
serialCount++;
|
117
|
+
SC.Request.getUrl(url).notify(this, observer).send();
|
111
118
|
requestCount++;
|
112
119
|
}
|
113
120
|
};
|
@@ -119,8 +126,8 @@ test("Test Multiple Asynchronous GET Request - two immediate, and two in serial"
|
|
119
126
|
|
120
127
|
stop() ; // stops the test runner
|
121
128
|
setTimeout( function(){
|
122
|
-
equals(requestCount, 6, "requestCount should be
|
123
|
-
equals(responseCount, 6, "responseCount should be
|
129
|
+
equals(requestCount, 6, "requestCount should be 6");
|
130
|
+
equals(responseCount, 6, "responseCount should be 6");
|
124
131
|
window.start() ; // starts the test runne
|
125
132
|
}, 2000);
|
126
133
|
});
|
data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js
CHANGED
@@ -173,8 +173,8 @@ test("no target, explicit pane, no first responder", function() {
|
|
173
173
|
equals(r.targetForAction('bar', null, null, pane), null,
|
174
174
|
'should NOT return child view');
|
175
175
|
|
176
|
-
equals(r.targetForAction('paneAction', null, null, pane),
|
177
|
-
'should
|
176
|
+
equals(r.targetForAction('paneAction', null, null, pane), pane,
|
177
|
+
'should return pane');
|
178
178
|
|
179
179
|
equals(r.targetForAction('defaultAction', null, null, pane),
|
180
180
|
defaultResponder, 'should return defaultResponder');
|
@@ -7,7 +7,7 @@ module("Timer.isPaused") ;
|
|
7
7
|
|
8
8
|
test("setting isPaused should stop firing", function() {
|
9
9
|
|
10
|
-
var firedCount = 0 ;
|
10
|
+
var firedCount = 0, f1, f2, f3 ;
|
11
11
|
|
12
12
|
SC.RunLoop.begin() ;
|
13
13
|
var start = SC.RunLoop.currentRunLoop.get('startTime') ;
|
@@ -21,7 +21,7 @@ test("setting isPaused should stop firing", function() {
|
|
21
21
|
|
22
22
|
// wait for timer to fire twice, then pause it.
|
23
23
|
var tries1 = 10 ;
|
24
|
-
|
24
|
+
f1 = function f1() {
|
25
25
|
if(firedCount<2) {
|
26
26
|
if (--tries1 >= 0) {
|
27
27
|
setTimeout(f1, 100) ;
|
@@ -38,7 +38,7 @@ test("setting isPaused should stop firing", function() {
|
|
38
38
|
};
|
39
39
|
|
40
40
|
// once timer paused, make sure it did not fire again.
|
41
|
-
|
41
|
+
f2 = function f2() {
|
42
42
|
equals(0, firedCount, 'timer kept firing!') ;
|
43
43
|
equals(YES, t.get('isPaused'), 'timer is not paused') ;
|
44
44
|
t.set('isPaused', NO) ;
|
@@ -47,7 +47,7 @@ test("setting isPaused should stop firing", function() {
|
|
47
47
|
|
48
48
|
// once timer has verified paused, unpause and make sure it fires again.
|
49
49
|
var tries2 = 10 ;
|
50
|
-
|
50
|
+
f3 = function f3() {
|
51
51
|
if (firedCount <= 2) {
|
52
52
|
if (--tries2 >= 0) {
|
53
53
|
setTimeout(f3, 100) ;
|