sproutit-sproutcore 1.0.0.20090407205609 → 1.0.0.20090408130025
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/frameworks/sproutcore/Buildfile +63 -0
- data/frameworks/sproutcore/HISTORY +682 -0
- data/frameworks/sproutcore/README +22 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/controllers/docs.js +149 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/core.js +16 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/body.css +17 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/body.js +99 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/images/sproutcore-logo.png +0 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/main.js +27 -0
- data/frameworks/sproutcore/apps/sc_jsdoc/models/doc.js +21 -0
- data/frameworks/sproutcore/apps/sc_qunit/controllers/runner.js +209 -0
- data/frameworks/sproutcore/apps/sc_qunit/core.js +16 -0
- data/frameworks/sproutcore/apps/sc_qunit/english.lproj/body.css +17 -0
- data/frameworks/sproutcore/apps/sc_qunit/english.lproj/body.js +107 -0
- data/frameworks/sproutcore/apps/sc_qunit/english.lproj/images/sproutcore-logo.png +0 -0
- data/frameworks/sproutcore/apps/sc_qunit/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/apps/sc_qunit/main.js +18 -0
- data/frameworks/sproutcore/apps/sc_qunit/models/test.js +24 -0
- data/frameworks/sproutcore/apps/sc_qunit/views/test_iframe.js +52 -0
- data/frameworks/sproutcore/apps/tests/controllers/targets.js +47 -0
- data/frameworks/sproutcore/apps/tests/controllers/test.js +20 -0
- data/frameworks/sproutcore/apps/tests/controllers/tests.js +38 -0
- data/frameworks/sproutcore/apps/tests/core.js +35 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/loading.rhtml +9 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +19 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +86 -0
- data/frameworks/sproutcore/apps/tests/english.lproj/strings.js +17 -0
- data/frameworks/sproutcore/apps/tests/fixtures/target.js +43 -0
- data/frameworks/sproutcore/apps/tests/fixtures/test.js +43 -0
- data/frameworks/sproutcore/apps/tests/main.js +39 -0
- data/frameworks/sproutcore/apps/tests/models/target.js +49 -0
- data/frameworks/sproutcore/apps/tests/models/test.js +20 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/targets.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/test.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/controllers/tests.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/models/target.js +15 -0
- data/frameworks/sproutcore/apps/tests/tests/models/test.js +15 -0
- data/frameworks/sproutcore/apps/welcome/core.js +23 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/loading.rhtml +8 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +43 -0
- data/frameworks/sproutcore/apps/welcome/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/apps/welcome/main.js +36 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +15819 -0
- data/frameworks/sproutcore/design/Record State Table.numbers +0 -0
- data/frameworks/sproutcore/frameworks/datastore/core.js +14 -0
- data/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +113 -0
- data/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +256 -0
- data/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +196 -0
- data/frameworks/sproutcore/frameworks/datastore/debug/json.js +71 -0
- data/frameworks/sproutcore/frameworks/datastore/debug/standard_setup.js +96 -0
- data/frameworks/sproutcore/frameworks/datastore/fixtures/author_fixtures.js +2503 -0
- data/frameworks/sproutcore/frameworks/datastore/fixtures/sample.js +17 -0
- data/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +92 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +38 -0
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +430 -0
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +361 -0
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +305 -0
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +128 -0
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +149 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +1689 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +86 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/contact_model.js +114 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/mail_model.js +91 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/integration/test_runner_model.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +73 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/readAttribute.js +48 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +42 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +138 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +46 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +71 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +115 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +40 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +116 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +135 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/dataHashDidChange.js +110 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +99 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +180 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readEditableDataHash.js +126 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/removeDataHash.js +163 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +166 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +175 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +54 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +126 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +127 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +57 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +78 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +247 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +106 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +21 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +61 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +74 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/readEditableDataHash.js +74 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +74 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/removeDataHash.js +144 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +137 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/writeDataHash.js +130 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +1 -0
- data/frameworks/sproutcore/frameworks/deprecated/core.js +61 -0
- data/frameworks/sproutcore/frameworks/deprecated/lib/button_views.rb +330 -0
- data/frameworks/sproutcore/frameworks/deprecated/lib/collection_view.rb +83 -0
- data/frameworks/sproutcore/frameworks/deprecated/lib/core_views.rb +326 -0
- data/frameworks/sproutcore/frameworks/deprecated/lib/form_views.rb +253 -0
- data/frameworks/sproutcore/frameworks/deprecated/lib/index.rhtml +75 -0
- data/frameworks/sproutcore/frameworks/deprecated/lib/menu_views.rb +93 -0
- data/frameworks/sproutcore/frameworks/deprecated/server/rails_server.js +80 -0
- data/frameworks/sproutcore/frameworks/deprecated/server/rest_server.js +178 -0
- data/frameworks/sproutcore/frameworks/deprecated/server/server.js +674 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/animator.js +679 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/binding.js +36 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/browser.js +77 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/classic_responder.js +314 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/event.js +60 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/globals.js +20 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/misc.js +60 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/node_descriptor.js +72 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/object.js +124 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/path_module.js +433 -0
- data/frameworks/sproutcore/frameworks/deprecated/system/string.js +109 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/application/application.rhtml +125 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml +401 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/frame.rhtml +357 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml +147 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/base.rhtml +298 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/incremental_rendering.rhtml +260 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/source_list_rendering.rhtml +143 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/popup_button.rhtml +128 -0
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/text_field.rhtml +37 -0
- data/frameworks/sproutcore/frameworks/deprecated/views/collection.js +24 -0
- data/frameworks/sproutcore/frameworks/designer/coders/design.js +30 -0
- data/frameworks/sproutcore/frameworks/designer/coders/localization.js +28 -0
- data/frameworks/sproutcore/frameworks/designer/coders/object.js +347 -0
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +102 -0
- data/frameworks/sproutcore/frameworks/designer/css/css_rule.js +22 -0
- data/frameworks/sproutcore/frameworks/designer/css/css_style.js +29 -0
- data/frameworks/sproutcore/frameworks/designer/css/css_style_sheet.js +201 -0
- data/frameworks/sproutcore/frameworks/designer/ext/page.js +88 -0
- data/frameworks/sproutcore/frameworks/designer/ext/view.js +40 -0
- data/frameworks/sproutcore/frameworks/designer/views/controls/button.js +18 -0
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +553 -0
- data/frameworks/sproutcore/frameworks/designer/views/label.js +17 -0
- data/frameworks/sproutcore/frameworks/designer/views/mixins/button.js +13 -0
- data/frameworks/sproutcore/frameworks/designer/views/tab.js +17 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +6 -0
- data/frameworks/sproutcore/frameworks/desktop/debug/drag.js +41 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +56 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/a_sample_image.jpg +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/apple-logo1.jpeg +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/iframe.html +23 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +71 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +943 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/blank.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_222222.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_454545.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_888888.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/mini_ffffff.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-x.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/panels/sprite-y.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/000000.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/standard_fade/ffffff.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +156 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +83 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +99 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/palette.css +3 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +94 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +39 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +31 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +10 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/scroller.css +26 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +141 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +19 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +57 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/split.css +70 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/split_divider.css +8 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/text_field.css +29 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/toolbar.css +6 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/border.js +53 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +22 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_item.js +22 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +226 -0
- data/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +247 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +377 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +504 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/modal.js +68 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/palette.js +63 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +184 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +402 -0
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +46 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +39 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +81 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +175 -0
- data/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +280 -0
- data/frameworks/sproutcore/frameworks/desktop/system/drag.js +721 -0
- data/frameworks/sproutcore/frameworks/desktop/system/key_bindings.js +40 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +641 -0
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +187 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/integration/dialog.js +43 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +152 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +57 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +36 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +40 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +80 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +38 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +45 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +140 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +145 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +99 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +39 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +64 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/grid/ui.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui.js +110 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +255 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js +44 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/methods.js +128 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +240 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +113 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +202 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +139 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +111 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +63 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/ui.js +70 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +94 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +206 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +81 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +85 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +37 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/ui.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +50 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +52 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +54 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +88 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/text_field/methods.js +76 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/text_field/ui.js +198 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/web/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/views/web/ui.js +110 -0
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +320 -0
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +98 -0
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +2141 -0
- data/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +44 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +595 -0
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +199 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +706 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +523 -0
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +437 -0
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +62 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +207 -0
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +332 -0
- data/frameworks/sproutcore/frameworks/desktop/views/scene.js +56 -0
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +648 -0
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +203 -0
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +509 -0
- data/frameworks/sproutcore/frameworks/desktop/views/select_field.js +292 -0
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +37 -0
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +178 -0
- data/frameworks/sproutcore/frameworks/desktop/views/source_list.js +1117 -0
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +169 -0
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +651 -0
- data/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +55 -0
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +190 -0
- data/frameworks/sproutcore/frameworks/desktop/views/text_field.js +233 -0
- data/frameworks/sproutcore/frameworks/desktop/views/thumb.js +49 -0
- data/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +49 -0
- data/frameworks/sproutcore/frameworks/desktop/views/web.js +86 -0
- data/frameworks/sproutcore/frameworks/foundation/TESTING +46 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +490 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/controller.js +317 -0
- data/frameworks/sproutcore/frameworks/foundation/controllers/object.js +421 -0
- data/frameworks/sproutcore/frameworks/foundation/core.js +111 -0
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +172 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/blank.gif +0 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +53 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +55 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +5 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/debug/control-test-pane.css +8 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-logo.png +0 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/static_layout.css +5 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +40 -0
- data/frameworks/sproutcore/frameworks/foundation/ext/object.js +81 -0
- data/frameworks/sproutcore/frameworks/foundation/ext/run_loop.js +158 -0
- data/frameworks/sproutcore/frameworks/foundation/fixtures/file_exists.json +1 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +291 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +88 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/control.js +352 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +146 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/responder.js +156 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +154 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +101 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +237 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +176 -0
- data/frameworks/sproutcore/frameworks/foundation/panes/main.js +47 -0
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +555 -0
- data/frameworks/sproutcore/frameworks/foundation/protocols/inline_editor_delegate.js +84 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +244 -0
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +64 -0
- data/frameworks/sproutcore/frameworks/foundation/system/builder.js +210 -0
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +2015 -0
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +129 -0
- data/frameworks/sproutcore/frameworks/foundation/system/error.js +93 -0
- data/frameworks/sproutcore/frameworks/foundation/system/event.js +817 -0
- data/frameworks/sproutcore/frameworks/foundation/system/image_cache.js +433 -0
- data/frameworks/sproutcore/frameworks/foundation/system/json.js +440 -0
- data/frameworks/sproutcore/frameworks/foundation/system/locale.js +288 -0
- data/frameworks/sproutcore/frameworks/foundation/system/page.js +106 -0
- data/frameworks/sproutcore/frameworks/foundation/system/ready.js +189 -0
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +865 -0
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +255 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +368 -0
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +446 -0
- data/frameworks/sproutcore/frameworks/foundation/system/time.js +478 -0
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +549 -0
- data/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +158 -0
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +330 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array.js +118 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/controller.js +268 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/object.js +433 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/ui.js +113 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +113 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/content.js +195 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js +89 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/content.js +168 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +89 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +42 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +1323 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_dimensions.js +387 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_selector.js +405 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js +49 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/within.js +66 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/error.js +41 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/json.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +128 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js +47 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js +44 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/end.js +119 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/get.js +51 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js +50 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_basic.js +28 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_className.js +179 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +100 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/init.js +55 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/join.js +28 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/push_text.js +74 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +45 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/update.js +205 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +89 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeKeyPane.js +124 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeMainPane.js +68 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/root_responder.js +97 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +238 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/routes.js +33 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js +38 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invokeLater.js +201 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +71 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +67 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/schedule.js +170 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/user_defaults.js +27 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/normalizeURL.js +18 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/system/utils/range.js +62 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +35 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js +21 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +47 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/password.js +13 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +10 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +83 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +39 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/main_pane.js +31 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +89 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/firstResponder.js +148 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/keyPane.js +133 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/sendEvent.js +165 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +132 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertFrames.js +246 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createChildViews.js +87 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/createLayer.js +97 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +85 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +52 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/init.js +50 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +200 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisibleInWindow.js +102 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layer.js +150 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutChildViews.js +162 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutDidChange.js +127 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +248 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/parentViewDidChange.js +67 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/prepareContext.js +166 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/removeChild.js +189 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/render.js +83 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/replaceChild.js +29 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayer.js +142 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayerLocation.js +194 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/viewDidResize.js +185 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +125 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/date.js +52 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/email.js +45 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js +33 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/number.js +82 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +86 -0
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +311 -0
- data/frameworks/sproutcore/frameworks/foundation/views/container.js +136 -0
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +276 -0
- data/frameworks/sproutcore/frameworks/foundation/views/image.js +158 -0
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +261 -0
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +2160 -0
- data/frameworks/sproutcore/frameworks/mobile/english.lproj/core.css +12 -0
- data/frameworks/sproutcore/frameworks/mobile/lib/index.rhtml +126 -0
- data/frameworks/sproutcore/frameworks/mobile/system/root_responder.js +109 -0
- data/frameworks/sproutcore/frameworks/mobile/tests/views/button/ui.js +9 -0
- data/frameworks/sproutcore/frameworks/mobile/views/button.js +190 -0
- data/frameworks/sproutcore/frameworks/runtime/README +11 -0
- data/frameworks/sproutcore/frameworks/runtime/core.js +777 -0
- data/frameworks/sproutcore/frameworks/runtime/license.js +28 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/array.js +403 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/delegate_support.js +70 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1193 -0
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1149 -0
- data/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +135 -0
- data/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +108 -0
- data/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +128 -0
- data/frameworks/sproutcore/frameworks/runtime/protocols/sparse_array_delegate.js +131 -0
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +891 -0
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +107 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +783 -0
- data/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +99 -0
- data/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +214 -0
- data/frameworks/sproutcore/frameworks/runtime/system/set.js +246 -0
- data/frameworks/sproutcore/frameworks/runtime/system/sparse_array.js +286 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +56 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +23 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/clone.js +66 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +147 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/inspect.js +27 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +25 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +38 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/keys.js +20 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +30 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +19 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +37 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable.js +592 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +467 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +123 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +79 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +80 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/array.js +263 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +190 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/base.js +135 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +339 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +120 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/set.js +313 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +84 -0
- data/frameworks/sproutcore/frameworks/testing/core.js +13 -0
- data/frameworks/sproutcore/frameworks/testing/english.lproj/additions.css +8 -0
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +131 -0
- data/frameworks/sproutcore/frameworks/testing/extras.js +43 -0
- data/frameworks/sproutcore/frameworks/testing/jquery.js +3559 -0
- data/frameworks/sproutcore/frameworks/testing/qunit.js +819 -0
- data/frameworks/sproutcore/frameworks/testing/tests/debug/qunit.js +25 -0
- data/frameworks/sproutcore/frameworks/testing/utils.js +55 -0
- data/frameworks/sproutcore/lib/index.rhtml +118 -0
- data/frameworks/sproutcore/license.js +28 -0
- data/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +69 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/button.css +41 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/backButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/blueButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/cancel.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/grayButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/leftButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrow.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrowSel.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listGroup.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/loading.gif +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/pinstripes.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/rightButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/selection.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/thumb.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggle.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggleOn.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolbar.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/whiteButton.png +0 -0
- data/frameworks/sproutcore/themes/iphone_theme/english.lproj/strings.js +15 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/Data +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Preview.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Thumbnail.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +333 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +90 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +53 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/core.css +47 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +55 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-toolbar-view.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/label.css +37 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/pane.css +8 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-fat.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/background-thin.jpg +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-left-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/bottom-right-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/left-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/overlay.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/right-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-edge.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-left-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/panels/top-right-corner.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +23 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +113 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +141 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/slider.css +62 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +27 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +12 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +13 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/toolbar.css +4 -0
- data/lib/thor/.autotest +7 -0
- data/lib/thor/CHANGELOG.rdoc +52 -0
- data/lib/thor/LICENSE +20 -0
- data/lib/thor/README.markdown +76 -0
- data/lib/thor/Rakefile +6 -0
- data/lib/thor/Thorfile +45 -0
- data/lib/thor/bin/rake2thor +83 -0
- data/lib/thor/bin/thor +7 -0
- data/lib/thor/lib/thor/error.rb +3 -0
- data/lib/thor/lib/thor/options.rb +267 -0
- data/lib/thor/lib/thor/ordered_hash.rb +64 -0
- data/lib/thor/lib/thor/runner.rb +305 -0
- data/lib/thor/lib/thor/task.rb +83 -0
- data/lib/thor/lib/thor/task_hash.rb +22 -0
- data/lib/thor/lib/thor/tasks/package.rb +18 -0
- data/lib/thor/lib/thor/tasks.rb +77 -0
- data/lib/thor/lib/thor/util.rb +75 -0
- data/lib/thor/lib/thor.rb +170 -0
- data/lib/thor/script/destroy +14 -0
- data/lib/thor/script/generate +14 -0
- data/lib/thor/spec/fixtures/task.thor +10 -0
- data/lib/thor/spec/options_spec.rb +271 -0
- data/lib/thor/spec/ordered_hash_spec.rb +84 -0
- data/lib/thor/spec/spec.opts +1 -0
- data/lib/thor/spec/spec_helper.rb +30 -0
- data/lib/thor/spec/task_spec.rb +11 -0
- data/lib/thor/spec/tasks_spec.rb +28 -0
- data/lib/thor/spec/thor_runner_spec.rb +194 -0
- data/lib/thor/spec/thor_spec.rb +206 -0
- data/lib/thor/spec/util_spec.rb +99 -0
- data/lib/thor/task.thor +15 -0
- data/lib/thor/thor.gemspec +29 -0
- metadata +3 -4
- data/sproutcore.gemspec +0 -47
@@ -0,0 +1,1323 @@
|
|
1
|
+
// ========================================================================
|
2
|
+
// CoreQuery Tests
|
3
|
+
// ========================================================================
|
4
|
+
|
5
|
+
/*
|
6
|
+
This test file incorporates most of the changes that come bundled with the
|
7
|
+
jQuery-core suite of tests, modified to fit CoreQuery's reduced API.
|
8
|
+
|
9
|
+
You should be able to update most of these tests with updated versons of the
|
10
|
+
same tests in jQuery.
|
11
|
+
*/
|
12
|
+
|
13
|
+
htmlbody('<!-- Test Styles -->\
|
14
|
+
<style>\
|
15
|
+
body, div, h1 { font-family: "trebuchet ms", verdana, arial; margin: 0; padding: 0 }\
|
16
|
+
body {font-size: 10pt; }\
|
17
|
+
h1 { padding: 15px; font-size: large; background-color: #06b; color: white; }\
|
18
|
+
h1 a { color: white; }\
|
19
|
+
h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }\
|
20
|
+
\
|
21
|
+
.pass { color: green; } \
|
22
|
+
.fail { color: red; } \
|
23
|
+
p.result { margin-left: 1em; }\
|
24
|
+
\
|
25
|
+
#banner { height: 2em; border-bottom: 1px solid white; }\
|
26
|
+
h2.pass { background-color: green; }\
|
27
|
+
h2.fail { background-color: red; }\
|
28
|
+
\
|
29
|
+
div.testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; }\
|
30
|
+
\
|
31
|
+
ol#tests > li > strong { cursor:pointer; }\
|
32
|
+
\
|
33
|
+
div#fx-tests h4 {\
|
34
|
+
background: red;\
|
35
|
+
}\
|
36
|
+
\
|
37
|
+
div#fx-tests h4.pass {\
|
38
|
+
background: green;\
|
39
|
+
}\
|
40
|
+
\
|
41
|
+
div#fx-tests div.box {\
|
42
|
+
background: red url(data/cow.jpg) no-repeat;\
|
43
|
+
overflow: hidden;\
|
44
|
+
border: 2px solid #000;\
|
45
|
+
}\
|
46
|
+
\
|
47
|
+
div#fx-tests div.overflow {\
|
48
|
+
overflow: visible;\
|
49
|
+
}\
|
50
|
+
\
|
51
|
+
div.inline {\
|
52
|
+
display: inline;\
|
53
|
+
}\
|
54
|
+
\
|
55
|
+
div.autoheight {\
|
56
|
+
height: auto;\
|
57
|
+
}\
|
58
|
+
\
|
59
|
+
div.autowidth {\
|
60
|
+
width: auto;\
|
61
|
+
}\
|
62
|
+
\
|
63
|
+
div.autoopacity {\
|
64
|
+
opacity: auto;\
|
65
|
+
}\
|
66
|
+
\
|
67
|
+
div.largewidth {\
|
68
|
+
width: 100px;\
|
69
|
+
}\
|
70
|
+
\
|
71
|
+
div.largeheight {\
|
72
|
+
height: 100px;\
|
73
|
+
}\
|
74
|
+
\
|
75
|
+
div.largeopacity {\
|
76
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);\
|
77
|
+
}\
|
78
|
+
\
|
79
|
+
div.medwidth {\
|
80
|
+
width: 50px;\
|
81
|
+
}\
|
82
|
+
\
|
83
|
+
div.medheight {\
|
84
|
+
height: 50px;\
|
85
|
+
}\
|
86
|
+
\
|
87
|
+
div.medopacity {\
|
88
|
+
opacity: 0.5;\
|
89
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);\
|
90
|
+
}\
|
91
|
+
\
|
92
|
+
div.nowidth {\
|
93
|
+
width: 0px;\
|
94
|
+
}\
|
95
|
+
\
|
96
|
+
div.noheight {\
|
97
|
+
height: 0px;\
|
98
|
+
}\
|
99
|
+
\
|
100
|
+
div.noopacity {\
|
101
|
+
opacity: 0;\
|
102
|
+
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);\
|
103
|
+
}\
|
104
|
+
\
|
105
|
+
div.hidden {\
|
106
|
+
display: none;\
|
107
|
+
}\
|
108
|
+
\
|
109
|
+
div#fx-tests div.widewidth {\
|
110
|
+
background-repeat: repeat-x;\
|
111
|
+
}\
|
112
|
+
\
|
113
|
+
div#fx-tests div.wideheight {\
|
114
|
+
background-repeat: repeat-y;\
|
115
|
+
}\
|
116
|
+
\
|
117
|
+
div#fx-tests div.widewidth.wideheight {\
|
118
|
+
background-repeat: repeat;\
|
119
|
+
}\
|
120
|
+
\
|
121
|
+
div#fx-tests div.noback {\
|
122
|
+
background-image: none;\
|
123
|
+
}\
|
124
|
+
\
|
125
|
+
div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; }\
|
126
|
+
div.chain div { position: absolute; top: 0px; left: 0px; }\
|
127
|
+
\
|
128
|
+
div.chain.test { background: red; }\
|
129
|
+
div.chain.test div { background: green; }\
|
130
|
+
\
|
131
|
+
div.chain.out { background: green; }\
|
132
|
+
div.chain.out div { background: red; display: none; }\
|
133
|
+
\
|
134
|
+
div#show-tests * { display: none; }\
|
135
|
+
</style>\
|
136
|
+
<!-- Test HTML -->\
|
137
|
+
<div id="nothiddendiv" style="height:1px;background:white;">\
|
138
|
+
<div id="nothiddendivchild"></div>\
|
139
|
+
</div>\
|
140
|
+
<!-- this iframe is outside the #main so it won\'t reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->\
|
141
|
+
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>\
|
142
|
+
<dl id="dl" style="display:none;">\
|
143
|
+
<div id="main" style="display: none;">\
|
144
|
+
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>\
|
145
|
+
<p id="ap">\
|
146
|
+
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>, \
|
147
|
+
<a id="groups" href="http://groups.google.com/">Google Groups</a>. \
|
148
|
+
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>: \
|
149
|
+
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>\
|
150
|
+
\
|
151
|
+
</p>\
|
152
|
+
<div id="foo">\
|
153
|
+
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>\
|
154
|
+
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>\
|
155
|
+
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison\'s Weblog</a></p>\
|
156
|
+
\
|
157
|
+
</div>\
|
158
|
+
<p id="first">Try them out:</p>\
|
159
|
+
<ul id="firstUL"></ul>\
|
160
|
+
<ol id="empty"></ol>\
|
161
|
+
<form id="form" action="formaction">\
|
162
|
+
<input type="text" name="action" value="Test" id="text1" maxlength="30"/>\
|
163
|
+
<input type="text" name="text2" value="Test" id="text2" disabled="disabled"/>\
|
164
|
+
<input type="radio" name="radio1" id="radio1" value="on"/>\
|
165
|
+
\
|
166
|
+
<input type="radio" name="radio2" id="radio2" checked="checked"/>\
|
167
|
+
<input type="checkbox" name="check" id="check1" checked="checked"/>\
|
168
|
+
<input type="checkbox" id="check2" value="on"/>\
|
169
|
+
\
|
170
|
+
<input type="hidden" name="hidden" id="hidden1"/>\
|
171
|
+
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>\
|
172
|
+
\
|
173
|
+
<input type="text" id="name" name="name" value="name" />\
|
174
|
+
\
|
175
|
+
<button id="button" name="button">Button</button>\
|
176
|
+
\
|
177
|
+
<textarea id="area1" maxlength="30">foobar</textarea>\
|
178
|
+
\
|
179
|
+
<select name="select1" id="select1">\
|
180
|
+
<option id="option1a" class="emptyopt" value="">Nothing</option>\
|
181
|
+
<option id="option1b" value="1">1</option>\
|
182
|
+
<option id="option1c" value="2">2</option>\
|
183
|
+
<option id="option1d" value="3">3</option>\
|
184
|
+
</select>\
|
185
|
+
<select name="select2" id="select2">\
|
186
|
+
<option id="option2a" class="emptyopt" value="">Nothing</option>\
|
187
|
+
<option id="option2b" value="1">1</option>\
|
188
|
+
<option id="option2c" value="2">2</option>\
|
189
|
+
<option id="option2d" selected="selected" value="3">3</option>\
|
190
|
+
</select>\
|
191
|
+
<select name="select3" id="select3" multiple="multiple">\
|
192
|
+
<option id="option3a" class="emptyopt" value="">Nothing</option>\
|
193
|
+
<option id="option3b" selected="selected" value="1">1</option>\
|
194
|
+
<option id="option3c" selected="selected" value="2">2</option>\
|
195
|
+
<option id="option3d" value="3">3</option>\
|
196
|
+
<option id="option3e">no value</option>\
|
197
|
+
</select>\
|
198
|
+
\
|
199
|
+
<object id="object1" codebase="stupid">\
|
200
|
+
<param name="p1" value="x1" />\
|
201
|
+
<param name="p2" value="x2" />\
|
202
|
+
</object>\
|
203
|
+
\
|
204
|
+
<span id="台北Táiběi"></span>\
|
205
|
+
<span id="台北" lang="中文"></span>\
|
206
|
+
<span id="utf8class1" class="台北Táiběi 台北"></span>\
|
207
|
+
<span id="utf8class2" class="台北"></span>\
|
208
|
+
<span id="foo:bar" class="foo:bar"></span>\
|
209
|
+
<span id="test.foo[5]bar" class="test.foo[5]bar"></span>\
|
210
|
+
\
|
211
|
+
<foo_bar id="foobar">test element</foo_bar>\
|
212
|
+
</form>\
|
213
|
+
<b id="floatTest">Float test.</b>\
|
214
|
+
<iframe id="iframe" name="iframe"></iframe>\
|
215
|
+
<form id="lengthtest">\
|
216
|
+
<input type="text" id="length" name="test"/>\
|
217
|
+
<input type="text" id="idTest" name="id"/>\
|
218
|
+
</form>\
|
219
|
+
<table id="table"></table>\
|
220
|
+
\
|
221
|
+
<div id="fx-queue">\
|
222
|
+
<div id="fadein" class="chain test">fadeIn<div>fadeIn</div></div>\
|
223
|
+
<div id="fadeout" class="chain test out">fadeOut<div>fadeOut</div></div>\
|
224
|
+
\
|
225
|
+
<div id="show" class="chain test">show<div>show</div></div>\
|
226
|
+
<div id="hide" class="chain test out">hide<div>hide</div></div>\
|
227
|
+
\
|
228
|
+
<div id="togglein" class="chain test">togglein<div>togglein</div></div>\
|
229
|
+
<div id="toggleout" class="chain test out">toggleout<div>toggleout</div> </div>\
|
230
|
+
\
|
231
|
+
\
|
232
|
+
<div id="slideup" class="chain test">slideUp<div>slideUp</div></div>\
|
233
|
+
<div id="slidedown" class="chain test out">slideDown<div>slideDown</div></div>\
|
234
|
+
\
|
235
|
+
<div id="slidetogglein" class="chain test">slideToggleIn<div>slideToggleIn</div></div>\
|
236
|
+
<div id="slidetoggleout" class="chain test out">slideToggleOut<div>slideToggleOut</div></div>\
|
237
|
+
</div>\
|
238
|
+
\
|
239
|
+
<div id="fx-tests"></div>\
|
240
|
+
\
|
241
|
+
<form id="testForm" action="#" method="get">\
|
242
|
+
<textarea name="T3" rows="2" cols="15">?\
|
243
|
+
Z</textarea>\
|
244
|
+
<input type="hidden" name="H1" value="x" />\
|
245
|
+
<input type="hidden" name="H2" />\
|
246
|
+
<input name="PWD" type="password" value="" />\
|
247
|
+
<input name="T1" type="text" />\
|
248
|
+
<input name="T2" type="text" value="YES" readonly="readonly" />\
|
249
|
+
<input type="checkbox" name="C1" value="1" />\
|
250
|
+
<input type="checkbox" name="C2" />\
|
251
|
+
<input type="radio" name="R1" value="1" />\
|
252
|
+
<input type="radio" name="R1" value="2" />\
|
253
|
+
<input type="text" name="My Name" value="me" />\
|
254
|
+
<input type="reset" name="reset" value="NO" />\
|
255
|
+
<select name="S1">\
|
256
|
+
<option value="abc">ABC</option>\
|
257
|
+
<option value="abc">ABC</option>\
|
258
|
+
<option value="abc">ABC</option>\
|
259
|
+
</select>\
|
260
|
+
<select name="S2" multiple="multiple" size="3">\
|
261
|
+
<option value="abc">ABC</option>\
|
262
|
+
<option value="abc">ABC</option>\
|
263
|
+
<option value="abc">ABC</option>\
|
264
|
+
</select>\
|
265
|
+
<select name="S3">\
|
266
|
+
<option selected="selected">YES</option>\
|
267
|
+
</select>\
|
268
|
+
<select name="S4">\
|
269
|
+
<option value="" selected="selected">NO</option>\
|
270
|
+
</select>\
|
271
|
+
<input type="submit" name="sub1" value="NO" />\
|
272
|
+
<input type="submit" name="sub2" value="NO" />\
|
273
|
+
<input type="image" name="sub3" value="NO" />\
|
274
|
+
<button name="sub4" type="submit" value="NO">NO</button>\
|
275
|
+
<input name="D1" type="text" value="NO" disabled="disabled" />\
|
276
|
+
<input type="checkbox" checked="checked" disabled="disabled" name="D2" value="NO" />\
|
277
|
+
<input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" />\
|
278
|
+
<select name="D4" disabled="disabled">\
|
279
|
+
<option selected="selected" value="NO">NO</option>\
|
280
|
+
</select>\
|
281
|
+
</form>\
|
282
|
+
<div id="moretests">\
|
283
|
+
<form>\
|
284
|
+
<div id="checkedtest" style="display:none;">\
|
285
|
+
<input type="radio" class="radio" name="checkedtestradios" checked="checked"/>\
|
286
|
+
<input type="radio" class="radio" name="checkedtestradios" value="on"/>\
|
287
|
+
<input type="checkbox" class="checkbox" name="checkedtestcheckboxes" checked="checked"/>\
|
288
|
+
<input type="checkbox" class="checkbox" name="checkedtestcheckboxes" />\
|
289
|
+
</div>\
|
290
|
+
</form>\
|
291
|
+
<div id="nonnodes"><span>hi</span> there <!-- mon ami --></div>\
|
292
|
+
<div id="t2037">\
|
293
|
+
<div><div class="hidden">hidden</div></div>\
|
294
|
+
</div>\
|
295
|
+
</div>\
|
296
|
+
</div>\
|
297
|
+
</dl>') ;
|
298
|
+
|
299
|
+
module("CQ core");
|
300
|
+
|
301
|
+
test("Basic requirements", function() {
|
302
|
+
expect(7);
|
303
|
+
ok( Array.prototype.push, "Array.push()" );
|
304
|
+
ok( Function.prototype.apply, "Function.apply()" );
|
305
|
+
ok( document.getElementById, "getElementById" );
|
306
|
+
ok( document.getElementsByTagName, "getElementsByTagName" );
|
307
|
+
ok( RegExp, "RegExp" );
|
308
|
+
ok( SC.CoreQuery, "SC.CoreQuery" );
|
309
|
+
ok( SC.$, "SC.$" );
|
310
|
+
});
|
311
|
+
|
312
|
+
test("SC.CoreQuery()", function() {
|
313
|
+
expect(8);
|
314
|
+
|
315
|
+
var main = SC.$("#main");
|
316
|
+
isSet( SC.$("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with SC.$ object as context" );
|
317
|
+
|
318
|
+
var code = SC.$("<code/>");
|
319
|
+
equals( code.length, 1, "Correct number of elements generated for code" );
|
320
|
+
var img = SC.$("<img/>");
|
321
|
+
equals( img.length, 1, "Correct number of elements generated for img" );
|
322
|
+
var div = SC.$("<div/><hr/><code/><b/>");
|
323
|
+
equals( div.length, 4, "Correct number of elements generated for div hr code b" );
|
324
|
+
|
325
|
+
// can actually yield more than one, when iframes are included, the window is an array as well
|
326
|
+
equals( SC.$(window).length, 1, "Correct number of elements generated for window" );
|
327
|
+
|
328
|
+
equals( SC.$(document).length, 1, "Correct number of elements generated for document" );
|
329
|
+
|
330
|
+
equals( SC.$([1,2,3]).get(1), 2, "Test passing an array to the factory" );
|
331
|
+
|
332
|
+
equals( SC.$(document.body).get(0), SC.$('body').get(0), "Test passing an html node to the factory" );
|
333
|
+
});
|
334
|
+
|
335
|
+
test("SC.$('html')", function() {
|
336
|
+
expect(3);
|
337
|
+
|
338
|
+
reset();
|
339
|
+
ok( SC.$("<link rel='stylesheet'/>")[0], "Creating a link" );
|
340
|
+
|
341
|
+
reset();
|
342
|
+
|
343
|
+
var j = SC.$("<span>hi</span> there <!-- mon ami -->");
|
344
|
+
ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
|
345
|
+
|
346
|
+
ok( !SC.$("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
|
347
|
+
});
|
348
|
+
|
349
|
+
test("SC.$('html', context)", function() {
|
350
|
+
expect(1);
|
351
|
+
|
352
|
+
var $div = SC.$("<div/>");
|
353
|
+
var $span = SC.$("<span/>", $div);
|
354
|
+
equals($span.length, 1, "Verify a span created with a div context works, #1763");
|
355
|
+
});
|
356
|
+
|
357
|
+
test("length", function() {
|
358
|
+
expect(1);
|
359
|
+
equals( SC.$("p").length, 6, "Get Number of Elements Found" );
|
360
|
+
});
|
361
|
+
|
362
|
+
test("size()", function() {
|
363
|
+
expect(1);
|
364
|
+
equals( SC.$("p").size(), 6, "Get Number of Elements Found" );
|
365
|
+
});
|
366
|
+
|
367
|
+
test("get()", function() {
|
368
|
+
expect(1);
|
369
|
+
isSet( SC.$("p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
|
370
|
+
});
|
371
|
+
|
372
|
+
test("get(Number)", function() {
|
373
|
+
expect(1);
|
374
|
+
equals( SC.$("p").get(0), document.getElementById("firstp"), "Get A Single Element" );
|
375
|
+
});
|
376
|
+
|
377
|
+
test("add(String|Element|Array|undefined)", function() {
|
378
|
+
expect(12);
|
379
|
+
isSet( SC.$("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
|
380
|
+
isSet( SC.$("#sndp").add( SC.$("#en")[0] ).add( SC.$("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
|
381
|
+
ok( SC.$([]).add(SC.$("#form")[0].elements).length >= 13, "Check elements from array" );
|
382
|
+
|
383
|
+
var x = SC.$([]).add(SC.$("<p id='x1'>xxx</p>")).add(SC.$("<p id='x2'>xxx</p>"));
|
384
|
+
equals( x[0].id, "x1", "Check on-the-fly element1" );
|
385
|
+
equals( x[1].id, "x2", "Check on-the-fly element2" );
|
386
|
+
|
387
|
+
var x = SC.$([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
|
388
|
+
equals( x[0].id, "x1", "Check on-the-fly element1" );
|
389
|
+
equals( x[1].id, "x2", "Check on-the-fly element2" );
|
390
|
+
|
391
|
+
var notDefined;
|
392
|
+
equals( SC.$([]).add(notDefined).length, 0, "Check that undefined adds nothing" );
|
393
|
+
|
394
|
+
// Added after #2811
|
395
|
+
equals( SC.$([]).add([window,document,document.body,document]).length, 3, "Pass an array" );
|
396
|
+
equals( SC.$(document).add(document).length, 1, "Check duplicated elements" );
|
397
|
+
equals( SC.$(window).add(window).length, 1, "Check duplicated elements using the window" );
|
398
|
+
ok( SC.$([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" );
|
399
|
+
});
|
400
|
+
|
401
|
+
test("each(Function)", function() {
|
402
|
+
expect(1);
|
403
|
+
var div = SC.$("div");
|
404
|
+
div.each(function(){this.foo = 'zoo';});
|
405
|
+
var pass = true;
|
406
|
+
for ( var i = 0; i < div.size(); i++ ) {
|
407
|
+
if ( div.get(i).foo != "zoo" ) pass = false;
|
408
|
+
}
|
409
|
+
ok( pass, "Execute a function, Relative" );
|
410
|
+
});
|
411
|
+
|
412
|
+
test("index(Object)", function() {
|
413
|
+
expect(10);
|
414
|
+
|
415
|
+
var elements = SC.$([window, document]),
|
416
|
+
inputElements = SC.$('#radio1,#radio2,#check1,#check2');
|
417
|
+
|
418
|
+
equals( elements.index(window), 0, "Check for index of elements" );
|
419
|
+
equals( elements.index(document), 1, "Check for index of elements" );
|
420
|
+
equals( inputElements.index(document.getElementById('radio1')), 0, "Check for index of elements" );
|
421
|
+
equals( inputElements.index(document.getElementById('radio2')), 1, "Check for index of elements" );
|
422
|
+
equals( inputElements.index(document.getElementById('check1')), 2, "Check for index of elements" );
|
423
|
+
equals( inputElements.index(document.getElementById('check2')), 3, "Check for index of elements" );
|
424
|
+
equals( inputElements.index(window), -1, "Check for not found index" );
|
425
|
+
equals( inputElements.index(document), -1, "Check for not found index" );
|
426
|
+
|
427
|
+
// enabled since [5500]
|
428
|
+
equals( elements.index( elements ), 0, "Pass in a SC.$ object" );
|
429
|
+
equals( elements.index( elements.eq(1) ), 1, "Pass in a SC.$ object" );
|
430
|
+
});
|
431
|
+
|
432
|
+
test("attr(String)", function() {
|
433
|
+
expect(26);
|
434
|
+
equals( SC.$('#text1').attr('value'), "Test", 'Check for value attribute' );
|
435
|
+
equals( SC.$('#text1').attr('value', "Test2").attr('defaultValue'), "Test", 'Check for defaultValue attribute' );
|
436
|
+
equals( SC.$('#text1').attr('type'), "text", 'Check for type attribute' );
|
437
|
+
equals( SC.$('#radio1').attr('type'), "radio", 'Check for type attribute' );
|
438
|
+
equals( SC.$('#check1').attr('type'), "checkbox", 'Check for type attribute' );
|
439
|
+
equals( SC.$('#simon1').attr('rel'), "bookmark", 'Check for rel attribute' );
|
440
|
+
equals( SC.$('#google').attr('title'), "Google!", 'Check for title attribute' );
|
441
|
+
equals( SC.$('#mark').attr('hreflang'), "en", 'Check for hreflang attribute' );
|
442
|
+
equals( SC.$('#en').attr('lang'), "en", 'Check for lang attribute' );
|
443
|
+
equals( SC.$('#simon').attr('class'), "blog link", 'Check for class attribute' );
|
444
|
+
equals( SC.$('#name').attr('name'), "name", 'Check for name attribute' );
|
445
|
+
equals( SC.$('#text1').attr('name'), "action", 'Check for name attribute' );
|
446
|
+
ok( SC.$('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );
|
447
|
+
equals( SC.$('#text1').attr('maxlength'), '30', 'Check for maxlength attribute' );
|
448
|
+
equals( SC.$('#text1').attr('maxLength'), '30', 'Check for maxLength attribute' );
|
449
|
+
equals( SC.$('#area1').attr('maxLength'), '30', 'Check for maxLength attribute' );
|
450
|
+
equals( SC.$('#select2').attr('selectedIndex'), 3, 'Check for selectedIndex attribute' );
|
451
|
+
equals( SC.$('#foo').attr('nodeName'), 'DIV', 'Check for nodeName attribute' );
|
452
|
+
equals( SC.$('#foo').attr('tagName'), 'DIV', 'Check for tagName attribute' );
|
453
|
+
|
454
|
+
SC.$('#main').append(SC.$('<a id="tAnchor5"></a>').attr('href', '#5')); // using innerHTML in IE causes href attribute to be serialized to the full path
|
455
|
+
equals( SC.$('#tAnchor5').attr('href'), "#5", 'Check for non-absolute href (an anchor)' );
|
456
|
+
|
457
|
+
|
458
|
+
// Related to [5574] and [5683]
|
459
|
+
var body = document.body, $body = SC.$(body);
|
460
|
+
|
461
|
+
ok( $body.attr('foo') === undefined, 'Make sure that a non existent attribute returns undefined' );
|
462
|
+
|
463
|
+
// ignore the Firebug console if present...
|
464
|
+
var nextSibling = $body.attr('nextSibling') ;
|
465
|
+
ok( (($body.attr('nextSibling') === null) || (nextSibling.id == '_firebugConsole')), 'Make sure a null expando returns null' );
|
466
|
+
|
467
|
+
body.setAttribute('foo', 'baz');
|
468
|
+
equals( $body.attr('foo'), 'baz', 'Make sure the dom attribute is retrieved when no expando is found' );
|
469
|
+
|
470
|
+
body.foo = 'bar';
|
471
|
+
equals( $body.attr('foo'), 'bar', 'Make sure the expando is preferred over the dom attribute' );
|
472
|
+
|
473
|
+
$body.attr('foo','cool');
|
474
|
+
equals( $body.attr('foo'), 'cool', 'Make sure that setting works well when both expando and dom attribute are available' );
|
475
|
+
|
476
|
+
body.foo = undefined;
|
477
|
+
ok( $body.attr('foo') === undefined, 'Make sure the expando is preferred over the dom attribute, even if undefined' );
|
478
|
+
|
479
|
+
body.removeAttribute('foo'); // Cleanup
|
480
|
+
});
|
481
|
+
|
482
|
+
test("attr(String, Function)", function() {
|
483
|
+
expect(2);
|
484
|
+
equals( SC.$('#text1').attr('value', function() { return this.id; })[0].value, "text1", "Set value from id" );
|
485
|
+
equals( SC.$('#text1').attr('title', function(i) { return i; }).attr('title'), "0", "Set value with an index");
|
486
|
+
});
|
487
|
+
|
488
|
+
test("attr(Hash)", function() {
|
489
|
+
expect(1);
|
490
|
+
var pass = true;
|
491
|
+
SC.$("div").attr({foo: 'baz', zoo: 'ping'}).each(function(){
|
492
|
+
if ( this.getAttribute('foo') != "baz" && this.getAttribute('zoo') != "ping" ) pass = false;
|
493
|
+
});
|
494
|
+
ok( pass, "Set Multiple Attributes" );
|
495
|
+
});
|
496
|
+
|
497
|
+
test("attr(String, Object)", function() {
|
498
|
+
expect(17);
|
499
|
+
var div = SC.$("div").attr("foo", "bar");
|
500
|
+
fail = false;
|
501
|
+
for ( var i = 0; i < div.size(); i++ ) {
|
502
|
+
if ( div.get(i).getAttribute('foo') != "bar" ){
|
503
|
+
fail = i;
|
504
|
+
break;
|
505
|
+
}
|
506
|
+
}
|
507
|
+
equals( fail, false, "Set Attribute, the #"+fail+" element didn't get the attribute 'foo'" );
|
508
|
+
|
509
|
+
ok( SC.$("#foo").attr({"width": null}), "Try to set an attribute to nothing" );
|
510
|
+
|
511
|
+
SC.$("#name").attr('name', 'something');
|
512
|
+
equals( SC.$("#name").attr('name'), 'something', 'Set name attribute' );
|
513
|
+
SC.$("#check2").attr('checked', true);
|
514
|
+
equals( document.getElementById('check2').checked, true, 'Set checked attribute' );
|
515
|
+
SC.$("#check2").attr('checked', false);
|
516
|
+
equals( document.getElementById('check2').checked, false, 'Set checked attribute' );
|
517
|
+
SC.$("#text1").attr('readonly', true);
|
518
|
+
equals( document.getElementById('text1').readOnly, true, 'Set readonly attribute' );
|
519
|
+
SC.$("#text1").attr('readonly', false);
|
520
|
+
equals( document.getElementById('text1').readOnly, false, 'Set readonly attribute' );
|
521
|
+
SC.$("#name").attr('maxlength', '5');
|
522
|
+
equals( document.getElementById('name').maxLength, '5', 'Set maxlength attribute' );
|
523
|
+
SC.$("#name").attr('maxLength', '10');
|
524
|
+
equals( document.getElementById('name').maxLength, '10', 'Set maxlength attribute' );
|
525
|
+
|
526
|
+
// for #1070
|
527
|
+
SC.$("#name").attr('someAttr', '0');
|
528
|
+
equals( SC.$("#name").attr('someAttr'), '0', 'Set attribute to a string of "0"' );
|
529
|
+
SC.$("#name").attr('someAttr', 0);
|
530
|
+
equals( SC.$("#name").attr('someAttr'), 0, 'Set attribute to the number 0' );
|
531
|
+
SC.$("#name").attr('someAttr', 1);
|
532
|
+
equals( SC.$("#name").attr('someAttr'), 1, 'Set attribute to the number 1' );
|
533
|
+
|
534
|
+
// using contents will get comments regular, text, and comment nodes
|
535
|
+
var j = SC.$("#nonnodes").contents();
|
536
|
+
|
537
|
+
j.attr("name", "attrvalue");
|
538
|
+
equals( j.attr("name"), "attrvalue", "Check node,textnode,comment for attr" );
|
539
|
+
j.removeAttr("name");
|
540
|
+
|
541
|
+
reset();
|
542
|
+
|
543
|
+
var type = SC.$("#check2").attr('type');
|
544
|
+
var thrown = false;
|
545
|
+
try {
|
546
|
+
SC.$("#check2").attr('type','hidden');
|
547
|
+
} catch(e) {
|
548
|
+
thrown = true;
|
549
|
+
}
|
550
|
+
ok( thrown, "Exception thrown when trying to change type property" );
|
551
|
+
equals( type, SC.$("#check2").attr('type'), "Verify that you can't change the type of an input element" );
|
552
|
+
|
553
|
+
var check = document.createElement("input");
|
554
|
+
var thrown = true;
|
555
|
+
try {
|
556
|
+
SC.$(check).attr('type','checkbox');
|
557
|
+
} catch(e) {
|
558
|
+
thrown = false;
|
559
|
+
}
|
560
|
+
ok( thrown, "Exception thrown when trying to change type property" );
|
561
|
+
equals( "checkbox", SC.$(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" );
|
562
|
+
});
|
563
|
+
|
564
|
+
test("css(String|Hash)", function() {
|
565
|
+
expect(19);
|
566
|
+
|
567
|
+
equals( SC.$('#main').css("display"), 'none', 'Check for css property "display"');
|
568
|
+
|
569
|
+
ok( SC.$('#foo').isVisible(), 'Modifying CSS display: Assert element is visible');
|
570
|
+
SC.$('#foo').css({display: 'none'});
|
571
|
+
ok( !SC.$('#foo').isVisible(), 'Modified CSS display: Assert element is hidden');
|
572
|
+
SC.$('#foo').css({display: 'block'});
|
573
|
+
ok( SC.$('#foo').isVisible(), 'Modified CSS display: Assert element is visible');
|
574
|
+
|
575
|
+
SC.$('#floatTest').css({styleFloat: 'right'});
|
576
|
+
equals( SC.$('#floatTest').css('styleFloat'), 'right', 'Modified CSS float using "styleFloat": Assert float is right');
|
577
|
+
SC.$('#floatTest').css({cssFloat: 'left'});
|
578
|
+
equals( SC.$('#floatTest').css('cssFloat'), 'left', 'Modified CSS float using "cssFloat": Assert float is left');
|
579
|
+
SC.$('#floatTest').css({'float': 'right'});
|
580
|
+
equals( SC.$('#floatTest').css('float'), 'right', 'Modified CSS float using "float": Assert float is right');
|
581
|
+
SC.$('#floatTest').css({'font-size': '30px'});
|
582
|
+
equals( SC.$('#floatTest').css('font-size'), '30px', 'Modified CSS font-size: Assert font-size is 30px');
|
583
|
+
|
584
|
+
SC.$.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
|
585
|
+
SC.$('#foo').css({opacity: n});
|
586
|
+
equals( SC.$('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
|
587
|
+
SC.$('#foo').css({opacity: parseFloat(n)});
|
588
|
+
equals( SC.$('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
|
589
|
+
});
|
590
|
+
SC.$('#foo').css({opacity: ''});
|
591
|
+
equals( SC.$('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
|
592
|
+
});
|
593
|
+
|
594
|
+
test("css(String, Object)", function() {
|
595
|
+
expect(21);
|
596
|
+
ok( SC.$('#foo').isVisible(), 'Modifying CSS display: Assert element is visible');
|
597
|
+
SC.$('#foo').css('display', 'none');
|
598
|
+
ok( !SC.$('#foo').isVisible(), 'Modified CSS display: Assert element is hidden');
|
599
|
+
SC.$('#foo').css('display', 'block');
|
600
|
+
ok( SC.$('#foo').isVisible(), 'Modified CSS display: Assert element is visible');
|
601
|
+
|
602
|
+
SC.$('#floatTest').css('styleFloat', 'left');
|
603
|
+
equals( SC.$('#floatTest').css('styleFloat'), 'left', 'Modified CSS float using "styleFloat": Assert float is left');
|
604
|
+
SC.$('#floatTest').css('cssFloat', 'right');
|
605
|
+
equals( SC.$('#floatTest').css('cssFloat'), 'right', 'Modified CSS float using "cssFloat": Assert float is right');
|
606
|
+
SC.$('#floatTest').css('float', 'left');
|
607
|
+
equals( SC.$('#floatTest').css('float'), 'left', 'Modified CSS float using "float": Assert float is left');
|
608
|
+
SC.$('#floatTest').css('font-size', '20px');
|
609
|
+
equals( SC.$('#floatTest').css('font-size'), '20px', 'Modified CSS font-size: Assert font-size is 20px');
|
610
|
+
|
611
|
+
SC.$.each("0,0.25,0.5,0.75,1".split(','), function(i, n) {
|
612
|
+
SC.$('#foo').css('opacity', n);
|
613
|
+
equals( SC.$('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a String" );
|
614
|
+
SC.$('#foo').css('opacity', parseFloat(n));
|
615
|
+
equals( SC.$('#foo').css('opacity'), parseFloat(n), "Assert opacity is " + parseFloat(n) + " as a Number" );
|
616
|
+
});
|
617
|
+
SC.$('#foo').css('opacity', '');
|
618
|
+
equals( SC.$('#foo').css('opacity'), '1', "Assert opacity is 1 when set to an empty String" );
|
619
|
+
// for #1438, IE throws JS error when filter exists but doesn't have opacity in it
|
620
|
+
if (SC.browser.msie) {
|
621
|
+
SC.$('#foo').css("filter", "progid:DXImageTransform.Microsoft.Chroma(color='red');");
|
622
|
+
}
|
623
|
+
equals( SC.$('#foo').css('opacity'), '1', "Assert opacity is 1 when a different filter is set in IE, #1438" );
|
624
|
+
|
625
|
+
// using contents will get comments regular, text, and comment nodes
|
626
|
+
var j = SC.$("#nonnodes").contents();
|
627
|
+
j.css("padding-left", "1px");
|
628
|
+
equals( j.css("padding-left"), "1px", "Check node,textnode,comment css works" );
|
629
|
+
|
630
|
+
// opera sometimes doesn't update 'display' correctly, see #2037
|
631
|
+
SC.$("#t2037")[0].innerHTML = SC.$("#t2037")[0].innerHTML ;
|
632
|
+
equals( SC.$("#t2037 .hidden").css("display"), "none", "Make sure browser thinks it is hidden" );
|
633
|
+
});
|
634
|
+
|
635
|
+
test("SC.$.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function () {
|
636
|
+
expect(4);
|
637
|
+
|
638
|
+
var $checkedtest = SC.$("#checkedtest");
|
639
|
+
// IE6 was clearing "checked" in SC.$.css(elem, "height");
|
640
|
+
SC.$.css($checkedtest[0], "height");
|
641
|
+
var input = SC.$("input.radio", $checkedtest);
|
642
|
+
ok( !! SC.$(input[0]).attr("checked"), "Check first radio still checked." );
|
643
|
+
ok( ! SC.$(input[input.length]).attr("checked"), "Check last radio still NOT checked." );
|
644
|
+
|
645
|
+
var input = SC.$("input.checkbox", $checkedtest);
|
646
|
+
ok( !! SC.$(input[0]).attr("checked"), "Check first checkbox still checked." );
|
647
|
+
ok( ! SC.$(input[input.length]).attr("checked"), "Check last checkbox still NOT checked." );
|
648
|
+
});
|
649
|
+
|
650
|
+
test("width()", function() {
|
651
|
+
expect(9);
|
652
|
+
|
653
|
+
var $div = SC.$("#nothiddendiv");
|
654
|
+
$div.width(30);
|
655
|
+
equals($div.width(), 30, "Test set to 30 correctly");
|
656
|
+
$div.width(-1); // handle negative numbers by ignoring #1599
|
657
|
+
equals($div.width(), 30, "Test negative width ignored");
|
658
|
+
$div.css("padding", "20px");
|
659
|
+
equals($div.width(), 30, "Test padding specified with pixels");
|
660
|
+
$div.css("border", "2px solid #fff");
|
661
|
+
equals($div.width(), 30, "Test border specified with pixels");
|
662
|
+
$div.css("padding", "2em");
|
663
|
+
equals($div.width(), 30, "Test padding specified with ems");
|
664
|
+
$div.css("border", "1em solid #fff");
|
665
|
+
equals($div.width(), 30, "Test border specified with ems");
|
666
|
+
$div.css("padding", "2%");
|
667
|
+
equals($div.width(), 30, "Test padding specified with percent");
|
668
|
+
$div.hide();
|
669
|
+
equals($div.width(), 30, "Test hidden div");
|
670
|
+
|
671
|
+
$div.css({ display: "", border: "", padding: "" });
|
672
|
+
|
673
|
+
SC.$("#nothiddendivchild").css({ padding: "3px", border: "2px solid #fff" });
|
674
|
+
equals(SC.$("#nothiddendivchild").width(), 20, "Test child width with border and padding");
|
675
|
+
SC.$("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });
|
676
|
+
});
|
677
|
+
|
678
|
+
test("height()", function() {
|
679
|
+
expect(8);
|
680
|
+
|
681
|
+
var $div = SC.$("#nothiddendiv");
|
682
|
+
$div.height(30);
|
683
|
+
equals($div.height(), 30, "Test set to 30 correctly");
|
684
|
+
$div.height(-1); // handle negative numbers by ignoring #1599
|
685
|
+
equals($div.height(), 30, "Test negative height ignored");
|
686
|
+
$div.css("padding", "20px");
|
687
|
+
equals($div.height(), 30, "Test padding specified with pixels");
|
688
|
+
$div.css("border", "2px solid #fff");
|
689
|
+
equals($div.height(), 30, "Test border specified with pixels");
|
690
|
+
$div.css("padding", "2em");
|
691
|
+
equals($div.height(), 30, "Test padding specified with ems");
|
692
|
+
$div.css("border", "1em solid #fff");
|
693
|
+
equals($div.height(), 30, "Test border specified with ems");
|
694
|
+
$div.css("padding", "2%");
|
695
|
+
equals($div.height(), 30, "Test padding specified with percent");
|
696
|
+
$div.hide();
|
697
|
+
equals($div.height(), 30, "Test hidden div");
|
698
|
+
|
699
|
+
$div.css({ display: "", border: "", padding: "", height: "1px" });
|
700
|
+
});
|
701
|
+
|
702
|
+
test("text()", function() {
|
703
|
+
expect(1);
|
704
|
+
var expected = "This link has class=\"blog\": Simon Willison's Weblog";
|
705
|
+
equals( SC.$('#sap').text(), expected, 'Check for merged text of more then one element.' );
|
706
|
+
});
|
707
|
+
|
708
|
+
test("append(String|Element|Array<Element>|SC.$)", function() {
|
709
|
+
expect(21);
|
710
|
+
var defaultText = 'Try them out:' ;
|
711
|
+
var result = SC.$('#first').append('<b>buga</b>');
|
712
|
+
equals( result.text(), defaultText + 'buga', 'Check if text appending works' );
|
713
|
+
|
714
|
+
var cq = SC.$('#select3').append('<option value="appendTest">Append Test</option>').find('option');
|
715
|
+
equals(SC.$(cq[cq.length-1]).attr('value'), 'appendTest', 'Appending html options to select element');
|
716
|
+
|
717
|
+
reset();
|
718
|
+
var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
|
719
|
+
SC.$('#sap').append(document.getElementById('first'));
|
720
|
+
equals(SC.$('#sap').text(), expected, "Check for appending of element" );
|
721
|
+
|
722
|
+
reset();
|
723
|
+
expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
|
724
|
+
SC.$('#sap').append([document.getElementById('first'), document.getElementById('yahoo')]);
|
725
|
+
equals(SC.$('#sap').text(), expected, "Check for appending of array of elements" );
|
726
|
+
|
727
|
+
reset();
|
728
|
+
expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
|
729
|
+
SC.$('#sap').append(SC.$("#first, #yahoo"));
|
730
|
+
equals( expected, SC.$('#sap').text(), "Check for appending of SC.$ object" );
|
731
|
+
|
732
|
+
reset();
|
733
|
+
SC.$("#sap").append( 5 );
|
734
|
+
ok( SC.$("#sap")[0].innerHTML.match( /5$/ ), "Check for appending a number" );
|
735
|
+
|
736
|
+
reset();
|
737
|
+
SC.$("#sap").append( " text with spaces " );
|
738
|
+
ok( SC.$("#sap")[0].innerHTML.match(/ text with spaces $/), "Check for appending text with spaces" );
|
739
|
+
|
740
|
+
reset();
|
741
|
+
ok( SC.$("#sap").append([]), "Check for appending an empty array." );
|
742
|
+
ok( SC.$("#sap").append(""), "Check for appending an empty string." );
|
743
|
+
ok( SC.$("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." );
|
744
|
+
|
745
|
+
reset();
|
746
|
+
SC.$("#sap").append(document.getElementById('form'));
|
747
|
+
equals( SC.$("#sap>form").size(), 1, "Check for appending a form" ); // Bug #910
|
748
|
+
|
749
|
+
reset();
|
750
|
+
var pass = true;
|
751
|
+
try {
|
752
|
+
SC.$( SC.$("#iframe")[0].contentWindow.document.body ).append("<div>test</div>");
|
753
|
+
} catch(e) {
|
754
|
+
pass = false;
|
755
|
+
}
|
756
|
+
|
757
|
+
ok( pass, "Test for appending a DOM node to the contents of an IFrame" );
|
758
|
+
|
759
|
+
reset();
|
760
|
+
SC.$('<fieldset/>').appendTo('#form').append('<legend id="legend">test</legend>');
|
761
|
+
t( 'Append legend', '#legend', ['legend'] );
|
762
|
+
|
763
|
+
reset();
|
764
|
+
SC.$('#select1').append('<OPTION>Test</OPTION>');
|
765
|
+
equals( SC.$('#select1 option').last().text(), "Test", "Appending <OPTION>; (all caps)" );
|
766
|
+
|
767
|
+
SC.$('#table').append('<colgroup></colgroup>');
|
768
|
+
ok( SC.$('#table colgroup').length, "Append colgroup" );
|
769
|
+
|
770
|
+
SC.$('#table colgroup').append('<col/>');
|
771
|
+
ok( SC.$('#table colgroup col').length, "Append col" );
|
772
|
+
|
773
|
+
reset();
|
774
|
+
SC.$('#table').append('<caption></caption>');
|
775
|
+
ok( SC.$('#table caption').length, "Append caption" );
|
776
|
+
|
777
|
+
reset();
|
778
|
+
SC.$('form').last()
|
779
|
+
.append('<select id="appendSelect1"></select>')
|
780
|
+
.append('<select id="appendSelect2"><option>Test</option></select>');
|
781
|
+
|
782
|
+
t( "Append Select", "#appendSelect1, #appendSelect2", ["appendSelect1", "appendSelect2"] );
|
783
|
+
|
784
|
+
// using contents will get comments regular, text, and comment nodes
|
785
|
+
var j = SC.$("#nonnodes").contents();
|
786
|
+
var d = SC.$("<div/>").appendTo("#nonnodes").append(j);
|
787
|
+
equals( SC.$("#nonnodes").length, 1, "Check node,textnode,comment append moved leaving just the div" );
|
788
|
+
ok( d.contents().length >= 2, "Check node,textnode,comment append works" );
|
789
|
+
d.contents().appendTo("#nonnodes");
|
790
|
+
d.remove();
|
791
|
+
ok( SC.$("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" );
|
792
|
+
});
|
793
|
+
|
794
|
+
test("prepend(String|Element|Array<Element>|SC.$)", function() {
|
795
|
+
expect(5);
|
796
|
+
var defaultText = 'Try them out:' ;
|
797
|
+
var result = SC.$('#first').prepend('<b>buga</b>');
|
798
|
+
equals( result.text(), 'buga' + defaultText, 'Check if text prepending works' );
|
799
|
+
equals( SC.$('#select3').prepend('<option value="prependTest">Prepend Test</option>').find('option').first().attr('value'), 'prependTest', 'Prepending html options to select element');
|
800
|
+
|
801
|
+
reset();
|
802
|
+
var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
|
803
|
+
SC.$('#sap').prepend(document.getElementById('first'));
|
804
|
+
equals( expected, SC.$('#sap').text(), "Check for prepending of element" );
|
805
|
+
|
806
|
+
reset();
|
807
|
+
expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
|
808
|
+
SC.$('#sap').prepend([document.getElementById('first'), document.getElementById('yahoo')]);
|
809
|
+
equals( expected, SC.$('#sap').text(), "Check for prepending of array of elements" );
|
810
|
+
|
811
|
+
reset();
|
812
|
+
expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
|
813
|
+
SC.$('#sap').prepend(SC.$("#first, #yahoo"));
|
814
|
+
equals( expected, SC.$('#sap').text(), "Check for prepending of SC.$ object" );
|
815
|
+
});
|
816
|
+
|
817
|
+
test("before(String|Element|Array<Element>|SC.$)", function() {
|
818
|
+
expect(4);
|
819
|
+
var expected = 'This is a normal link: bugaYahoo';
|
820
|
+
SC.$('#yahoo').before('<b>buga</b>');
|
821
|
+
equals( expected, SC.$('#en').text(), 'Insert String before' );
|
822
|
+
|
823
|
+
reset();
|
824
|
+
expected = "This is a normal link: Try them out:Yahoo";
|
825
|
+
SC.$('#yahoo').before(document.getElementById('first'));
|
826
|
+
equals( expected, SC.$('#en').text(), "Insert element before" );
|
827
|
+
|
828
|
+
reset();
|
829
|
+
expected = "This is a normal link: Try them out:diveintomarkYahoo";
|
830
|
+
SC.$('#yahoo').before([document.getElementById('first'), document.getElementById('mark')]);
|
831
|
+
equals( expected, SC.$('#en').text(), "Insert array of elements before" );
|
832
|
+
|
833
|
+
reset();
|
834
|
+
expected = "This is a normal link: Try them out:diveintomarkYahoo";
|
835
|
+
SC.$('#yahoo').before(SC.$("#first, #mark"));
|
836
|
+
equals( expected, SC.$('#en').text(), "Insert SC.$ before" );
|
837
|
+
});
|
838
|
+
|
839
|
+
test("after(String|Element|Array<Element>|SC.$)", function() {
|
840
|
+
expect(4);
|
841
|
+
var expected = 'This is a normal link: Yahoobuga';
|
842
|
+
SC.$('#yahoo').after('<b>buga</b>');
|
843
|
+
equals( expected, SC.$('#en').text(), 'Insert String after' );
|
844
|
+
|
845
|
+
reset();
|
846
|
+
expected = "This is a normal link: YahooTry them out:";
|
847
|
+
SC.$('#yahoo').after(document.getElementById('first'));
|
848
|
+
equals( expected, SC.$('#en').text(), "Insert element after" );
|
849
|
+
|
850
|
+
reset();
|
851
|
+
expected = "This is a normal link: YahooTry them out:diveintomark";
|
852
|
+
SC.$('#yahoo').after([document.getElementById('first'), document.getElementById('mark')]);
|
853
|
+
equals( expected, SC.$('#en').text(), "Insert array of elements after" );
|
854
|
+
|
855
|
+
reset();
|
856
|
+
expected = "This is a normal link: YahooTry them out:diveintomark";
|
857
|
+
SC.$('#yahoo').after(SC.$("#first, #mark"));
|
858
|
+
equals( expected, SC.$('#en').text(), "Insert SC.$ after" );
|
859
|
+
});
|
860
|
+
|
861
|
+
test("replaceWith(String|Element|Array<Element>|SC.$)", function() {
|
862
|
+
expect(10);
|
863
|
+
SC.$('#yahoo').replaceWith('<b id="replace">buga</b>');
|
864
|
+
ok( SC.$("#replace")[0], 'Replace element with string' );
|
865
|
+
ok( !SC.$("#yahoo")[0], 'Verify that original element is gone, after string' );
|
866
|
+
|
867
|
+
reset();
|
868
|
+
SC.$('#yahoo').replaceWith(document.getElementById('first'));
|
869
|
+
ok( SC.$("#first")[0], 'Replace element with element' );
|
870
|
+
ok( !SC.$("#yahoo")[0], 'Verify that original element is gone, after element' );
|
871
|
+
|
872
|
+
reset();
|
873
|
+
SC.$('#yahoo').replaceWith([document.getElementById('first'), document.getElementById('mark')]);
|
874
|
+
ok( SC.$("#first")[0], 'Replace element with array of elements' );
|
875
|
+
ok( SC.$("#mark")[0], 'Replace element with array of elements' );
|
876
|
+
ok( !SC.$("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
|
877
|
+
|
878
|
+
reset();
|
879
|
+
SC.$('#yahoo').replaceWith(SC.$("#first, #mark"));
|
880
|
+
ok( SC.$("#first")[0], 'Replace element with set of elements' );
|
881
|
+
ok( SC.$("#mark")[0], 'Replace element with set of elements' );
|
882
|
+
ok( !SC.$("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
|
883
|
+
});
|
884
|
+
|
885
|
+
test("end()", function() {
|
886
|
+
expect(3);
|
887
|
+
equals( 'Yahoo', SC.$('#yahoo').parent().end().text(), 'Check for end' );
|
888
|
+
ok( SC.$('#yahoo').end(), 'Check for end with nothing to end' );
|
889
|
+
|
890
|
+
var x = SC.$('#yahoo');
|
891
|
+
x.parent();
|
892
|
+
equals( 'Yahoo', SC.$('#yahoo').text(), 'Check for non-destructive behaviour' );
|
893
|
+
});
|
894
|
+
|
895
|
+
test("find(String)", function() {
|
896
|
+
expect(2);
|
897
|
+
equals( 'Yahoo', SC.$('#foo').find('.blogTest').text(), 'Check for find' );
|
898
|
+
|
899
|
+
// using contents will get comments regular, text, and comment nodes
|
900
|
+
var j = SC.$("#nonnodes").contents();
|
901
|
+
equals( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
|
902
|
+
});
|
903
|
+
|
904
|
+
test("clone()", function() {
|
905
|
+
expect(20);
|
906
|
+
equals( 'This is a normal link: Yahoo', SC.$('#en').text(), 'Assert text for #en' );
|
907
|
+
var clone = SC.$('#yahoo').clone();
|
908
|
+
equals( 'Try them out:Yahoo', SC.$('#first').append(clone).text(), 'Check for clone' );
|
909
|
+
equals( 'This is a normal link: Yahoo', SC.$('#en').text(), 'Reassert text for #en' );
|
910
|
+
|
911
|
+
var cloneTags = [
|
912
|
+
"<table/>", "<tr/>", "<td/>", "<div/>",
|
913
|
+
"<button/>", "<ul/>", "<ol/>", "<li/>",
|
914
|
+
"<input type='checkbox' />", "<select/>", "<option/>", "<textarea/>",
|
915
|
+
"<tbody/>", "<thead/>", "<tfoot/>", "<iframe/>"
|
916
|
+
];
|
917
|
+
for (var i = 0; i < cloneTags.length; i++) {
|
918
|
+
var j = SC.$(cloneTags[i]);
|
919
|
+
equals( j[0].tagName, j.clone()[0].tagName, 'Clone a <' + cloneTags[i].substring(1));
|
920
|
+
}
|
921
|
+
|
922
|
+
// using contents will get comments regular, text, and comment nodes
|
923
|
+
var cl = SC.$("#nonnodes").contents().clone();
|
924
|
+
ok( cl.length >= 2, "Check node,textnode,comment clone works (some browsers delete comments on clone)" );
|
925
|
+
});
|
926
|
+
|
927
|
+
test("is(String)", function() {
|
928
|
+
expect(10);
|
929
|
+
ok( SC.$('#form').is('form'), 'Check for element: A form must be a form' );
|
930
|
+
ok( !SC.$('#form').is('div'), 'Check for element: A form is not a div' );
|
931
|
+
ok( SC.$('#mark').is('.blog'), 'Check for class: Expected class "blog"' );
|
932
|
+
ok( !SC.$('#mark').is('.link'), 'Check for class: Did not expect class "link"' );
|
933
|
+
ok( SC.$('#simon').is('.blog.link'), 'Check for multiple classes: Expected classes "blog" and "link"' );
|
934
|
+
ok( !SC.$('#simon').is('.blogTest'), 'Check for multiple classes: Expected classes "blog" and "link", but not "blogTest"' );
|
935
|
+
|
936
|
+
// not supported in CoreQuery
|
937
|
+
//ok( SC.$('#en').is('[lang="en"]'), 'Check for attribute: Expected attribute lang to be "en"' );
|
938
|
+
//ok( !SC.$('#en').is('[lang="de"]'), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
|
939
|
+
//ok( SC.$('#text1').is('[type="text"]'), 'Check for attribute: Expected attribute type to be "text"' );
|
940
|
+
//ok( !SC.$('#text1').is('[type="radio"]'), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
|
941
|
+
|
942
|
+
//ok( SC.$('#text2').is(':disabled'), 'Check for pseudoclass: Expected to be disabled' );
|
943
|
+
//ok( !SC.$('#text1').is(':disabled'), 'Check for pseudoclass: Expected not disabled' );
|
944
|
+
//ok( SC.$('#radio2').is(':checked'), 'Check for pseudoclass: Expected to be checked' );
|
945
|
+
//ok( !SC.$('#radio1').is(':checked'), 'Check for pseudoclass: Expected not checked' );
|
946
|
+
//ok( SC.$('#foo').is(':has(p)'), 'Check for child: Expected a child "p" element' );
|
947
|
+
//ok( !SC.$('#foo').is(':has(ul)'), 'Check for child: Did not expect "ul" element' );
|
948
|
+
//ok( SC.$('#foo').is(':has(p):has(a):has(code)'), 'Check for childs: Expected "p", "a" and "code" child elements' );
|
949
|
+
//ok( !SC.$('#foo').is(':has(p):has(a):has(code):has(ol)'), 'Check for childs: Expected "p", "a" and "code" child elements, but no "ol"' );
|
950
|
+
ok( !SC.$('#foo').is(0), 'Expected false for an invalid expression - 0' );
|
951
|
+
ok( !SC.$('#foo').is(null), 'Expected false for an invalid expression - null' );
|
952
|
+
ok( !SC.$('#foo').is(''), 'Expected false for an invalid expression - ""' );
|
953
|
+
ok( !SC.$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
|
954
|
+
|
955
|
+
// test is() with comma-seperated expressions
|
956
|
+
//ok( SC.$('#en').is('[lang="en"],[lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
957
|
+
//ok( SC.$('#en').is('[lang="de"],[lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
958
|
+
//ok( SC.$('#en').is('[lang="en"] , [lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
959
|
+
//ok( SC.$('#en').is('[lang="de"] , [lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
960
|
+
});
|
961
|
+
|
962
|
+
test("val()", function() {
|
963
|
+
expect(8);
|
964
|
+
|
965
|
+
equals( SC.$("#text1").val(), "Test", "Check for value of input element" );
|
966
|
+
// ticket #1714 this caused a JS error in IE
|
967
|
+
equals( SC.$("#first").val(), "", "Check a paragraph element to see if it has a value" );
|
968
|
+
ok( SC.$([]).val() === undefined, "Check an empty SC.$ object will return undefined from val" );
|
969
|
+
|
970
|
+
equals( SC.$('#select2').val(), '3', 'Call val() on a single="single" select' );
|
971
|
+
|
972
|
+
isSet( SC.$('#select3').val(), ['1', '2'], 'Call val() on a multiple="multiple" select' );
|
973
|
+
|
974
|
+
equals( SC.$('#option3c').val(), '2', 'Call val() on a option element with value' );
|
975
|
+
|
976
|
+
equals( SC.$('#option3a').val(), '', 'Call val() on a option element with empty value' );
|
977
|
+
|
978
|
+
equals( SC.$('#option3e').val(), 'no value', 'Call val() on a option element with no value attribute' );
|
979
|
+
|
980
|
+
});
|
981
|
+
|
982
|
+
test("val(String/Number)", function() {
|
983
|
+
expect(6);
|
984
|
+
document.getElementById('text1').value = "bla";
|
985
|
+
equals( SC.$("#text1").val(), "bla", "Check for modified value of input element" );
|
986
|
+
|
987
|
+
SC.$("#text1").val('test');
|
988
|
+
equals( document.getElementById('text1').value, "test", "Check for modified (via val(String)) value of input element" );
|
989
|
+
|
990
|
+
SC.$("#text1").val(67);
|
991
|
+
equals( document.getElementById('text1').value, "67", "Check for modified (via val(Number)) value of input element" );
|
992
|
+
|
993
|
+
SC.$("#select1").val("3");
|
994
|
+
equals( SC.$("#select1").val(), "3", "Check for modified (via val(String)) value of select element" );
|
995
|
+
|
996
|
+
SC.$("#select1").val(2);
|
997
|
+
equals( SC.$("#select1").val(), "2", "Check for modified (via val(Number)) value of select element" );
|
998
|
+
|
999
|
+
// using contents will get comments regular, text, and comment nodes
|
1000
|
+
var j = SC.$("#nonnodes").contents();
|
1001
|
+
j.val("asdf");
|
1002
|
+
equals( j.val(), "asdf", "Check node,textnode,comment with val()" );
|
1003
|
+
j.removeAttr("value");
|
1004
|
+
});
|
1005
|
+
|
1006
|
+
var scriptorder = 0;
|
1007
|
+
|
1008
|
+
test("html(String)", function() {
|
1009
|
+
|
1010
|
+
expect(5);
|
1011
|
+
var div = SC.$("#main > div");
|
1012
|
+
div.html("<b>test</b>");
|
1013
|
+
var pass = true;
|
1014
|
+
for ( var i = 0; i < div.size(); i++ ) {
|
1015
|
+
if ( div.get(i).childNodes.length != 1 ) pass = false;
|
1016
|
+
}
|
1017
|
+
ok( pass, "Set HTML" );
|
1018
|
+
|
1019
|
+
reset();
|
1020
|
+
// using contents will get comments regular, text, and comment nodes
|
1021
|
+
var j = SC.$("#nonnodes").contents();
|
1022
|
+
|
1023
|
+
j.html("<b>bold</b>");
|
1024
|
+
|
1025
|
+
// this is needed, or the expando added by SC.$ unique will yield a different html
|
1026
|
+
j.find('b').removeData();
|
1027
|
+
ok( (j.html().toLowerCase().match(/<b(\w*|\s*\=*|\"*)*>bold<\/b>/).length>0), "Check node,textnode,comment with html()" );
|
1028
|
+
|
1029
|
+
SC.$("#main").html("<select/>");
|
1030
|
+
SC.$("#main select").html("<option>O1</option><option selected='selected'>O2</option><option>O3</option>");
|
1031
|
+
equals( SC.$("#main select").val(), "O2", "Selected option correct" );
|
1032
|
+
|
1033
|
+
var $div = SC.$('<div />');
|
1034
|
+
equals( $div.html( 5 ).html(), '5', 'Setting a number as html' );
|
1035
|
+
equals( $div.html( 0 ).html(), '0', 'Setting a zero as html' );
|
1036
|
+
|
1037
|
+
// Disabled because CoreQuery does not support evaluating script tags
|
1038
|
+
// stop();
|
1039
|
+
//
|
1040
|
+
// SC.$("#main").html('<script type="text/javascript">ok( true, "SC.$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );<'+'/script>');
|
1041
|
+
//
|
1042
|
+
// SC.$("#main").html('foo <form><script type="text/javascript">ok( true, "SC.$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );<'+'/script></form>');
|
1043
|
+
//
|
1044
|
+
// // it was decided that waiting to execute ALL scripts makes sense since nested ones have to wait anyway so this test case is changed, see #1959
|
1045
|
+
// SC.$("#main").html("<script>equals(scriptorder++, 0, 'Script is executed in order');equals(SC.$('#scriptorder').length, 1,'Execute after html (even though appears before)')<\/script><span id='scriptorder'><script>equals(scriptorder++, 1, 'Script (nested) is executed in order');equals(SC.$('#scriptorder').length, 1,'Execute after html')<\/script></span><script>equals(scriptorder++, 2, 'Script (unnested) is executed in order');equals(SC.$('#scriptorder').length, 1,'Execute after html')<\/script>");
|
1046
|
+
//
|
1047
|
+
// setTimeout( start, 100 );
|
1048
|
+
});
|
1049
|
+
|
1050
|
+
test("filter()", function() {
|
1051
|
+
expect(5);
|
1052
|
+
|
1053
|
+
// psuedo-selectors are not supported
|
1054
|
+
//isSet( SC.$("#form input").filter(":checked").get(), q("radio2", "check1"), "filter(String)" );
|
1055
|
+
|
1056
|
+
isSet( SC.$("p").filter("#ap, #sndp").get(), q("ap", "sndp"), "filter('String, String')" );
|
1057
|
+
isSet( SC.$("p").filter("#ap,#sndp").get(), q("ap", "sndp"), "filter('String,String')" );
|
1058
|
+
isSet( SC.$("p").filter(function() { return !SC.$("a", this).length; }).get(), q("sndp", "first"), "filter(Function)" );
|
1059
|
+
|
1060
|
+
// using contents will get comments regular, text, and comment nodes
|
1061
|
+
var j = SC.$("#nonnodes").contents();
|
1062
|
+
equals( j.filter("span").length, 1, "Check node,textnode,comment to filter the one span" );
|
1063
|
+
equals( j.filter("[name]").length, 0, "Check node,textnode,comment to filter the one span" );
|
1064
|
+
});
|
1065
|
+
|
1066
|
+
test("not()", function() {
|
1067
|
+
expect(7);
|
1068
|
+
|
1069
|
+
// NOTE: These two tests were altered to use simpler selectors.
|
1070
|
+
equals( SC.$("#main p#ap a").not("#google").length, 3, "not('selector')" );
|
1071
|
+
equals( SC.$("#main p#ap a").not(document.getElementById("google")).length, 3, "not(DOMElement)" );
|
1072
|
+
|
1073
|
+
isSet( SC.$("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
|
1074
|
+
|
1075
|
+
isSet( SC.$("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
|
1076
|
+
|
1077
|
+
isSet( SC.$("p").not(SC.$("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(SC.$)" );
|
1078
|
+
|
1079
|
+
equals( SC.$("p").not(document.getElementsByTagName("p")).length, 0, "not(Array-like DOM collection)" );
|
1080
|
+
|
1081
|
+
// not supported selectors
|
1082
|
+
//isSet( SC.$("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d", "option3e" ), "not('complex selector')");
|
1083
|
+
|
1084
|
+
var selects = SC.$("#form select");
|
1085
|
+
isSet( selects.not( selects[1] ), q("select1", "select3"), "filter out DOM element");
|
1086
|
+
});
|
1087
|
+
|
1088
|
+
test("andSelf()", function() {
|
1089
|
+
expect(4);
|
1090
|
+
isSet( SC.$("#en").siblings().andSelf().get(), q("sndp", "sap","en"), "Check for siblings and self" );
|
1091
|
+
isSet( SC.$("#foo").children().andSelf().get(), q("sndp", "en", "sap", "foo"), "Check for children and self" );
|
1092
|
+
isSet( SC.$("#en, #sndp").parent().andSelf().get(), q("foo","en","sndp"), "Check for parent and self" );
|
1093
|
+
isSet( SC.$("#groups").parents("p, div").andSelf().get(), q("ap", "main", "groups"), "Check for parents and self" );
|
1094
|
+
});
|
1095
|
+
|
1096
|
+
test("siblings([String])", function() {
|
1097
|
+
expect(3);
|
1098
|
+
isSet( SC.$("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
|
1099
|
+
// no psuedo-selectors
|
1100
|
+
//isSet( SC.$("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
|
1101
|
+
//isSet( SC.$("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
|
1102
|
+
isSet( SC.$("#foo").siblings("form, b").get(), q("form", "lengthtest", "testForm", "floatTest"), "Check for multiple filters" );
|
1103
|
+
isSet( SC.$("#en, #sndp").siblings().get(), q("sndp", "sap", "en"), "Check for unique results from siblings" );
|
1104
|
+
});
|
1105
|
+
|
1106
|
+
test("children([String])", function() {
|
1107
|
+
expect(2);
|
1108
|
+
isSet( SC.$("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
|
1109
|
+
|
1110
|
+
// no pseudo-selectors
|
1111
|
+
//isSet( SC.$("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
|
1112
|
+
isSet( SC.$("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
|
1113
|
+
});
|
1114
|
+
|
1115
|
+
test("parent([String])", function() {
|
1116
|
+
expect(5);
|
1117
|
+
equals( SC.$("#groups").parent()[0].id, "ap", "Simple parent check" );
|
1118
|
+
equals( SC.$("#groups").parent("p")[0].id, "ap", "Filtered parent check" );
|
1119
|
+
equals( SC.$("#groups").parent("div").length, 0, "Filtered parent check, no match" );
|
1120
|
+
equals( SC.$("#groups").parent("div, p")[0].id, "ap", "Check for multiple filters" );
|
1121
|
+
isSet( SC.$("#en, #sndp").parent().get(), q("foo"), "Check for unique results from parent" );
|
1122
|
+
});
|
1123
|
+
|
1124
|
+
test("parents([String])", function() {
|
1125
|
+
expect(4);
|
1126
|
+
equals( SC.$("#groups").parents()[0].id, "ap", "Simple parents check" );
|
1127
|
+
equals( SC.$("#groups").parents("p")[0].id, "ap", "Filtered parents check" );
|
1128
|
+
equals( SC.$("#groups").parents("div")[0].id, "main", "Filtered parents check2" );
|
1129
|
+
isSet( SC.$("#groups").parents("p, div").get(), q("ap", "main"), "Check for multiple filters" );
|
1130
|
+
//isSet( SC.$("#en, #sndp").parents().get(), q("foo", "main", "dl", "body", "html"), "Check for unique results from parents" );
|
1131
|
+
});
|
1132
|
+
|
1133
|
+
test("next([String])", function() {
|
1134
|
+
expect(4);
|
1135
|
+
equals( SC.$("#ap").next()[0].id, "foo", "Simple next check" );
|
1136
|
+
equals( SC.$("#ap").next("div")[0].id, "foo", "Filtered next check" );
|
1137
|
+
equals( SC.$("#ap").next("p").length, 0, "Filtered next check, no match" );
|
1138
|
+
equals( SC.$("#ap").next("div, p")[0].id, "foo", "Multiple filters" );
|
1139
|
+
});
|
1140
|
+
|
1141
|
+
test("prev([String])", function() {
|
1142
|
+
expect(4);
|
1143
|
+
equals( SC.$("#foo").prev()[0].id, "ap", "Simple prev check" );
|
1144
|
+
equals( SC.$("#foo").prev("p")[0].id, "ap", "Filtered prev check" );
|
1145
|
+
equals( SC.$("#foo").prev("div").length, 0, "Filtered prev check, no match" );
|
1146
|
+
equals( SC.$("#foo").prev("p, div")[0].id, "ap", "Multiple filters" );
|
1147
|
+
});
|
1148
|
+
|
1149
|
+
|
1150
|
+
test("addClass(String)", function() {
|
1151
|
+
expect(2);
|
1152
|
+
var div = SC.$("div");
|
1153
|
+
div.addClass("test");
|
1154
|
+
var pass = true;
|
1155
|
+
for ( var i = 0; i < div.size(); i++ ) {
|
1156
|
+
if ( div.get(i).className.indexOf("test") == -1 ) pass = false;
|
1157
|
+
}
|
1158
|
+
ok( pass, "Add Class" );
|
1159
|
+
|
1160
|
+
// using contents will get regular, text, and comment nodes
|
1161
|
+
var j = SC.$("#nonnodes").contents();
|
1162
|
+
j.addClass("asdf");
|
1163
|
+
ok( j.hasClass("asdf"), "Check node,textnode,comment for addClass" );
|
1164
|
+
});
|
1165
|
+
|
1166
|
+
test("removeClass(String) - simple", function() {
|
1167
|
+
expect(4);
|
1168
|
+
var div = SC.$("div", SC.$('#main')).addClass("test").removeClass("test"),
|
1169
|
+
pass = true;
|
1170
|
+
for ( var i = 0; i < div.size(); i++ ) {
|
1171
|
+
if ( div.get(i).className.indexOf("test") != -1 ) pass = false;
|
1172
|
+
}
|
1173
|
+
ok( pass, "Remove Class" );
|
1174
|
+
|
1175
|
+
reset();
|
1176
|
+
var div = SC.$("div", SC.$('#main')).addClass("test").addClass("foo").addClass("bar");
|
1177
|
+
div.removeClass("test").removeClass("bar").removeClass("foo");
|
1178
|
+
var pass = true;
|
1179
|
+
for ( var i = 0; i < div.size(); i++ ) {
|
1180
|
+
if ( div.get(i).className.match(/test|bar|foo/) ) pass = false;
|
1181
|
+
}
|
1182
|
+
ok( pass, "Remove multiple classes" );
|
1183
|
+
|
1184
|
+
reset();
|
1185
|
+
var div = SC.$("div").first().addClass("test").removeClass("");
|
1186
|
+
ok( div.is('.test'), "Empty string passed to removeClass" );
|
1187
|
+
|
1188
|
+
// using contents will get regular, text, and comment nodes
|
1189
|
+
var j = SC.$("#nonnodes").contents();
|
1190
|
+
j.removeClass("asdf");
|
1191
|
+
ok( !j.hasClass("asdf"), "Check node,textnode,comment for removeClass" );
|
1192
|
+
});
|
1193
|
+
|
1194
|
+
test("toggleClass(String)", function() {
|
1195
|
+
expect(3);
|
1196
|
+
var e = SC.$("#firstp");
|
1197
|
+
ok( !e.is(".test"), "Assert class not present" );
|
1198
|
+
e.toggleClass("test");
|
1199
|
+
ok( e.is(".test"), "Assert class present" );
|
1200
|
+
e.toggleClass("test");
|
1201
|
+
ok( !e.is(".test"), "Assert class not present" );
|
1202
|
+
});
|
1203
|
+
|
1204
|
+
test("removeAttr(String", function() {
|
1205
|
+
expect(1);
|
1206
|
+
equals( SC.$('#mark').removeAttr("class")[0].className, "", "remove class" );
|
1207
|
+
});
|
1208
|
+
|
1209
|
+
test("text(String)", function() {
|
1210
|
+
expect(4);
|
1211
|
+
equals( SC.$("#foo").text("<div><b>Hello</b> cruel world!</div>")[0].innerHTML, "<div><b>Hello</b> cruel world!</div>", "Check escaped text" );
|
1212
|
+
|
1213
|
+
// using contents will get comments regular, text, and comment nodes
|
1214
|
+
var j = SC.$("#nonnodes").contents();
|
1215
|
+
j.text("hi!");
|
1216
|
+
equals( SC.$(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
|
1217
|
+
equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
|
1218
|
+
equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );
|
1219
|
+
});
|
1220
|
+
|
1221
|
+
test("remove()", function() {
|
1222
|
+
expect(6);
|
1223
|
+
SC.$("#ap").children().remove();
|
1224
|
+
ok( SC.$("#ap").text().length > 10, "Check text is not removed" );
|
1225
|
+
equals( SC.$("#ap").children().length, 0, "Check remove" );
|
1226
|
+
|
1227
|
+
reset();
|
1228
|
+
SC.$("#ap").children().remove("a");
|
1229
|
+
ok( SC.$("#ap").text().length > 10, "Check text is not removed" );
|
1230
|
+
equals( SC.$("#ap").children().length, 1, "Check filtered remove" );
|
1231
|
+
|
1232
|
+
// using contents will get comments regular, text, and comment nodes
|
1233
|
+
equals( SC.$("#nonnodes").contents().length, 3, "Check node,textnode,comment remove works" );
|
1234
|
+
SC.$("#nonnodes").contents().remove();
|
1235
|
+
equals( SC.$("#nonnodes").contents().length, 0, "Check node,textnode,comment remove works" );
|
1236
|
+
});
|
1237
|
+
|
1238
|
+
test("empty()", function() {
|
1239
|
+
expect(3);
|
1240
|
+
equals( SC.$("#ap").children().empty().text().length, 0, "Check text is removed" );
|
1241
|
+
equals( SC.$("#ap").children().length, 4, "Check elements are not removed" );
|
1242
|
+
|
1243
|
+
// using contents will get comments regular, text, and comment nodes
|
1244
|
+
var j = SC.$("#nonnodes").contents();
|
1245
|
+
j.empty();
|
1246
|
+
equals( j.html(), "", "Check node,textnode,comment empty works" );
|
1247
|
+
});
|
1248
|
+
|
1249
|
+
test("slice()", function() {
|
1250
|
+
expect(6);
|
1251
|
+
|
1252
|
+
var $links = SC.$("#ap a");
|
1253
|
+
|
1254
|
+
isSet( $links.slice(1,2), q("groups"), "slice(1,2)" );
|
1255
|
+
isSet( $links.slice(1), q("groups", "anchor1", "mark"), "slice(1)" );
|
1256
|
+
isSet( $links.slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );
|
1257
|
+
isSet( $links.slice(-1), q("mark"), "slice(-1)" );
|
1258
|
+
|
1259
|
+
isSet( $links.eq(1), q("groups"), "eq(1)" );
|
1260
|
+
|
1261
|
+
isSet( $links.eq('2'), q("anchor1"), "eq('2')" );
|
1262
|
+
});
|
1263
|
+
|
1264
|
+
test("SC.$.makeArray", function(){
|
1265
|
+
expect(14);
|
1266
|
+
|
1267
|
+
equals( SC.$.makeArray(SC.$('html>*'))[0].nodeName, "HEAD", "Pass makeArray a SC.$ object" );
|
1268
|
+
|
1269
|
+
equals( SC.$.makeArray(document.getElementsByName("PWD")).slice(0,1)[0].name, "PWD", "Pass makeArray a nodelist" );
|
1270
|
+
|
1271
|
+
equals( (function(){ return SC.$.makeArray(arguments); })(1,2).join(""), "12", "Pass makeArray an arguments array" );
|
1272
|
+
|
1273
|
+
equals( SC.$.makeArray([1,2,3]).join(""), "123", "Pass makeArray a real array" );
|
1274
|
+
|
1275
|
+
equals( SC.$.makeArray().length, 0, "Pass nothing to makeArray and expect an empty array" );
|
1276
|
+
|
1277
|
+
equals( SC.$.makeArray( 0 )[0], 0 , "Pass makeArray a number" );
|
1278
|
+
|
1279
|
+
equals( SC.$.makeArray( "foo" )[0], "foo", "Pass makeArray a string" );
|
1280
|
+
|
1281
|
+
equals( SC.$.makeArray( true )[0].constructor, Boolean, "Pass makeArray a boolean" );
|
1282
|
+
|
1283
|
+
equals( SC.$.makeArray( document.createElement("div") )[0].nodeName, "DIV", "Pass makeArray a single node" );
|
1284
|
+
|
1285
|
+
equals( SC.$.makeArray( {length:2, 0:"a", 1:"b"} ).join(""), "ab", "Pass makeArray an array like map (with length)" );
|
1286
|
+
|
1287
|
+
ok( !!SC.$.makeArray( document.documentElement.childNodes ).slice(0,1)[0].nodeName, "Pass makeArray a childNodes array" );
|
1288
|
+
|
1289
|
+
// function, is tricky as it has length
|
1290
|
+
// NOTE: Due to the conflict with Scriptaculous (http://dev.SC.$.com/ticket/3248)
|
1291
|
+
// We remove support for functions since SC.$ 1.3
|
1292
|
+
//equals( SC.$.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" );
|
1293
|
+
|
1294
|
+
//window, also has length
|
1295
|
+
equals( SC.$.makeArray(window)[0], window, "Pass makeArray the window" );
|
1296
|
+
|
1297
|
+
equals( SC.$.makeArray(/a/)[0].constructor, RegExp, "Pass makeArray a regex" );
|
1298
|
+
|
1299
|
+
ok( SC.$.makeArray(document.getElementById('form')).length >= 13, "Pass makeArray a form (treat as elements)" );
|
1300
|
+
});
|
1301
|
+
|
1302
|
+
module("CoreQuery.map()");
|
1303
|
+
|
1304
|
+
test("should return value of function", function() {
|
1305
|
+
// create an array of object to test.
|
1306
|
+
var values = [1,2,3,4];
|
1307
|
+
var objects = values.map(function(x) { return { value: x }; }) ;
|
1308
|
+
|
1309
|
+
// Now do CoreQuery-style map
|
1310
|
+
var result = SC.CoreQuery.map(objects, function(x) { return x.value; });
|
1311
|
+
same(result, values, "return values of result") ;
|
1312
|
+
});
|
1313
|
+
|
1314
|
+
test("should exclude null values", function() {
|
1315
|
+
// create an array of object to test.
|
1316
|
+
var values = [1,null,3,null];
|
1317
|
+
var objects = values.map(function(x) { return { value: x }; }) ;
|
1318
|
+
|
1319
|
+
// Now do CoreQuery-style map
|
1320
|
+
var result = SC.CoreQuery.map(objects, function(x) { return x.value; });
|
1321
|
+
same(result.length, 2, "number of results") ;
|
1322
|
+
same(result, [1,3], "return values of result") ;
|
1323
|
+
});
|