yui-rails-asset 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README +17 -0
- data/lib/yui/rails.rb +29 -0
- data/lib/yui/rails/engine.rb +10 -0
- data/lib/yui/rails/version.rb +6 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation-debug.js +1396 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation-min.js +23 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation.js +1392 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/ajax-loader.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/asc.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/autocomplete.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/back-h.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/back-v.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bar-h.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bar-v.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bg-h.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bg-v.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/blankimage.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/button.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/calendar.css +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/carousel.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check0.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check2.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/colorpicker.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/container.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/datatable.css +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/desc.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/dt-arrow-dn.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/dt-arrow-up.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-knob.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-sprite-active.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-sprite.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor.css +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/header_background.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/hue_bg.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/imagecropper.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/layout.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/layout_sprite.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/loading.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/logger.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu-button-arrow-disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu-button-arrow.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menubaritem_submenuindicator.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menubaritem_submenuindicator_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_checkbox.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_checkbox_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_submenuindicator.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_submenuindicator_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/paginator.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/picker_mask.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/profilerviewer.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/progressbar.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/resize.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/simpleeditor.css +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/skin.css +36 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/slider.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-active.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-focus.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-hover.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/sprite.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/sprite.psd +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/tabview.css +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview-loading.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview-sprite.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/wait.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/yuitest.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/autocomplete-core.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/skins/sam/autocomplete-skin.css +57 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/skins/sam/autocomplete.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete-debug.js +3009 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete-min.js +12 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete.js +2966 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/base/base-min.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/base/base.css +131 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/button-core.css +44 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/button-skin.css +219 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/button.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/menu-button-arrow-disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/menu-button-arrow.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-active.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-focus.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-hover.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/button-debug.js +4694 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/button-min.js +11 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/button/button.js +4633 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calendar-core.css +132 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calendar.css +320 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calgrad.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/callt.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calrt.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calx.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/skins/sam/calendar-skin.css +361 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/skins/sam/calendar.css +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar-debug.js +7324 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar-min.js +18 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar.js +7294 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/ajax-loader.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/carousel-core.css +88 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/ajax-loader.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/carousel-skin.css +142 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/carousel.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel-debug.js +4390 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel-min.js +12 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel.js +4349 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/charts/assets/charts.swf +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts-debug.js +2061 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts.js +2060 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/colorpicker-core.css +6 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/hue_thumb.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/picker_mask.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/picker_thumb.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/colorpicker-skin.css +105 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/colorpicker.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/hue_bg.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/picker_mask.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker-debug.js +1783 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker.js +1763 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection-debug.js +1576 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection.js +1546 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection.swf +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core-debug.js +980 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core.js +957 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/alrt16_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/blck16_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/close12_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/container-core.css +176 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/container.css +324 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/hlp16_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/info16_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/skins/sam/container-skin.css +242 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/skins/sam/container.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/tip16_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/warn16_1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/container-debug.js +9076 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/container-min.js +19 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/container.js +9052 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core-debug.js +5136 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core-min.js +14 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core.js +5126 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie-debug.js +482 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie.js +482 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource-debug.js +3067 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource-min.js +12 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource.js +2996 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/datatable-core.css +93 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/datatable.css +49 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/datatable-skin.css +240 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/datatable.css +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/dt-arrow-dn.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/dt-arrow-up.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable-debug.js +17360 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable-min.js +29 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable.js +17122 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath-debug.js +408 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath.js +408 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom-debug.js +1872 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom.js +1832 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop-debug.js +3710 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop-min.js +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop.js +3601 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/editor-core.css +602 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/simpleeditor-core.css +602 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/blankimage.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-knob.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-skin.css +711 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-sprite-active.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-sprite.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor.css +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/simpleeditor-skin.css +711 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/simpleeditor.css +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor-debug.js +9557 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor-min.js +30 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor.js +9447 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor-debug.js +7493 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor-min.js +24 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor.js +7406 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate-debug.js +141 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate.js +138 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/element/element-debug.js +1106 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/element/element-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/element/element.js +1090 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate-debug.js +283 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate.js +281 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter-debug.js +219 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter.js +219 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate-debug.js +622 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate.js +622 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event/event-debug.js +2524 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event/event-min.js +11 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/event/event.js +2500 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/fonts/fonts-min.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/fonts/fonts.css +56 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/get/get-debug.js +773 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/get/get-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/get/get.js +755 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/grids/grids-min.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/grids/grids.css +467 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/history/assets/blank.html +1 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/history/history-debug.js +808 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/history/history-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/history/history.js +808 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/imagecropper-core.css +33 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/skins/sam/imagecropper-skin.css +16 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/skins/sam/imagecropper.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper-debug.js +907 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper.js +889 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader-debug.js +487 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader.js +481 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/json/json-debug.js +538 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/json/json-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/json/json.js +538 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/layout-core.css +158 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout-skin.css +207 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout_sprite.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout-debug.js +2305 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout-min.js +11 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout.js +2290 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/logger-core.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/logger.css +57 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/skins/sam/logger-skin.css +55 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/skins/sam/logger.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger-debug.js +2104 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger.js +2104 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu-core.css +242 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu.css +503 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_down_arrow.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_down_arrow_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_up_arrow.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_up_arrow_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator_selected.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox_selected.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator_selected.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menu-skin.css +339 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menu.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menubaritem_submenuindicator.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menubaritem_submenuindicator_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_checkbox.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_checkbox_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_submenuindicator.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_submenuindicator_disabled.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu-debug.js +9870 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu-min.js +16 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu.js +9823 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/paginator-core.css +6 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/skins/sam/paginator-skin.css +78 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/skins/sam/paginator.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator-debug.js +2393 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator-min.js +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator.js +2393 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler-debug.js +557 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler.js +557 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/profilerviewer-core.css +6 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/asc.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/desc.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/header_background.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/profilerviewer-skin.css +167 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/profilerviewer.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/wait.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer-debug.js +1229 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer.js +1192 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/progressbar-core.css +85 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/back-h.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/back-v.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/bar-h.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/bar-v.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/progressbar-skin.css +56 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/progressbar.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar-debug.js +691 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar.js +677 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/reset-fonts-grids/reset-fonts-grids.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/reset-fonts/reset-fonts.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/reset/reset-min.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/reset/reset.css +142 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/resize-core.css +173 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/layout_sprite.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/resize-skin.css +142 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/resize.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize-debug.js +1749 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize-min.js +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize.js +1689 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector-debug.js +651 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector.js +644 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-fader.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-h.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-v-e.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-v.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/left-thumb.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/right-thumb.png +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/bg-h.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/bg-v.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/slider-skin.css +24 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/slider.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/slider-core.css +17 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/slider-skin.css +20 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-bar.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-e.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-fader.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-n.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-s.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-w.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider-debug.js +2114 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider.js +2068 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage-debug.js +1185 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage.js +1183 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet-debug.js +648 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet.js +645 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf-debug.js +269 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf.js +268 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect-debug.js +93 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect.js +93 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swf.js +238 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore-debug.js +470 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore.js +453 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore.swf +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/border_tabs.css +54 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/loading.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skin-sam.css +77 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skins/sam/tabview-skin.css +186 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skins/sam/tabview.css +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/tabview-core.css +133 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/tabview.css +77 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview-debug.js +995 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview-min.js +8 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview.js +987 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check0.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check1.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check2.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/loading.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-loading.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-skin.css +249 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-sprite.gif +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/treeview-core.css +6 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview-debug.js +4058 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview-min.js +12 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview.js +3989 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/uploader/assets/uploader.swf +0 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader-debug.js +1072 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader-min.js +15 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader.js +1069 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/utilities/utilities.js +39 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yahoo-dom-event/yahoo-dom-event.js +14 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo-debug.js +1075 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo-min.js +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo.js +1075 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader-dom-event/yuiloader-dom-event.js +17 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader-debug.js +3879 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader-min.js +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader.js +3879 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/skins/sam/yuitest-skin.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/skins/sam/yuitest.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/testlogger.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/yuitest-core.css +7 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest-debug.js +2741 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest-min.js +10 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest.js +2741 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core-debug.js +1976 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core-min.js +9 -0
- data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core.js +1976 -0
- metadata +470 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
3
|
+
Code licensed under the BSD License:
|
4
|
+
http://developer.yahoo.com/yui/license.html
|
5
|
+
version: 2.8.1
|
6
|
+
*/
|
7
|
+
YAHOO.namespace("tool");(function(){var A=0;YAHOO.tool.TestCase=function(B){this._should={};for(var C in B){this[C]=B[C];}if(!YAHOO.lang.isString(this.name)){this.name="testCase"+(A++);}};YAHOO.tool.TestCase.prototype={resume:function(B){YAHOO.tool.TestRunner.resume(B);},wait:function(D,C){var B=arguments;if(YAHOO.lang.isFunction(B[0])){throw new YAHOO.tool.TestCase.Wait(B[0],B[1]);}else{throw new YAHOO.tool.TestCase.Wait(function(){YAHOO.util.Assert.fail("Timeout: wait() called but resume() never called.");},(YAHOO.lang.isNumber(B[0])?B[0]:10000));}},setUp:function(){},tearDown:function(){}};YAHOO.tool.TestCase.Wait=function(C,B){this.segment=(YAHOO.lang.isFunction(C)?C:null);this.delay=(YAHOO.lang.isNumber(B)?B:0);};})();YAHOO.namespace("tool");YAHOO.tool.TestSuite=function(A){this.name="";this.items=[];if(YAHOO.lang.isString(A)){this.name=A;}else{if(YAHOO.lang.isObject(A)){YAHOO.lang.augmentObject(this,A,true);}}if(this.name===""){this.name=YAHOO.util.Dom.generateId(null,"testSuite");}};YAHOO.tool.TestSuite.prototype={add:function(A){if(A instanceof YAHOO.tool.TestSuite||A instanceof YAHOO.tool.TestCase){this.items.push(A);}},setUp:function(){},tearDown:function(){}};YAHOO.namespace("tool");YAHOO.tool.TestRunner=(function(){function B(C){this.testObject=C;this.firstChild=null;this.lastChild=null;this.parent=null;this.next=null;this.results={passed:0,failed:0,total:0,ignored:0};if(C instanceof YAHOO.tool.TestSuite){this.results.type="testsuite";this.results.name=C.name;}else{if(C instanceof YAHOO.tool.TestCase){this.results.type="testcase";this.results.name=C.name;}}}B.prototype={appendChild:function(C){var D=new B(C);if(this.firstChild===null){this.firstChild=this.lastChild=D;}else{this.lastChild.next=D;this.lastChild=D;}D.parent=this;return D;}};function A(){A.superclass.constructor.apply(this,arguments);this.masterSuite=new YAHOO.tool.TestSuite("YUI Test Results");this._cur=null;this._root=null;var D=[this.TEST_CASE_BEGIN_EVENT,this.TEST_CASE_COMPLETE_EVENT,this.TEST_SUITE_BEGIN_EVENT,this.TEST_SUITE_COMPLETE_EVENT,this.TEST_PASS_EVENT,this.TEST_FAIL_EVENT,this.TEST_IGNORE_EVENT,this.COMPLETE_EVENT,this.BEGIN_EVENT];for(var C=0;C<D.length;C++){this.createEvent(D[C],{scope:this});}}YAHOO.lang.extend(A,YAHOO.util.EventProvider,{TEST_CASE_BEGIN_EVENT:"testcasebegin",TEST_CASE_COMPLETE_EVENT:"testcasecomplete",TEST_SUITE_BEGIN_EVENT:"testsuitebegin",TEST_SUITE_COMPLETE_EVENT:"testsuitecomplete",TEST_PASS_EVENT:"pass",TEST_FAIL_EVENT:"fail",TEST_IGNORE_EVENT:"ignore",COMPLETE_EVENT:"complete",BEGIN_EVENT:"begin",_addTestCaseToTestTree:function(C,D){var E=C.appendChild(D);for(var F in D){if(F.indexOf("test")===0&&YAHOO.lang.isFunction(D[F])){E.appendChild(F);}}},_addTestSuiteToTestTree:function(C,F){var E=C.appendChild(F);for(var D=0;D<F.items.length;D++){if(F.items[D] instanceof YAHOO.tool.TestSuite){this._addTestSuiteToTestTree(E,F.items[D]);}else{if(F.items[D] instanceof YAHOO.tool.TestCase){this._addTestCaseToTestTree(E,F.items[D]);}}}},_buildTestTree:function(){this._root=new B(this.masterSuite);this._cur=this._root;for(var C=0;C<this.masterSuite.items.length;C++){if(this.masterSuite.items[C] instanceof YAHOO.tool.TestSuite){this._addTestSuiteToTestTree(this._root,this.masterSuite.items[C]);}else{if(this.masterSuite.items[C] instanceof YAHOO.tool.TestCase){this._addTestCaseToTestTree(this._root,this.masterSuite.items[C]);}}}},_handleTestObjectComplete:function(C){if(YAHOO.lang.isObject(C.testObject)){C.parent.results.passed+=C.results.passed;C.parent.results.failed+=C.results.failed;C.parent.results.total+=C.results.total;C.parent.results.ignored+=C.results.ignored;C.parent.results[C.testObject.name]=C.results;if(C.testObject instanceof YAHOO.tool.TestSuite){C.testObject.tearDown();this.fireEvent(this.TEST_SUITE_COMPLETE_EVENT,{testSuite:C.testObject,results:C.results});}else{if(C.testObject instanceof YAHOO.tool.TestCase){this.fireEvent(this.TEST_CASE_COMPLETE_EVENT,{testCase:C.testObject,results:C.results});}}}},_next:function(){if(this._cur.firstChild){this._cur=this._cur.firstChild;}else{if(this._cur.next){this._cur=this._cur.next;}else{while(this._cur&&!this._cur.next&&this._cur!==this._root){this._handleTestObjectComplete(this._cur);this._cur=this._cur.parent;}if(this._cur==this._root){this._cur.results.type="report";this._cur.results.timestamp=(new Date()).toLocaleString();this._cur.results.duration=(new Date())-this._cur.results.duration;this.fireEvent(this.COMPLETE_EVENT,{results:this._cur.results});this._cur=null;}else{this._handleTestObjectComplete(this._cur);this._cur=this._cur.next;}}}return this._cur;},_run:function(){var E=false;var D=this._next();if(D!==null){var C=D.testObject;if(YAHOO.lang.isObject(C)){if(C instanceof YAHOO.tool.TestSuite){this.fireEvent(this.TEST_SUITE_BEGIN_EVENT,{testSuite:C});C.setUp();}else{if(C instanceof YAHOO.tool.TestCase){this.fireEvent(this.TEST_CASE_BEGIN_EVENT,{testCase:C});}}if(typeof setTimeout!="undefined"){setTimeout(function(){YAHOO.tool.TestRunner._run();},0);}else{this._run();}}else{this._runTest(D);}}},_resumeTest:function(G){var C=this._cur;var H=C.testObject;var E=C.parent.testObject;if(E.__yui_wait){clearTimeout(E.__yui_wait);delete E.__yui_wait;}var K=(E._should.fail||{})[H];var D=(E._should.error||{})[H];var F=false;var I=null;try{G.apply(E);if(K){I=new YAHOO.util.ShouldFail();F=true;}else{if(D){I=new YAHOO.util.ShouldError();F=true;}}}catch(J){if(J instanceof YAHOO.util.AssertionError){if(!K){I=J;F=true;}}else{if(J instanceof YAHOO.tool.TestCase.Wait){if(YAHOO.lang.isFunction(J.segment)){if(YAHOO.lang.isNumber(J.delay)){if(typeof setTimeout!="undefined"){E.__yui_wait=setTimeout(function(){YAHOO.tool.TestRunner._resumeTest(J.segment);},J.delay);}else{throw new Error("Asynchronous tests not supported in this environment.");}}}return;}else{if(!D){I=new YAHOO.util.UnexpectedError(J);F=true;}else{if(YAHOO.lang.isString(D)){if(J.message!=D){I=new YAHOO.util.UnexpectedError(J);F=true;}}else{if(YAHOO.lang.isFunction(D)){if(!(J instanceof D)){I=new YAHOO.util.UnexpectedError(J);
|
8
|
+
F=true;}}else{if(YAHOO.lang.isObject(D)){if(!(J instanceof D.constructor)||J.message!=D.message){I=new YAHOO.util.UnexpectedError(J);F=true;}}}}}}}}if(F){this.fireEvent(this.TEST_FAIL_EVENT,{testCase:E,testName:H,error:I});}else{this.fireEvent(this.TEST_PASS_EVENT,{testCase:E,testName:H});}E.tearDown();C.parent.results[H]={result:F?"fail":"pass",message:I?I.getMessage():"Test passed",type:"test",name:H};if(F){C.parent.results.failed++;}else{C.parent.results.passed++;}C.parent.results.total++;if(typeof setTimeout!="undefined"){setTimeout(function(){YAHOO.tool.TestRunner._run();},0);}else{this._run();}},_runTest:function(F){var C=F.testObject;var D=F.parent.testObject;var G=D[C];var E=(D._should.ignore||{})[C];if(E){F.parent.results[C]={result:"ignore",message:"Test ignored",type:"test",name:C};F.parent.results.ignored++;F.parent.results.total++;this.fireEvent(this.TEST_IGNORE_EVENT,{testCase:D,testName:C});if(typeof setTimeout!="undefined"){setTimeout(function(){YAHOO.tool.TestRunner._run();},0);}else{this._run();}}else{D.setUp();this._resumeTest(G);}},fireEvent:function(C,D){D=D||{};D.type=C;A.superclass.fireEvent.call(this,C,D);},add:function(C){this.masterSuite.add(C);},clear:function(){this.masterSuite.items=[];},resume:function(C){this._resumeTest(C||function(){});},run:function(C){var D=YAHOO.tool.TestRunner;D._buildTestTree();D._root.results.duration=(new Date()).getTime();D.fireEvent(D.BEGIN_EVENT);D._run();}});return new A();})();YAHOO.namespace("util");YAHOO.util.Assert={_formatMessage:function(B,A){var C=B;if(YAHOO.lang.isString(B)&&B.length>0){return YAHOO.lang.substitute(B,{message:A});}else{return A;}},fail:function(A){throw new YAHOO.util.AssertionError(this._formatMessage(A,"Test force-failed."));},areEqual:function(B,C,A){if(B!=C){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Values should be equal."),B,C);}},areNotEqual:function(A,C,B){if(A==C){throw new YAHOO.util.UnexpectedValue(this._formatMessage(B,"Values should not be equal."),A);}},areNotSame:function(A,C,B){if(A===C){throw new YAHOO.util.UnexpectedValue(this._formatMessage(B,"Values should not be the same."),A);}},areSame:function(B,C,A){if(B!==C){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Values should be the same."),B,C);}},isFalse:function(B,A){if(false!==B){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value should be false."),false,B);}},isTrue:function(B,A){if(true!==B){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value should be true."),true,B);}},isNaN:function(B,A){if(!isNaN(B)){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value should be NaN."),NaN,B);}},isNotNaN:function(B,A){if(isNaN(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Values should not be NaN."),NaN);}},isNotNull:function(B,A){if(YAHOO.lang.isNull(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Values should not be null."),null);}},isNotUndefined:function(B,A){if(YAHOO.lang.isUndefined(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should not be undefined."),undefined);}},isNull:function(B,A){if(!YAHOO.lang.isNull(B)){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value should be null."),null,B);}},isUndefined:function(B,A){if(!YAHOO.lang.isUndefined(B)){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value should be undefined."),undefined,B);}},isArray:function(B,A){if(!YAHOO.lang.isArray(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should be an array."),B);}},isBoolean:function(B,A){if(!YAHOO.lang.isBoolean(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should be a Boolean."),B);}},isFunction:function(B,A){if(!YAHOO.lang.isFunction(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should be a function."),B);}},isInstanceOf:function(B,C,A){if(!(C instanceof B)){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value isn't an instance of expected type."),B,C);}},isNumber:function(B,A){if(!YAHOO.lang.isNumber(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should be a number."),B);}},isObject:function(B,A){if(!YAHOO.lang.isObject(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should be an object."),B);}},isString:function(B,A){if(!YAHOO.lang.isString(B)){throw new YAHOO.util.UnexpectedValue(this._formatMessage(A,"Value should be a string."),B);}},isTypeOf:function(B,C,A){if(typeof C!=B){throw new YAHOO.util.ComparisonFailure(this._formatMessage(A,"Value should be of type "+B+"."),B,typeof C);}}};YAHOO.util.AssertionError=function(A){this.message=A;this.name="AssertionError";};YAHOO.lang.extend(YAHOO.util.AssertionError,Object,{getMessage:function(){return this.message;},toString:function(){return this.name+": "+this.getMessage();}});YAHOO.util.ComparisonFailure=function(B,A,C){YAHOO.util.AssertionError.call(this,B);this.expected=A;this.actual=C;this.name="ComparisonFailure";};YAHOO.lang.extend(YAHOO.util.ComparisonFailure,YAHOO.util.AssertionError,{getMessage:function(){return this.message+"\nExpected: "+this.expected+" ("+(typeof this.expected)+")"+"\nActual:"+this.actual+" ("+(typeof this.actual)+")";}});YAHOO.util.UnexpectedValue=function(B,A){YAHOO.util.AssertionError.call(this,B);this.unexpected=A;this.name="UnexpectedValue";};YAHOO.lang.extend(YAHOO.util.UnexpectedValue,YAHOO.util.AssertionError,{getMessage:function(){return this.message+"\nUnexpected: "+this.unexpected+" ("+(typeof this.unexpected)+") ";}});YAHOO.util.ShouldFail=function(A){YAHOO.util.AssertionError.call(this,A||"This test should fail but didn't.");this.name="ShouldFail";};YAHOO.lang.extend(YAHOO.util.ShouldFail,YAHOO.util.AssertionError);YAHOO.util.ShouldError=function(A){YAHOO.util.AssertionError.call(this,A||"This test should have thrown an error but didn't.");this.name="ShouldError";};YAHOO.lang.extend(YAHOO.util.ShouldError,YAHOO.util.AssertionError);YAHOO.util.UnexpectedError=function(A){YAHOO.util.AssertionError.call(this,"Unexpected error: "+A.message);
|
9
|
+
this.cause=A;this.name="UnexpectedError";this.stack=A.stack;};YAHOO.lang.extend(YAHOO.util.UnexpectedError,YAHOO.util.AssertionError);YAHOO.util.ArrayAssert={contains:function(E,D,B){var C=false;var F=YAHOO.util.Assert;for(var A=0;A<D.length&&!C;A++){if(D[A]===E){C=true;}}if(!C){F.fail(F._formatMessage(B,"Value "+E+" ("+(typeof E)+") not found in array ["+D+"]."));}},containsItems:function(C,D,B){for(var A=0;A<C.length;A++){this.contains(C[A],D,B);}},containsMatch:function(E,D,B){if(typeof E!="function"){throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");}var C=false;var F=YAHOO.util.Assert;for(var A=0;A<D.length&&!C;A++){if(E(D[A])){C=true;}}if(!C){F.fail(F._formatMessage(B,"No match found in array ["+D+"]."));}},doesNotContain:function(E,D,B){var C=false;var F=YAHOO.util.Assert;for(var A=0;A<D.length&&!C;A++){if(D[A]===E){C=true;}}if(C){F.fail(F._formatMessage(B,"Value found in array ["+D+"]."));}},doesNotContainItems:function(C,D,B){for(var A=0;A<C.length;A++){this.doesNotContain(C[A],D,B);}},doesNotContainMatch:function(E,D,B){if(typeof E!="function"){throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");}var C=false;var F=YAHOO.util.Assert;for(var A=0;A<D.length&&!C;A++){if(E(D[A])){C=true;}}if(C){F.fail(F._formatMessage(B,"Value found in array ["+D+"]."));}},indexOf:function(E,D,A,C){for(var B=0;B<D.length;B++){if(D[B]===E){YAHOO.util.Assert.areEqual(A,B,C||"Value exists at index "+B+" but should be at index "+A+".");return;}}var F=YAHOO.util.Assert;F.fail(F._formatMessage(C,"Value doesn't exist in array ["+D+"]."));},itemsAreEqual:function(D,F,C){var A=Math.max(D.length,F.length||0);var E=YAHOO.util.Assert;for(var B=0;B<A;B++){E.areEqual(D[B],F[B],E._formatMessage(C,"Values in position "+B+" are not equal."));}},itemsAreEquivalent:function(E,F,B,D){if(typeof B!="function"){throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");}var A=Math.max(E.length,F.length||0);for(var C=0;C<A;C++){if(!B(E[C],F[C])){throw new YAHOO.util.ComparisonFailure(YAHOO.util.Assert._formatMessage(D,"Values in position "+C+" are not equivalent."),E[C],F[C]);}}},isEmpty:function(C,A){if(C.length>0){var B=YAHOO.util.Assert;B.fail(B._formatMessage(A,"Array should be empty."));}},isNotEmpty:function(C,A){if(C.length===0){var B=YAHOO.util.Assert;B.fail(B._formatMessage(A,"Array should not be empty."));}},itemsAreSame:function(D,F,C){var A=Math.max(D.length,F.length||0);var E=YAHOO.util.Assert;for(var B=0;B<A;B++){E.areSame(D[B],F[B],E._formatMessage(C,"Values in position "+B+" are not the same."));}},lastIndexOf:function(E,D,A,C){var F=YAHOO.util.Assert;for(var B=D.length;B>=0;B--){if(D[B]===E){F.areEqual(A,B,F._formatMessage(C,"Value exists at index "+B+" but should be at index "+A+"."));return;}}F.fail(F._formatMessage(C,"Value doesn't exist in array."));}};YAHOO.namespace("util");YAHOO.util.ObjectAssert={propertiesAreEqual:function(D,G,C){var F=YAHOO.util.Assert;var B=[];for(var E in D){B.push(E);}for(var A=0;A<B.length;A++){F.isNotUndefined(G[B[A]],F._formatMessage(C,"Property '"+B[A]+"' expected."));}},hasProperty:function(A,B,C){if(!(A in B)){var D=YAHOO.util.Assert;D.fail(D._formatMessage(C,"Property '"+A+"' not found on object."));}},hasOwnProperty:function(A,B,C){if(!YAHOO.lang.hasOwnProperty(B,A)){var D=YAHOO.util.Assert;D.fail(D._formatMessage(C,"Property '"+A+"' not found on object instance."));}}};YAHOO.util.DateAssert={datesAreEqual:function(B,D,A){if(B instanceof Date&&D instanceof Date){var C=YAHOO.util.Assert;C.areEqual(B.getFullYear(),D.getFullYear(),C._formatMessage(A,"Years should be equal."));C.areEqual(B.getMonth(),D.getMonth(),C._formatMessage(A,"Months should be equal."));C.areEqual(B.getDate(),D.getDate(),C._formatMessage(A,"Day of month should be equal."));}else{throw new TypeError("DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");}},timesAreEqual:function(B,D,A){if(B instanceof Date&&D instanceof Date){var C=YAHOO.util.Assert;C.areEqual(B.getHours(),D.getHours(),C._formatMessage(A,"Hours should be equal."));C.areEqual(B.getMinutes(),D.getMinutes(),C._formatMessage(A,"Minutes should be equal."));C.areEqual(B.getSeconds(),D.getSeconds(),C._formatMessage(A,"Seconds should be equal."));}else{throw new TypeError("DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");}}};YAHOO.register("yuitest_core",YAHOO.tool.TestRunner,{version:"2.8.1",build:"19"});
|
@@ -0,0 +1,1976 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
3
|
+
Code licensed under the BSD License:
|
4
|
+
http://developer.yahoo.com/yui/license.html
|
5
|
+
version: 2.8.1
|
6
|
+
*/
|
7
|
+
YAHOO.namespace("tool");
|
8
|
+
|
9
|
+
//-----------------------------------------------------------------------------
|
10
|
+
// TestCase object
|
11
|
+
//-----------------------------------------------------------------------------
|
12
|
+
(function(){
|
13
|
+
|
14
|
+
//used for autogenerating test case names
|
15
|
+
var tempId = 0;
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Test case containing various tests to run.
|
19
|
+
* @param template An object containing any number of test methods, other methods,
|
20
|
+
* an optional name, and anything else the test case needs.
|
21
|
+
* @class TestCase
|
22
|
+
* @namespace YAHOO.tool
|
23
|
+
* @constructor
|
24
|
+
*/
|
25
|
+
YAHOO.tool.TestCase = function (template /*:Object*/) {
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Special rules for the test case. Possible subobjects
|
29
|
+
* are fail, for tests that should fail, and error, for
|
30
|
+
* tests that should throw an error.
|
31
|
+
*/
|
32
|
+
this._should /*:Object*/ = {};
|
33
|
+
|
34
|
+
//copy over all properties from the template to this object
|
35
|
+
for (var prop in template) {
|
36
|
+
this[prop] = template[prop];
|
37
|
+
}
|
38
|
+
|
39
|
+
//check for a valid name
|
40
|
+
if (!YAHOO.lang.isString(this.name)){
|
41
|
+
/**
|
42
|
+
* Name for the test case.
|
43
|
+
*/
|
44
|
+
this.name /*:String*/ = "testCase" + (tempId++);
|
45
|
+
}
|
46
|
+
|
47
|
+
};
|
48
|
+
|
49
|
+
|
50
|
+
YAHOO.tool.TestCase.prototype = {
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Resumes a paused test and runs the given function.
|
54
|
+
* @param {Function} segment (Optional) The function to run.
|
55
|
+
* If omitted, the test automatically passes.
|
56
|
+
* @return {Void}
|
57
|
+
* @method resume
|
58
|
+
*/
|
59
|
+
resume : function (segment /*:Function*/) /*:Void*/ {
|
60
|
+
YAHOO.tool.TestRunner.resume(segment);
|
61
|
+
},
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Causes the test case to wait a specified amount of time and then
|
65
|
+
* continue executing the given code.
|
66
|
+
* @param {Function} segment (Optional) The function to run after the delay.
|
67
|
+
* If omitted, the TestRunner will wait until resume() is called.
|
68
|
+
* @param {int} delay (Optional) The number of milliseconds to wait before running
|
69
|
+
* the function. If omitted, defaults to zero.
|
70
|
+
* @return {Void}
|
71
|
+
* @method wait
|
72
|
+
*/
|
73
|
+
wait : function (segment /*:Function*/, delay /*:int*/) /*:Void*/{
|
74
|
+
var args = arguments;
|
75
|
+
if (YAHOO.lang.isFunction(args[0])){
|
76
|
+
throw new YAHOO.tool.TestCase.Wait(args[0], args[1]);
|
77
|
+
} else {
|
78
|
+
throw new YAHOO.tool.TestCase.Wait(function(){
|
79
|
+
YAHOO.util.Assert.fail("Timeout: wait() called but resume() never called.");
|
80
|
+
}, (YAHOO.lang.isNumber(args[0]) ? args[0] : 10000));
|
81
|
+
}
|
82
|
+
},
|
83
|
+
|
84
|
+
//-------------------------------------------------------------------------
|
85
|
+
// Stub Methods
|
86
|
+
//-------------------------------------------------------------------------
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Function to run before each test is executed.
|
90
|
+
* @return {Void}
|
91
|
+
* @method setUp
|
92
|
+
*/
|
93
|
+
setUp : function () /*:Void*/ {
|
94
|
+
},
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Function to run after each test is executed.
|
98
|
+
* @return {Void}
|
99
|
+
* @method tearDown
|
100
|
+
*/
|
101
|
+
tearDown: function () /*:Void*/ {
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Represents a stoppage in test execution to wait for an amount of time before
|
107
|
+
* continuing.
|
108
|
+
* @param {Function} segment A function to run when the wait is over.
|
109
|
+
* @param {int} delay The number of milliseconds to wait before running the code.
|
110
|
+
* @class Wait
|
111
|
+
* @namespace YAHOO.tool.TestCase
|
112
|
+
* @constructor
|
113
|
+
*
|
114
|
+
*/
|
115
|
+
YAHOO.tool.TestCase.Wait = function (segment /*:Function*/, delay /*:int*/) {
|
116
|
+
|
117
|
+
/**
|
118
|
+
* The segment of code to run when the wait is over.
|
119
|
+
* @type Function
|
120
|
+
* @property segment
|
121
|
+
*/
|
122
|
+
this.segment /*:Function*/ = (YAHOO.lang.isFunction(segment) ? segment : null);
|
123
|
+
|
124
|
+
/**
|
125
|
+
* The delay before running the segment of code.
|
126
|
+
* @type int
|
127
|
+
* @property delay
|
128
|
+
*/
|
129
|
+
this.delay /*:int*/ = (YAHOO.lang.isNumber(delay) ? delay : 0);
|
130
|
+
|
131
|
+
};
|
132
|
+
|
133
|
+
})();
|
134
|
+
YAHOO.namespace("tool");
|
135
|
+
|
136
|
+
|
137
|
+
//-----------------------------------------------------------------------------
|
138
|
+
// TestSuite object
|
139
|
+
//-----------------------------------------------------------------------------
|
140
|
+
|
141
|
+
/**
|
142
|
+
* A test suite that can contain a collection of TestCase and TestSuite objects.
|
143
|
+
* @param {String||Object} data The name of the test suite or an object containing
|
144
|
+
* a name property as well as setUp and tearDown methods.
|
145
|
+
* @namespace YAHOO.tool
|
146
|
+
* @class TestSuite
|
147
|
+
* @constructor
|
148
|
+
*/
|
149
|
+
YAHOO.tool.TestSuite = function (data /*:String||Object*/) {
|
150
|
+
|
151
|
+
/**
|
152
|
+
* The name of the test suite.
|
153
|
+
* @type String
|
154
|
+
* @property name
|
155
|
+
*/
|
156
|
+
this.name /*:String*/ = "";
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Array of test suites and
|
160
|
+
* @private
|
161
|
+
*/
|
162
|
+
this.items /*:Array*/ = [];
|
163
|
+
|
164
|
+
//initialize the properties
|
165
|
+
if (YAHOO.lang.isString(data)){
|
166
|
+
this.name = data;
|
167
|
+
} else if (YAHOO.lang.isObject(data)){
|
168
|
+
YAHOO.lang.augmentObject(this, data, true);
|
169
|
+
}
|
170
|
+
|
171
|
+
//double-check name
|
172
|
+
if (this.name === ""){
|
173
|
+
this.name = YAHOO.util.Dom.generateId(null, "testSuite");
|
174
|
+
}
|
175
|
+
|
176
|
+
};
|
177
|
+
|
178
|
+
YAHOO.tool.TestSuite.prototype = {
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Adds a test suite or test case to the test suite.
|
182
|
+
* @param {YAHOO.tool.TestSuite||YAHOO.tool.TestCase} testObject The test suite or test case to add.
|
183
|
+
* @return {Void}
|
184
|
+
* @method add
|
185
|
+
*/
|
186
|
+
add : function (testObject /*:YAHOO.tool.TestSuite*/) /*:Void*/ {
|
187
|
+
if (testObject instanceof YAHOO.tool.TestSuite || testObject instanceof YAHOO.tool.TestCase) {
|
188
|
+
this.items.push(testObject);
|
189
|
+
}
|
190
|
+
},
|
191
|
+
|
192
|
+
//-------------------------------------------------------------------------
|
193
|
+
// Stub Methods
|
194
|
+
//-------------------------------------------------------------------------
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Function to run before each test is executed.
|
198
|
+
* @return {Void}
|
199
|
+
* @method setUp
|
200
|
+
*/
|
201
|
+
setUp : function () /*:Void*/ {
|
202
|
+
},
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Function to run after each test is executed.
|
206
|
+
* @return {Void}
|
207
|
+
* @method tearDown
|
208
|
+
*/
|
209
|
+
tearDown: function () /*:Void*/ {
|
210
|
+
}
|
211
|
+
|
212
|
+
};
|
213
|
+
YAHOO.namespace("tool");
|
214
|
+
|
215
|
+
/**
|
216
|
+
* The YUI test tool
|
217
|
+
* @module yuitest
|
218
|
+
* @namespace YAHOO.tool
|
219
|
+
* @requires yahoo,dom,event,logger
|
220
|
+
* @optional event-simulte
|
221
|
+
*/
|
222
|
+
|
223
|
+
|
224
|
+
//-----------------------------------------------------------------------------
|
225
|
+
// TestRunner object
|
226
|
+
//-----------------------------------------------------------------------------
|
227
|
+
|
228
|
+
|
229
|
+
YAHOO.tool.TestRunner = (function(){
|
230
|
+
|
231
|
+
/**
|
232
|
+
* A node in the test tree structure. May represent a TestSuite, TestCase, or
|
233
|
+
* test function.
|
234
|
+
* @param {Variant} testObject A TestSuite, TestCase, or the name of a test function.
|
235
|
+
* @class TestNode
|
236
|
+
* @constructor
|
237
|
+
* @private
|
238
|
+
*/
|
239
|
+
function TestNode(testObject /*:Variant*/){
|
240
|
+
|
241
|
+
/**
|
242
|
+
* The TestSuite, TestCase, or test function represented by this node.
|
243
|
+
* @type Variant
|
244
|
+
* @property testObject
|
245
|
+
*/
|
246
|
+
this.testObject = testObject;
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Pointer to this node's first child.
|
250
|
+
* @type TestNode
|
251
|
+
* @property firstChild
|
252
|
+
*/
|
253
|
+
this.firstChild /*:TestNode*/ = null;
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Pointer to this node's last child.
|
257
|
+
* @type TestNode
|
258
|
+
* @property lastChild
|
259
|
+
*/
|
260
|
+
this.lastChild = null;
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Pointer to this node's parent.
|
264
|
+
* @type TestNode
|
265
|
+
* @property parent
|
266
|
+
*/
|
267
|
+
this.parent = null;
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Pointer to this node's next sibling.
|
271
|
+
* @type TestNode
|
272
|
+
* @property next
|
273
|
+
*/
|
274
|
+
this.next = null;
|
275
|
+
|
276
|
+
/**
|
277
|
+
* Test results for this test object.
|
278
|
+
* @type object
|
279
|
+
* @property results
|
280
|
+
*/
|
281
|
+
this.results /*:Object*/ = {
|
282
|
+
passed : 0,
|
283
|
+
failed : 0,
|
284
|
+
total : 0,
|
285
|
+
ignored : 0
|
286
|
+
};
|
287
|
+
|
288
|
+
//initialize results
|
289
|
+
if (testObject instanceof YAHOO.tool.TestSuite){
|
290
|
+
this.results.type = "testsuite";
|
291
|
+
this.results.name = testObject.name;
|
292
|
+
} else if (testObject instanceof YAHOO.tool.TestCase){
|
293
|
+
this.results.type = "testcase";
|
294
|
+
this.results.name = testObject.name;
|
295
|
+
}
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
TestNode.prototype = {
|
300
|
+
|
301
|
+
/**
|
302
|
+
* Appends a new test object (TestSuite, TestCase, or test function name) as a child
|
303
|
+
* of this node.
|
304
|
+
* @param {Variant} testObject A TestSuite, TestCase, or the name of a test function.
|
305
|
+
* @return {Void}
|
306
|
+
*/
|
307
|
+
appendChild : function (testObject /*:Variant*/) /*:Void*/{
|
308
|
+
var node = new TestNode(testObject);
|
309
|
+
if (this.firstChild === null){
|
310
|
+
this.firstChild = this.lastChild = node;
|
311
|
+
} else {
|
312
|
+
this.lastChild.next = node;
|
313
|
+
this.lastChild = node;
|
314
|
+
}
|
315
|
+
node.parent = this;
|
316
|
+
return node;
|
317
|
+
}
|
318
|
+
};
|
319
|
+
|
320
|
+
/**
|
321
|
+
* Runs test suites and test cases, providing events to allowing for the
|
322
|
+
* interpretation of test results.
|
323
|
+
* @namespace YAHOO.tool
|
324
|
+
* @class TestRunner
|
325
|
+
* @static
|
326
|
+
*/
|
327
|
+
function TestRunner(){
|
328
|
+
|
329
|
+
//inherit from EventProvider
|
330
|
+
TestRunner.superclass.constructor.apply(this,arguments);
|
331
|
+
|
332
|
+
/**
|
333
|
+
* Suite on which to attach all TestSuites and TestCases to be run.
|
334
|
+
* @type YAHOO.tool.TestSuite
|
335
|
+
* @property masterSuite
|
336
|
+
* @private
|
337
|
+
* @static
|
338
|
+
*/
|
339
|
+
this.masterSuite /*:YAHOO.tool.TestSuite*/ = new YAHOO.tool.TestSuite("YUI Test Results");
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Pointer to the current node in the test tree.
|
343
|
+
* @type TestNode
|
344
|
+
* @private
|
345
|
+
* @property _cur
|
346
|
+
* @static
|
347
|
+
*/
|
348
|
+
this._cur = null;
|
349
|
+
|
350
|
+
/**
|
351
|
+
* Pointer to the root node in the test tree.
|
352
|
+
* @type TestNode
|
353
|
+
* @private
|
354
|
+
* @property _root
|
355
|
+
* @static
|
356
|
+
*/
|
357
|
+
this._root = null;
|
358
|
+
|
359
|
+
//create events
|
360
|
+
var events /*:Array*/ = [
|
361
|
+
this.TEST_CASE_BEGIN_EVENT,
|
362
|
+
this.TEST_CASE_COMPLETE_EVENT,
|
363
|
+
this.TEST_SUITE_BEGIN_EVENT,
|
364
|
+
this.TEST_SUITE_COMPLETE_EVENT,
|
365
|
+
this.TEST_PASS_EVENT,
|
366
|
+
this.TEST_FAIL_EVENT,
|
367
|
+
this.TEST_IGNORE_EVENT,
|
368
|
+
this.COMPLETE_EVENT,
|
369
|
+
this.BEGIN_EVENT
|
370
|
+
];
|
371
|
+
for (var i=0; i < events.length; i++){
|
372
|
+
this.createEvent(events[i], { scope: this });
|
373
|
+
}
|
374
|
+
|
375
|
+
}
|
376
|
+
|
377
|
+
YAHOO.lang.extend(TestRunner, YAHOO.util.EventProvider, {
|
378
|
+
|
379
|
+
//-------------------------------------------------------------------------
|
380
|
+
// Constants
|
381
|
+
//-------------------------------------------------------------------------
|
382
|
+
|
383
|
+
/**
|
384
|
+
* Fires when a test case is opened but before the first
|
385
|
+
* test is executed.
|
386
|
+
* @event testcasebegin
|
387
|
+
*/
|
388
|
+
TEST_CASE_BEGIN_EVENT /*:String*/ : "testcasebegin",
|
389
|
+
|
390
|
+
/**
|
391
|
+
* Fires when all tests in a test case have been executed.
|
392
|
+
* @event testcasecomplete
|
393
|
+
*/
|
394
|
+
TEST_CASE_COMPLETE_EVENT /*:String*/ : "testcasecomplete",
|
395
|
+
|
396
|
+
/**
|
397
|
+
* Fires when a test suite is opened but before the first
|
398
|
+
* test is executed.
|
399
|
+
* @event testsuitebegin
|
400
|
+
*/
|
401
|
+
TEST_SUITE_BEGIN_EVENT /*:String*/ : "testsuitebegin",
|
402
|
+
|
403
|
+
/**
|
404
|
+
* Fires when all test cases in a test suite have been
|
405
|
+
* completed.
|
406
|
+
* @event testsuitecomplete
|
407
|
+
*/
|
408
|
+
TEST_SUITE_COMPLETE_EVENT /*:String*/ : "testsuitecomplete",
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Fires when a test has passed.
|
412
|
+
* @event pass
|
413
|
+
*/
|
414
|
+
TEST_PASS_EVENT /*:String*/ : "pass",
|
415
|
+
|
416
|
+
/**
|
417
|
+
* Fires when a test has failed.
|
418
|
+
* @event fail
|
419
|
+
*/
|
420
|
+
TEST_FAIL_EVENT /*:String*/ : "fail",
|
421
|
+
|
422
|
+
/**
|
423
|
+
* Fires when a test has been ignored.
|
424
|
+
* @event ignore
|
425
|
+
*/
|
426
|
+
TEST_IGNORE_EVENT /*:String*/ : "ignore",
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Fires when all test suites and test cases have been completed.
|
430
|
+
* @event complete
|
431
|
+
*/
|
432
|
+
COMPLETE_EVENT /*:String*/ : "complete",
|
433
|
+
|
434
|
+
/**
|
435
|
+
* Fires when the run() method is called.
|
436
|
+
* @event begin
|
437
|
+
*/
|
438
|
+
BEGIN_EVENT /*:String*/ : "begin",
|
439
|
+
|
440
|
+
//-------------------------------------------------------------------------
|
441
|
+
// Test Tree-Related Methods
|
442
|
+
//-------------------------------------------------------------------------
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Adds a test case to the test tree as a child of the specified node.
|
446
|
+
* @param {TestNode} parentNode The node to add the test case to as a child.
|
447
|
+
* @param {YAHOO.tool.TestCase} testCase The test case to add.
|
448
|
+
* @return {Void}
|
449
|
+
* @static
|
450
|
+
* @private
|
451
|
+
* @method _addTestCaseToTestTree
|
452
|
+
*/
|
453
|
+
_addTestCaseToTestTree : function (parentNode /*:TestNode*/, testCase /*:YAHOO.tool.TestCase*/) /*:Void*/{
|
454
|
+
|
455
|
+
//add the test suite
|
456
|
+
var node = parentNode.appendChild(testCase);
|
457
|
+
|
458
|
+
//iterate over the items in the test case
|
459
|
+
for (var prop in testCase){
|
460
|
+
if (prop.indexOf("test") === 0 && YAHOO.lang.isFunction(testCase[prop])){
|
461
|
+
node.appendChild(prop);
|
462
|
+
}
|
463
|
+
}
|
464
|
+
|
465
|
+
},
|
466
|
+
|
467
|
+
/**
|
468
|
+
* Adds a test suite to the test tree as a child of the specified node.
|
469
|
+
* @param {TestNode} parentNode The node to add the test suite to as a child.
|
470
|
+
* @param {YAHOO.tool.TestSuite} testSuite The test suite to add.
|
471
|
+
* @return {Void}
|
472
|
+
* @static
|
473
|
+
* @private
|
474
|
+
* @method _addTestSuiteToTestTree
|
475
|
+
*/
|
476
|
+
_addTestSuiteToTestTree : function (parentNode /*:TestNode*/, testSuite /*:YAHOO.tool.TestSuite*/) /*:Void*/ {
|
477
|
+
|
478
|
+
//add the test suite
|
479
|
+
var node = parentNode.appendChild(testSuite);
|
480
|
+
|
481
|
+
//iterate over the items in the master suite
|
482
|
+
for (var i=0; i < testSuite.items.length; i++){
|
483
|
+
if (testSuite.items[i] instanceof YAHOO.tool.TestSuite) {
|
484
|
+
this._addTestSuiteToTestTree(node, testSuite.items[i]);
|
485
|
+
} else if (testSuite.items[i] instanceof YAHOO.tool.TestCase) {
|
486
|
+
this._addTestCaseToTestTree(node, testSuite.items[i]);
|
487
|
+
}
|
488
|
+
}
|
489
|
+
},
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Builds the test tree based on items in the master suite. The tree is a hierarchical
|
493
|
+
* representation of the test suites, test cases, and test functions. The resulting tree
|
494
|
+
* is stored in _root and the pointer _cur is set to the root initially.
|
495
|
+
* @return {Void}
|
496
|
+
* @static
|
497
|
+
* @private
|
498
|
+
* @method _buildTestTree
|
499
|
+
*/
|
500
|
+
_buildTestTree : function () /*:Void*/ {
|
501
|
+
|
502
|
+
this._root = new TestNode(this.masterSuite);
|
503
|
+
this._cur = this._root;
|
504
|
+
|
505
|
+
//iterate over the items in the master suite
|
506
|
+
for (var i=0; i < this.masterSuite.items.length; i++){
|
507
|
+
if (this.masterSuite.items[i] instanceof YAHOO.tool.TestSuite) {
|
508
|
+
this._addTestSuiteToTestTree(this._root, this.masterSuite.items[i]);
|
509
|
+
} else if (this.masterSuite.items[i] instanceof YAHOO.tool.TestCase) {
|
510
|
+
this._addTestCaseToTestTree(this._root, this.masterSuite.items[i]);
|
511
|
+
}
|
512
|
+
}
|
513
|
+
|
514
|
+
},
|
515
|
+
|
516
|
+
//-------------------------------------------------------------------------
|
517
|
+
// Private Methods
|
518
|
+
//-------------------------------------------------------------------------
|
519
|
+
|
520
|
+
/**
|
521
|
+
* Handles the completion of a test object's tests. Tallies test results
|
522
|
+
* from one level up to the next.
|
523
|
+
* @param {TestNode} node The TestNode representing the test object.
|
524
|
+
* @return {Void}
|
525
|
+
* @method _handleTestObjectComplete
|
526
|
+
* @private
|
527
|
+
* @static
|
528
|
+
*/
|
529
|
+
_handleTestObjectComplete : function (node /*:TestNode*/) /*:Void*/ {
|
530
|
+
if (YAHOO.lang.isObject(node.testObject)){
|
531
|
+
node.parent.results.passed += node.results.passed;
|
532
|
+
node.parent.results.failed += node.results.failed;
|
533
|
+
node.parent.results.total += node.results.total;
|
534
|
+
node.parent.results.ignored += node.results.ignored;
|
535
|
+
node.parent.results[node.testObject.name] = node.results;
|
536
|
+
|
537
|
+
if (node.testObject instanceof YAHOO.tool.TestSuite){
|
538
|
+
node.testObject.tearDown();
|
539
|
+
this.fireEvent(this.TEST_SUITE_COMPLETE_EVENT, { testSuite: node.testObject, results: node.results});
|
540
|
+
} else if (node.testObject instanceof YAHOO.tool.TestCase){
|
541
|
+
this.fireEvent(this.TEST_CASE_COMPLETE_EVENT, { testCase: node.testObject, results: node.results});
|
542
|
+
}
|
543
|
+
}
|
544
|
+
},
|
545
|
+
|
546
|
+
//-------------------------------------------------------------------------
|
547
|
+
// Navigation Methods
|
548
|
+
//-------------------------------------------------------------------------
|
549
|
+
|
550
|
+
/**
|
551
|
+
* Retrieves the next node in the test tree.
|
552
|
+
* @return {TestNode} The next node in the test tree or null if the end is reached.
|
553
|
+
* @private
|
554
|
+
* @static
|
555
|
+
* @method _next
|
556
|
+
*/
|
557
|
+
_next : function () /*:TestNode*/ {
|
558
|
+
|
559
|
+
if (this._cur.firstChild) {
|
560
|
+
this._cur = this._cur.firstChild;
|
561
|
+
} else if (this._cur.next) {
|
562
|
+
this._cur = this._cur.next;
|
563
|
+
} else {
|
564
|
+
while (this._cur && !this._cur.next && this._cur !== this._root){
|
565
|
+
this._handleTestObjectComplete(this._cur);
|
566
|
+
this._cur = this._cur.parent;
|
567
|
+
}
|
568
|
+
|
569
|
+
if (this._cur == this._root){
|
570
|
+
this._cur.results.type = "report";
|
571
|
+
this._cur.results.timestamp = (new Date()).toLocaleString();
|
572
|
+
this._cur.results.duration = (new Date()) - this._cur.results.duration;
|
573
|
+
this.fireEvent(this.COMPLETE_EVENT, { results: this._cur.results});
|
574
|
+
this._cur = null;
|
575
|
+
} else {
|
576
|
+
this._handleTestObjectComplete(this._cur);
|
577
|
+
this._cur = this._cur.next;
|
578
|
+
}
|
579
|
+
}
|
580
|
+
|
581
|
+
return this._cur;
|
582
|
+
},
|
583
|
+
|
584
|
+
/**
|
585
|
+
* Runs a test case or test suite, returning the results.
|
586
|
+
* @param {YAHOO.tool.TestCase|YAHOO.tool.TestSuite} testObject The test case or test suite to run.
|
587
|
+
* @return {Object} Results of the execution with properties passed, failed, and total.
|
588
|
+
* @private
|
589
|
+
* @method _run
|
590
|
+
* @static
|
591
|
+
*/
|
592
|
+
_run : function () /*:Void*/ {
|
593
|
+
|
594
|
+
//flag to indicate if the TestRunner should wait before continuing
|
595
|
+
var shouldWait /*:Boolean*/ = false;
|
596
|
+
|
597
|
+
//get the next test node
|
598
|
+
var node = this._next();
|
599
|
+
|
600
|
+
if (node !== null) {
|
601
|
+
var testObject = node.testObject;
|
602
|
+
|
603
|
+
//figure out what to do
|
604
|
+
if (YAHOO.lang.isObject(testObject)){
|
605
|
+
if (testObject instanceof YAHOO.tool.TestSuite){
|
606
|
+
this.fireEvent(this.TEST_SUITE_BEGIN_EVENT, { testSuite: testObject });
|
607
|
+
testObject.setUp();
|
608
|
+
} else if (testObject instanceof YAHOO.tool.TestCase){
|
609
|
+
this.fireEvent(this.TEST_CASE_BEGIN_EVENT, { testCase: testObject });
|
610
|
+
}
|
611
|
+
|
612
|
+
//some environments don't support setTimeout
|
613
|
+
if (typeof setTimeout != "undefined"){
|
614
|
+
setTimeout(function(){
|
615
|
+
YAHOO.tool.TestRunner._run();
|
616
|
+
}, 0);
|
617
|
+
} else {
|
618
|
+
this._run();
|
619
|
+
}
|
620
|
+
} else {
|
621
|
+
this._runTest(node);
|
622
|
+
}
|
623
|
+
|
624
|
+
}
|
625
|
+
},
|
626
|
+
|
627
|
+
_resumeTest : function (segment /*:Function*/) /*:Void*/ {
|
628
|
+
|
629
|
+
//get relevant information
|
630
|
+
var node /*:TestNode*/ = this._cur;
|
631
|
+
var testName /*:String*/ = node.testObject;
|
632
|
+
var testCase /*:YAHOO.tool.TestCase*/ = node.parent.testObject;
|
633
|
+
|
634
|
+
//cancel other waits if available
|
635
|
+
if (testCase.__yui_wait){
|
636
|
+
clearTimeout(testCase.__yui_wait);
|
637
|
+
delete testCase.__yui_wait;
|
638
|
+
}
|
639
|
+
|
640
|
+
//get the "should" test cases
|
641
|
+
var shouldFail /*:Object*/ = (testCase._should.fail || {})[testName];
|
642
|
+
var shouldError /*:Object*/ = (testCase._should.error || {})[testName];
|
643
|
+
|
644
|
+
//variable to hold whether or not the test failed
|
645
|
+
var failed /*:Boolean*/ = false;
|
646
|
+
var error /*:Error*/ = null;
|
647
|
+
|
648
|
+
//try the test
|
649
|
+
try {
|
650
|
+
|
651
|
+
//run the test
|
652
|
+
segment.apply(testCase);
|
653
|
+
|
654
|
+
//if it should fail, and it got here, then it's a fail because it didn't
|
655
|
+
if (shouldFail){
|
656
|
+
error = new YAHOO.util.ShouldFail();
|
657
|
+
failed = true;
|
658
|
+
} else if (shouldError){
|
659
|
+
error = new YAHOO.util.ShouldError();
|
660
|
+
failed = true;
|
661
|
+
}
|
662
|
+
|
663
|
+
} catch (thrown /*:Error*/){
|
664
|
+
if (thrown instanceof YAHOO.util.AssertionError) {
|
665
|
+
if (!shouldFail){
|
666
|
+
error = thrown;
|
667
|
+
failed = true;
|
668
|
+
}
|
669
|
+
} else if (thrown instanceof YAHOO.tool.TestCase.Wait){
|
670
|
+
|
671
|
+
if (YAHOO.lang.isFunction(thrown.segment)){
|
672
|
+
if (YAHOO.lang.isNumber(thrown.delay)){
|
673
|
+
|
674
|
+
//some environments don't support setTimeout
|
675
|
+
if (typeof setTimeout != "undefined"){
|
676
|
+
testCase.__yui_wait = setTimeout(function(){
|
677
|
+
YAHOO.tool.TestRunner._resumeTest(thrown.segment);
|
678
|
+
}, thrown.delay);
|
679
|
+
} else {
|
680
|
+
throw new Error("Asynchronous tests not supported in this environment.");
|
681
|
+
}
|
682
|
+
}
|
683
|
+
}
|
684
|
+
|
685
|
+
return;
|
686
|
+
|
687
|
+
} else {
|
688
|
+
//first check to see if it should error
|
689
|
+
if (!shouldError) {
|
690
|
+
error = new YAHOO.util.UnexpectedError(thrown);
|
691
|
+
failed = true;
|
692
|
+
} else {
|
693
|
+
//check to see what type of data we have
|
694
|
+
if (YAHOO.lang.isString(shouldError)){
|
695
|
+
|
696
|
+
//if it's a string, check the error message
|
697
|
+
if (thrown.message != shouldError){
|
698
|
+
error = new YAHOO.util.UnexpectedError(thrown);
|
699
|
+
failed = true;
|
700
|
+
}
|
701
|
+
} else if (YAHOO.lang.isFunction(shouldError)){
|
702
|
+
|
703
|
+
//if it's a function, see if the error is an instance of it
|
704
|
+
if (!(thrown instanceof shouldError)){
|
705
|
+
error = new YAHOO.util.UnexpectedError(thrown);
|
706
|
+
failed = true;
|
707
|
+
}
|
708
|
+
|
709
|
+
} else if (YAHOO.lang.isObject(shouldError)){
|
710
|
+
|
711
|
+
//if it's an object, check the instance and message
|
712
|
+
if (!(thrown instanceof shouldError.constructor) ||
|
713
|
+
thrown.message != shouldError.message){
|
714
|
+
error = new YAHOO.util.UnexpectedError(thrown);
|
715
|
+
failed = true;
|
716
|
+
}
|
717
|
+
|
718
|
+
}
|
719
|
+
|
720
|
+
}
|
721
|
+
}
|
722
|
+
|
723
|
+
}
|
724
|
+
|
725
|
+
//fireEvent appropriate event
|
726
|
+
if (failed) {
|
727
|
+
this.fireEvent(this.TEST_FAIL_EVENT, { testCase: testCase, testName: testName, error: error });
|
728
|
+
} else {
|
729
|
+
this.fireEvent(this.TEST_PASS_EVENT, { testCase: testCase, testName: testName });
|
730
|
+
}
|
731
|
+
|
732
|
+
//run the tear down
|
733
|
+
testCase.tearDown();
|
734
|
+
|
735
|
+
//update results
|
736
|
+
node.parent.results[testName] = {
|
737
|
+
result: failed ? "fail" : "pass",
|
738
|
+
message: error ? error.getMessage() : "Test passed",
|
739
|
+
type: "test",
|
740
|
+
name: testName
|
741
|
+
};
|
742
|
+
|
743
|
+
if (failed){
|
744
|
+
node.parent.results.failed++;
|
745
|
+
} else {
|
746
|
+
node.parent.results.passed++;
|
747
|
+
}
|
748
|
+
node.parent.results.total++;
|
749
|
+
|
750
|
+
//set timeout not supported in all environments
|
751
|
+
if (typeof setTimeout != "undefined"){
|
752
|
+
setTimeout(function(){
|
753
|
+
YAHOO.tool.TestRunner._run();
|
754
|
+
}, 0);
|
755
|
+
} else {
|
756
|
+
this._run();
|
757
|
+
}
|
758
|
+
|
759
|
+
},
|
760
|
+
|
761
|
+
/**
|
762
|
+
* Runs a single test based on the data provided in the node.
|
763
|
+
* @param {TestNode} node The TestNode representing the test to run.
|
764
|
+
* @return {Void}
|
765
|
+
* @static
|
766
|
+
* @private
|
767
|
+
* @name _runTest
|
768
|
+
*/
|
769
|
+
_runTest : function (node /*:TestNode*/) /*:Void*/ {
|
770
|
+
|
771
|
+
//get relevant information
|
772
|
+
var testName /*:String*/ = node.testObject;
|
773
|
+
var testCase /*:YAHOO.tool.TestCase*/ = node.parent.testObject;
|
774
|
+
var test /*:Function*/ = testCase[testName];
|
775
|
+
|
776
|
+
//get the "should" test cases
|
777
|
+
var shouldIgnore /*:Object*/ = (testCase._should.ignore || {})[testName];
|
778
|
+
|
779
|
+
//figure out if the test should be ignored or not
|
780
|
+
if (shouldIgnore){
|
781
|
+
|
782
|
+
//update results
|
783
|
+
node.parent.results[testName] = {
|
784
|
+
result: "ignore",
|
785
|
+
message: "Test ignored",
|
786
|
+
type: "test",
|
787
|
+
name: testName
|
788
|
+
};
|
789
|
+
|
790
|
+
node.parent.results.ignored++;
|
791
|
+
node.parent.results.total++;
|
792
|
+
|
793
|
+
this.fireEvent(this.TEST_IGNORE_EVENT, { testCase: testCase, testName: testName });
|
794
|
+
|
795
|
+
//some environments don't support setTimeout
|
796
|
+
if (typeof setTimeout != "undefined"){
|
797
|
+
setTimeout(function(){
|
798
|
+
YAHOO.tool.TestRunner._run();
|
799
|
+
}, 0);
|
800
|
+
} else {
|
801
|
+
this._run();
|
802
|
+
}
|
803
|
+
|
804
|
+
} else {
|
805
|
+
|
806
|
+
//run the setup
|
807
|
+
testCase.setUp();
|
808
|
+
|
809
|
+
//now call the body of the test
|
810
|
+
this._resumeTest(test);
|
811
|
+
}
|
812
|
+
|
813
|
+
},
|
814
|
+
|
815
|
+
//-------------------------------------------------------------------------
|
816
|
+
// Protected Methods
|
817
|
+
//-------------------------------------------------------------------------
|
818
|
+
|
819
|
+
/**
|
820
|
+
* Fires events for the TestRunner. This overrides the default fireEvent()
|
821
|
+
* method from EventProvider to add the type property to the data that is
|
822
|
+
* passed through on each event call.
|
823
|
+
* @param {String} type The type of event to fire.
|
824
|
+
* @param {Object} data (Optional) Data for the event.
|
825
|
+
* @method fireEvent
|
826
|
+
* @static
|
827
|
+
* @protected
|
828
|
+
*/
|
829
|
+
fireEvent : function (type /*:String*/, data /*:Object*/) /*:Void*/ {
|
830
|
+
data = data || {};
|
831
|
+
data.type = type;
|
832
|
+
TestRunner.superclass.fireEvent.call(this, type, data);
|
833
|
+
},
|
834
|
+
|
835
|
+
//-------------------------------------------------------------------------
|
836
|
+
// Public Methods
|
837
|
+
//-------------------------------------------------------------------------
|
838
|
+
|
839
|
+
/**
|
840
|
+
* Adds a test suite or test case to the list of test objects to run.
|
841
|
+
* @param testObject Either a TestCase or a TestSuite that should be run.
|
842
|
+
* @return {Void}
|
843
|
+
* @method add
|
844
|
+
* @static
|
845
|
+
*/
|
846
|
+
add : function (testObject /*:Object*/) /*:Void*/ {
|
847
|
+
this.masterSuite.add(testObject);
|
848
|
+
},
|
849
|
+
|
850
|
+
/**
|
851
|
+
* Removes all test objects from the runner.
|
852
|
+
* @return {Void}
|
853
|
+
* @method clear
|
854
|
+
* @static
|
855
|
+
*/
|
856
|
+
clear : function () /*:Void*/ {
|
857
|
+
this.masterSuite.items = [];
|
858
|
+
},
|
859
|
+
|
860
|
+
/**
|
861
|
+
* Resumes the TestRunner after wait() was called.
|
862
|
+
* @param {Function} segment The function to run as the rest
|
863
|
+
* of the haulted test.
|
864
|
+
* @return {Void}
|
865
|
+
* @method resume
|
866
|
+
* @static
|
867
|
+
*/
|
868
|
+
resume : function (segment /*:Function*/) /*:Void*/ {
|
869
|
+
this._resumeTest(segment || function(){});
|
870
|
+
},
|
871
|
+
|
872
|
+
/**
|
873
|
+
* Runs the test suite.
|
874
|
+
* @return {Void}
|
875
|
+
* @method run
|
876
|
+
* @static
|
877
|
+
*/
|
878
|
+
run : function (testObject /*:Object*/) /*:Void*/ {
|
879
|
+
|
880
|
+
//pointer to runner to avoid scope issues
|
881
|
+
var runner = YAHOO.tool.TestRunner;
|
882
|
+
|
883
|
+
//build the test tree
|
884
|
+
runner._buildTestTree();
|
885
|
+
|
886
|
+
//set when the test started
|
887
|
+
runner._root.results.duration = (new Date()).getTime();
|
888
|
+
|
889
|
+
//fire the begin event
|
890
|
+
runner.fireEvent(runner.BEGIN_EVENT);
|
891
|
+
|
892
|
+
//begin the testing
|
893
|
+
runner._run();
|
894
|
+
}
|
895
|
+
});
|
896
|
+
|
897
|
+
return new TestRunner();
|
898
|
+
|
899
|
+
})();
|
900
|
+
YAHOO.namespace("util");
|
901
|
+
|
902
|
+
//-----------------------------------------------------------------------------
|
903
|
+
// Assert object
|
904
|
+
//-----------------------------------------------------------------------------
|
905
|
+
|
906
|
+
/**
|
907
|
+
* The Assert object provides functions to test JavaScript values against
|
908
|
+
* known and expected results. Whenever a comparison (assertion) fails,
|
909
|
+
* an error is thrown.
|
910
|
+
*
|
911
|
+
* @namespace YAHOO.util
|
912
|
+
* @class Assert
|
913
|
+
* @static
|
914
|
+
*/
|
915
|
+
YAHOO.util.Assert = {
|
916
|
+
|
917
|
+
//-------------------------------------------------------------------------
|
918
|
+
// Helper Methods
|
919
|
+
//-------------------------------------------------------------------------
|
920
|
+
|
921
|
+
/**
|
922
|
+
* Formats a message so that it can contain the original assertion message
|
923
|
+
* in addition to the custom message.
|
924
|
+
* @param {String} customMessage The message passed in by the developer.
|
925
|
+
* @param {String} defaultMessage The message created by the error by default.
|
926
|
+
* @return {String} The final error message, containing either or both.
|
927
|
+
* @protected
|
928
|
+
* @static
|
929
|
+
* @method _formatMessage
|
930
|
+
*/
|
931
|
+
_formatMessage : function (customMessage /*:String*/, defaultMessage /*:String*/) /*:String*/ {
|
932
|
+
var message = customMessage;
|
933
|
+
if (YAHOO.lang.isString(customMessage) && customMessage.length > 0){
|
934
|
+
return YAHOO.lang.substitute(customMessage, { message: defaultMessage });
|
935
|
+
} else {
|
936
|
+
return defaultMessage;
|
937
|
+
}
|
938
|
+
},
|
939
|
+
|
940
|
+
//-------------------------------------------------------------------------
|
941
|
+
// Generic Assertion Methods
|
942
|
+
//-------------------------------------------------------------------------
|
943
|
+
|
944
|
+
/**
|
945
|
+
* Forces an assertion error to occur.
|
946
|
+
* @param {String} message (Optional) The message to display with the failure.
|
947
|
+
* @method fail
|
948
|
+
* @static
|
949
|
+
*/
|
950
|
+
fail : function (message /*:String*/) /*:Void*/ {
|
951
|
+
throw new YAHOO.util.AssertionError(this._formatMessage(message, "Test force-failed."));
|
952
|
+
},
|
953
|
+
|
954
|
+
//-------------------------------------------------------------------------
|
955
|
+
// Equality Assertion Methods
|
956
|
+
//-------------------------------------------------------------------------
|
957
|
+
|
958
|
+
/**
|
959
|
+
* Asserts that a value is equal to another. This uses the double equals sign
|
960
|
+
* so type cohersion may occur.
|
961
|
+
* @param {Object} expected The expected value.
|
962
|
+
* @param {Object} actual The actual value to test.
|
963
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
964
|
+
* @method areEqual
|
965
|
+
* @static
|
966
|
+
*/
|
967
|
+
areEqual : function (expected /*:Object*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
968
|
+
if (expected != actual) {
|
969
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Values should be equal."), expected, actual);
|
970
|
+
}
|
971
|
+
},
|
972
|
+
|
973
|
+
/**
|
974
|
+
* Asserts that a value is not equal to another. This uses the double equals sign
|
975
|
+
* so type cohersion may occur.
|
976
|
+
* @param {Object} unexpected The unexpected value.
|
977
|
+
* @param {Object} actual The actual value to test.
|
978
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
979
|
+
* @method areNotEqual
|
980
|
+
* @static
|
981
|
+
*/
|
982
|
+
areNotEqual : function (unexpected /*:Object*/, actual /*:Object*/,
|
983
|
+
message /*:String*/) /*:Void*/ {
|
984
|
+
if (unexpected == actual) {
|
985
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Values should not be equal."), unexpected);
|
986
|
+
}
|
987
|
+
},
|
988
|
+
|
989
|
+
/**
|
990
|
+
* Asserts that a value is not the same as another. This uses the triple equals sign
|
991
|
+
* so no type cohersion may occur.
|
992
|
+
* @param {Object} unexpected The unexpected value.
|
993
|
+
* @param {Object} actual The actual value to test.
|
994
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
995
|
+
* @method areNotSame
|
996
|
+
* @static
|
997
|
+
*/
|
998
|
+
areNotSame : function (unexpected /*:Object*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
999
|
+
if (unexpected === actual) {
|
1000
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Values should not be the same."), unexpected);
|
1001
|
+
}
|
1002
|
+
},
|
1003
|
+
|
1004
|
+
/**
|
1005
|
+
* Asserts that a value is the same as another. This uses the triple equals sign
|
1006
|
+
* so no type cohersion may occur.
|
1007
|
+
* @param {Object} expected The expected value.
|
1008
|
+
* @param {Object} actual The actual value to test.
|
1009
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1010
|
+
* @method areSame
|
1011
|
+
* @static
|
1012
|
+
*/
|
1013
|
+
areSame : function (expected /*:Object*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1014
|
+
if (expected !== actual) {
|
1015
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Values should be the same."), expected, actual);
|
1016
|
+
}
|
1017
|
+
},
|
1018
|
+
|
1019
|
+
//-------------------------------------------------------------------------
|
1020
|
+
// Boolean Assertion Methods
|
1021
|
+
//-------------------------------------------------------------------------
|
1022
|
+
|
1023
|
+
/**
|
1024
|
+
* Asserts that a value is false. This uses the triple equals sign
|
1025
|
+
* so no type cohersion may occur.
|
1026
|
+
* @param {Object} actual The actual value to test.
|
1027
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1028
|
+
* @method isFalse
|
1029
|
+
* @static
|
1030
|
+
*/
|
1031
|
+
isFalse : function (actual /*:Boolean*/, message /*:String*/) {
|
1032
|
+
if (false !== actual) {
|
1033
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value should be false."), false, actual);
|
1034
|
+
}
|
1035
|
+
},
|
1036
|
+
|
1037
|
+
/**
|
1038
|
+
* Asserts that a value is true. This uses the triple equals sign
|
1039
|
+
* so no type cohersion may occur.
|
1040
|
+
* @param {Object} actual The actual value to test.
|
1041
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1042
|
+
* @method isTrue
|
1043
|
+
* @static
|
1044
|
+
*/
|
1045
|
+
isTrue : function (actual /*:Boolean*/, message /*:String*/) /*:Void*/ {
|
1046
|
+
if (true !== actual) {
|
1047
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value should be true."), true, actual);
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
},
|
1051
|
+
|
1052
|
+
//-------------------------------------------------------------------------
|
1053
|
+
// Special Value Assertion Methods
|
1054
|
+
//-------------------------------------------------------------------------
|
1055
|
+
|
1056
|
+
/**
|
1057
|
+
* Asserts that a value is not a number.
|
1058
|
+
* @param {Object} actual The value to test.
|
1059
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1060
|
+
* @method isNaN
|
1061
|
+
* @static
|
1062
|
+
*/
|
1063
|
+
isNaN : function (actual /*:Object*/, message /*:String*/) /*:Void*/{
|
1064
|
+
if (!isNaN(actual)){
|
1065
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value should be NaN."), NaN, actual);
|
1066
|
+
}
|
1067
|
+
},
|
1068
|
+
|
1069
|
+
/**
|
1070
|
+
* Asserts that a value is not the special NaN value.
|
1071
|
+
* @param {Object} actual The value to test.
|
1072
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1073
|
+
* @method isNotNaN
|
1074
|
+
* @static
|
1075
|
+
*/
|
1076
|
+
isNotNaN : function (actual /*:Object*/, message /*:String*/) /*:Void*/{
|
1077
|
+
if (isNaN(actual)){
|
1078
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Values should not be NaN."), NaN);
|
1079
|
+
}
|
1080
|
+
},
|
1081
|
+
|
1082
|
+
/**
|
1083
|
+
* Asserts that a value is not null. This uses the triple equals sign
|
1084
|
+
* so no type cohersion may occur.
|
1085
|
+
* @param {Object} actual The actual value to test.
|
1086
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1087
|
+
* @method isNotNull
|
1088
|
+
* @static
|
1089
|
+
*/
|
1090
|
+
isNotNull : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1091
|
+
if (YAHOO.lang.isNull(actual)) {
|
1092
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Values should not be null."), null);
|
1093
|
+
}
|
1094
|
+
},
|
1095
|
+
|
1096
|
+
/**
|
1097
|
+
* Asserts that a value is not undefined. This uses the triple equals sign
|
1098
|
+
* so no type cohersion may occur.
|
1099
|
+
* @param {Object} actual The actual value to test.
|
1100
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1101
|
+
* @method isNotUndefined
|
1102
|
+
* @static
|
1103
|
+
*/
|
1104
|
+
isNotUndefined : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1105
|
+
if (YAHOO.lang.isUndefined(actual)) {
|
1106
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should not be undefined."), undefined);
|
1107
|
+
}
|
1108
|
+
},
|
1109
|
+
|
1110
|
+
/**
|
1111
|
+
* Asserts that a value is null. This uses the triple equals sign
|
1112
|
+
* so no type cohersion may occur.
|
1113
|
+
* @param {Object} actual The actual value to test.
|
1114
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1115
|
+
* @method isNull
|
1116
|
+
* @static
|
1117
|
+
*/
|
1118
|
+
isNull : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1119
|
+
if (!YAHOO.lang.isNull(actual)) {
|
1120
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value should be null."), null, actual);
|
1121
|
+
}
|
1122
|
+
},
|
1123
|
+
|
1124
|
+
/**
|
1125
|
+
* Asserts that a value is undefined. This uses the triple equals sign
|
1126
|
+
* so no type cohersion may occur.
|
1127
|
+
* @param {Object} actual The actual value to test.
|
1128
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1129
|
+
* @method isUndefined
|
1130
|
+
* @static
|
1131
|
+
*/
|
1132
|
+
isUndefined : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1133
|
+
if (!YAHOO.lang.isUndefined(actual)) {
|
1134
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value should be undefined."), undefined, actual);
|
1135
|
+
}
|
1136
|
+
},
|
1137
|
+
|
1138
|
+
//--------------------------------------------------------------------------
|
1139
|
+
// Instance Assertion Methods
|
1140
|
+
//--------------------------------------------------------------------------
|
1141
|
+
|
1142
|
+
/**
|
1143
|
+
* Asserts that a value is an array.
|
1144
|
+
* @param {Object} actual The value to test.
|
1145
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1146
|
+
* @method isArray
|
1147
|
+
* @static
|
1148
|
+
*/
|
1149
|
+
isArray : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1150
|
+
if (!YAHOO.lang.isArray(actual)){
|
1151
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should be an array."), actual);
|
1152
|
+
}
|
1153
|
+
},
|
1154
|
+
|
1155
|
+
/**
|
1156
|
+
* Asserts that a value is a Boolean.
|
1157
|
+
* @param {Object} actual The value to test.
|
1158
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1159
|
+
* @method isBoolean
|
1160
|
+
* @static
|
1161
|
+
*/
|
1162
|
+
isBoolean : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1163
|
+
if (!YAHOO.lang.isBoolean(actual)){
|
1164
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should be a Boolean."), actual);
|
1165
|
+
}
|
1166
|
+
},
|
1167
|
+
|
1168
|
+
/**
|
1169
|
+
* Asserts that a value is a function.
|
1170
|
+
* @param {Object} actual The value to test.
|
1171
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1172
|
+
* @method isFunction
|
1173
|
+
* @static
|
1174
|
+
*/
|
1175
|
+
isFunction : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1176
|
+
if (!YAHOO.lang.isFunction(actual)){
|
1177
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should be a function."), actual);
|
1178
|
+
}
|
1179
|
+
},
|
1180
|
+
|
1181
|
+
/**
|
1182
|
+
* Asserts that a value is an instance of a particular object. This may return
|
1183
|
+
* incorrect results when comparing objects from one frame to constructors in
|
1184
|
+
* another frame. For best results, don't use in a cross-frame manner.
|
1185
|
+
* @param {Function} expected The function that the object should be an instance of.
|
1186
|
+
* @param {Object} actual The object to test.
|
1187
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1188
|
+
* @method isInstanceOf
|
1189
|
+
* @static
|
1190
|
+
*/
|
1191
|
+
isInstanceOf : function (expected /*:Function*/, actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1192
|
+
if (!(actual instanceof expected)){
|
1193
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value isn't an instance of expected type."), expected, actual);
|
1194
|
+
}
|
1195
|
+
},
|
1196
|
+
|
1197
|
+
/**
|
1198
|
+
* Asserts that a value is a number.
|
1199
|
+
* @param {Object} actual The value to test.
|
1200
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1201
|
+
* @method isNumber
|
1202
|
+
* @static
|
1203
|
+
*/
|
1204
|
+
isNumber : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1205
|
+
if (!YAHOO.lang.isNumber(actual)){
|
1206
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should be a number."), actual);
|
1207
|
+
}
|
1208
|
+
},
|
1209
|
+
|
1210
|
+
/**
|
1211
|
+
* Asserts that a value is an object.
|
1212
|
+
* @param {Object} actual The value to test.
|
1213
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1214
|
+
* @method isObject
|
1215
|
+
* @static
|
1216
|
+
*/
|
1217
|
+
isObject : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1218
|
+
if (!YAHOO.lang.isObject(actual)){
|
1219
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should be an object."), actual);
|
1220
|
+
}
|
1221
|
+
},
|
1222
|
+
|
1223
|
+
/**
|
1224
|
+
* Asserts that a value is a string.
|
1225
|
+
* @param {Object} actual The value to test.
|
1226
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1227
|
+
* @method isString
|
1228
|
+
* @static
|
1229
|
+
*/
|
1230
|
+
isString : function (actual /*:Object*/, message /*:String*/) /*:Void*/ {
|
1231
|
+
if (!YAHOO.lang.isString(actual)){
|
1232
|
+
throw new YAHOO.util.UnexpectedValue(this._formatMessage(message, "Value should be a string."), actual);
|
1233
|
+
}
|
1234
|
+
},
|
1235
|
+
|
1236
|
+
/**
|
1237
|
+
* Asserts that a value is of a particular type.
|
1238
|
+
* @param {String} expectedType The expected type of the variable.
|
1239
|
+
* @param {Object} actualValue The actual value to test.
|
1240
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1241
|
+
* @method isTypeOf
|
1242
|
+
* @static
|
1243
|
+
*/
|
1244
|
+
isTypeOf : function (expected /*:String*/, actual /*:Object*/, message /*:String*/) /*:Void*/{
|
1245
|
+
if (typeof actual != expected){
|
1246
|
+
throw new YAHOO.util.ComparisonFailure(this._formatMessage(message, "Value should be of type " + expected + "."), expected, typeof actual);
|
1247
|
+
}
|
1248
|
+
}
|
1249
|
+
};
|
1250
|
+
|
1251
|
+
//-----------------------------------------------------------------------------
|
1252
|
+
// Assertion errors
|
1253
|
+
//-----------------------------------------------------------------------------
|
1254
|
+
|
1255
|
+
/**
|
1256
|
+
* AssertionError is thrown whenever an assertion fails. It provides methods
|
1257
|
+
* to more easily get at error information and also provides a base class
|
1258
|
+
* from which more specific assertion errors can be derived.
|
1259
|
+
*
|
1260
|
+
* @param {String} message The message to display when the error occurs.
|
1261
|
+
* @namespace YAHOO.util
|
1262
|
+
* @class AssertionError
|
1263
|
+
* @extends Error
|
1264
|
+
* @constructor
|
1265
|
+
*/
|
1266
|
+
YAHOO.util.AssertionError = function (message /*:String*/){
|
1267
|
+
|
1268
|
+
//call superclass
|
1269
|
+
//arguments.callee.superclass.constructor.call(this, message);
|
1270
|
+
|
1271
|
+
/*
|
1272
|
+
* Error message. Must be duplicated to ensure browser receives it.
|
1273
|
+
* @type String
|
1274
|
+
* @property message
|
1275
|
+
*/
|
1276
|
+
this.message /*:String*/ = message;
|
1277
|
+
|
1278
|
+
/**
|
1279
|
+
* The name of the error that occurred.
|
1280
|
+
* @type String
|
1281
|
+
* @property name
|
1282
|
+
*/
|
1283
|
+
this.name /*:String*/ = "AssertionError";
|
1284
|
+
};
|
1285
|
+
|
1286
|
+
//inherit methods
|
1287
|
+
YAHOO.lang.extend(YAHOO.util.AssertionError, Object, {
|
1288
|
+
|
1289
|
+
/**
|
1290
|
+
* Returns a fully formatted error for an assertion failure. This should
|
1291
|
+
* be overridden by all subclasses to provide specific information.
|
1292
|
+
* @method getMessage
|
1293
|
+
* @return {String} A string describing the error.
|
1294
|
+
*/
|
1295
|
+
getMessage : function () /*:String*/ {
|
1296
|
+
return this.message;
|
1297
|
+
},
|
1298
|
+
|
1299
|
+
/**
|
1300
|
+
* Returns a string representation of the error.
|
1301
|
+
* @method toString
|
1302
|
+
* @return {String} A string representation of the error.
|
1303
|
+
*/
|
1304
|
+
toString : function () /*:String*/ {
|
1305
|
+
return this.name + ": " + this.getMessage();
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
});
|
1309
|
+
|
1310
|
+
/**
|
1311
|
+
* ComparisonFailure is subclass of AssertionError that is thrown whenever
|
1312
|
+
* a comparison between two values fails. It provides mechanisms to retrieve
|
1313
|
+
* both the expected and actual value.
|
1314
|
+
*
|
1315
|
+
* @param {String} message The message to display when the error occurs.
|
1316
|
+
* @param {Object} expected The expected value.
|
1317
|
+
* @param {Object} actual The actual value that caused the assertion to fail.
|
1318
|
+
* @namespace YAHOO.util
|
1319
|
+
* @extends YAHOO.util.AssertionError
|
1320
|
+
* @class ComparisonFailure
|
1321
|
+
* @constructor
|
1322
|
+
*/
|
1323
|
+
YAHOO.util.ComparisonFailure = function (message /*:String*/, expected /*:Object*/, actual /*:Object*/){
|
1324
|
+
|
1325
|
+
//call superclass
|
1326
|
+
YAHOO.util.AssertionError.call(this, message);
|
1327
|
+
|
1328
|
+
/**
|
1329
|
+
* The expected value.
|
1330
|
+
* @type Object
|
1331
|
+
* @property expected
|
1332
|
+
*/
|
1333
|
+
this.expected /*:Object*/ = expected;
|
1334
|
+
|
1335
|
+
/**
|
1336
|
+
* The actual value.
|
1337
|
+
* @type Object
|
1338
|
+
* @property actual
|
1339
|
+
*/
|
1340
|
+
this.actual /*:Object*/ = actual;
|
1341
|
+
|
1342
|
+
/**
|
1343
|
+
* The name of the error that occurred.
|
1344
|
+
* @type String
|
1345
|
+
* @property name
|
1346
|
+
*/
|
1347
|
+
this.name /*:String*/ = "ComparisonFailure";
|
1348
|
+
|
1349
|
+
};
|
1350
|
+
|
1351
|
+
//inherit methods
|
1352
|
+
YAHOO.lang.extend(YAHOO.util.ComparisonFailure, YAHOO.util.AssertionError, {
|
1353
|
+
|
1354
|
+
/**
|
1355
|
+
* Returns a fully formatted error for an assertion failure. This message
|
1356
|
+
* provides information about the expected and actual values.
|
1357
|
+
* @method toString
|
1358
|
+
* @return {String} A string describing the error.
|
1359
|
+
*/
|
1360
|
+
getMessage : function () /*:String*/ {
|
1361
|
+
return this.message + "\nExpected: " + this.expected + " (" + (typeof this.expected) + ")" +
|
1362
|
+
"\nActual:" + this.actual + " (" + (typeof this.actual) + ")";
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
});
|
1366
|
+
|
1367
|
+
/**
|
1368
|
+
* UnexpectedValue is subclass of AssertionError that is thrown whenever
|
1369
|
+
* a value was unexpected in its scope. This typically means that a test
|
1370
|
+
* was performed to determine that a value was *not* equal to a certain
|
1371
|
+
* value.
|
1372
|
+
*
|
1373
|
+
* @param {String} message The message to display when the error occurs.
|
1374
|
+
* @param {Object} unexpected The unexpected value.
|
1375
|
+
* @namespace YAHOO.util
|
1376
|
+
* @extends YAHOO.util.AssertionError
|
1377
|
+
* @class UnexpectedValue
|
1378
|
+
* @constructor
|
1379
|
+
*/
|
1380
|
+
YAHOO.util.UnexpectedValue = function (message /*:String*/, unexpected /*:Object*/){
|
1381
|
+
|
1382
|
+
//call superclass
|
1383
|
+
YAHOO.util.AssertionError.call(this, message);
|
1384
|
+
|
1385
|
+
/**
|
1386
|
+
* The unexpected value.
|
1387
|
+
* @type Object
|
1388
|
+
* @property unexpected
|
1389
|
+
*/
|
1390
|
+
this.unexpected /*:Object*/ = unexpected;
|
1391
|
+
|
1392
|
+
/**
|
1393
|
+
* The name of the error that occurred.
|
1394
|
+
* @type String
|
1395
|
+
* @property name
|
1396
|
+
*/
|
1397
|
+
this.name /*:String*/ = "UnexpectedValue";
|
1398
|
+
|
1399
|
+
};
|
1400
|
+
|
1401
|
+
//inherit methods
|
1402
|
+
YAHOO.lang.extend(YAHOO.util.UnexpectedValue, YAHOO.util.AssertionError, {
|
1403
|
+
|
1404
|
+
/**
|
1405
|
+
* Returns a fully formatted error for an assertion failure. The message
|
1406
|
+
* contains information about the unexpected value that was encountered.
|
1407
|
+
* @method getMessage
|
1408
|
+
* @return {String} A string describing the error.
|
1409
|
+
*/
|
1410
|
+
getMessage : function () /*:String*/ {
|
1411
|
+
return this.message + "\nUnexpected: " + this.unexpected + " (" + (typeof this.unexpected) + ") ";
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
});
|
1415
|
+
|
1416
|
+
/**
|
1417
|
+
* ShouldFail is subclass of AssertionError that is thrown whenever
|
1418
|
+
* a test was expected to fail but did not.
|
1419
|
+
*
|
1420
|
+
* @param {String} message The message to display when the error occurs.
|
1421
|
+
* @namespace YAHOO.util
|
1422
|
+
* @extends YAHOO.util.AssertionError
|
1423
|
+
* @class ShouldFail
|
1424
|
+
* @constructor
|
1425
|
+
*/
|
1426
|
+
YAHOO.util.ShouldFail = function (message /*:String*/){
|
1427
|
+
|
1428
|
+
//call superclass
|
1429
|
+
YAHOO.util.AssertionError.call(this, message || "This test should fail but didn't.");
|
1430
|
+
|
1431
|
+
/**
|
1432
|
+
* The name of the error that occurred.
|
1433
|
+
* @type String
|
1434
|
+
* @property name
|
1435
|
+
*/
|
1436
|
+
this.name /*:String*/ = "ShouldFail";
|
1437
|
+
|
1438
|
+
};
|
1439
|
+
|
1440
|
+
//inherit methods
|
1441
|
+
YAHOO.lang.extend(YAHOO.util.ShouldFail, YAHOO.util.AssertionError);
|
1442
|
+
|
1443
|
+
/**
|
1444
|
+
* ShouldError is subclass of AssertionError that is thrown whenever
|
1445
|
+
* a test is expected to throw an error but doesn't.
|
1446
|
+
*
|
1447
|
+
* @param {String} message The message to display when the error occurs.
|
1448
|
+
* @namespace YAHOO.util
|
1449
|
+
* @extends YAHOO.util.AssertionError
|
1450
|
+
* @class ShouldError
|
1451
|
+
* @constructor
|
1452
|
+
*/
|
1453
|
+
YAHOO.util.ShouldError = function (message /*:String*/){
|
1454
|
+
|
1455
|
+
//call superclass
|
1456
|
+
YAHOO.util.AssertionError.call(this, message || "This test should have thrown an error but didn't.");
|
1457
|
+
|
1458
|
+
/**
|
1459
|
+
* The name of the error that occurred.
|
1460
|
+
* @type String
|
1461
|
+
* @property name
|
1462
|
+
*/
|
1463
|
+
this.name /*:String*/ = "ShouldError";
|
1464
|
+
|
1465
|
+
};
|
1466
|
+
|
1467
|
+
//inherit methods
|
1468
|
+
YAHOO.lang.extend(YAHOO.util.ShouldError, YAHOO.util.AssertionError);
|
1469
|
+
|
1470
|
+
/**
|
1471
|
+
* UnexpectedError is subclass of AssertionError that is thrown whenever
|
1472
|
+
* an error occurs within the course of a test and the test was not expected
|
1473
|
+
* to throw an error.
|
1474
|
+
*
|
1475
|
+
* @param {Error} cause The unexpected error that caused this error to be
|
1476
|
+
* thrown.
|
1477
|
+
* @namespace YAHOO.util
|
1478
|
+
* @extends YAHOO.util.AssertionError
|
1479
|
+
* @class UnexpectedError
|
1480
|
+
* @constructor
|
1481
|
+
*/
|
1482
|
+
YAHOO.util.UnexpectedError = function (cause /*:Object*/){
|
1483
|
+
|
1484
|
+
//call superclass
|
1485
|
+
YAHOO.util.AssertionError.call(this, "Unexpected error: " + cause.message);
|
1486
|
+
|
1487
|
+
/**
|
1488
|
+
* The unexpected error that occurred.
|
1489
|
+
* @type Error
|
1490
|
+
* @property cause
|
1491
|
+
*/
|
1492
|
+
this.cause /*:Error*/ = cause;
|
1493
|
+
|
1494
|
+
/**
|
1495
|
+
* The name of the error that occurred.
|
1496
|
+
* @type String
|
1497
|
+
* @property name
|
1498
|
+
*/
|
1499
|
+
this.name /*:String*/ = "UnexpectedError";
|
1500
|
+
|
1501
|
+
/**
|
1502
|
+
* Stack information for the error (if provided).
|
1503
|
+
* @type String
|
1504
|
+
* @property stack
|
1505
|
+
*/
|
1506
|
+
this.stack /*:String*/ = cause.stack;
|
1507
|
+
|
1508
|
+
};
|
1509
|
+
|
1510
|
+
//inherit methods
|
1511
|
+
YAHOO.lang.extend(YAHOO.util.UnexpectedError, YAHOO.util.AssertionError);
|
1512
|
+
//-----------------------------------------------------------------------------
|
1513
|
+
// ArrayAssert object
|
1514
|
+
//-----------------------------------------------------------------------------
|
1515
|
+
|
1516
|
+
/**
|
1517
|
+
* The ArrayAssert object provides functions to test JavaScript array objects
|
1518
|
+
* for a variety of cases.
|
1519
|
+
*
|
1520
|
+
* @namespace YAHOO.util
|
1521
|
+
* @class ArrayAssert
|
1522
|
+
* @static
|
1523
|
+
*/
|
1524
|
+
|
1525
|
+
YAHOO.util.ArrayAssert = {
|
1526
|
+
|
1527
|
+
/**
|
1528
|
+
* Asserts that a value is present in an array. This uses the triple equals
|
1529
|
+
* sign so no type cohersion may occur.
|
1530
|
+
* @param {Object} needle The value that is expected in the array.
|
1531
|
+
* @param {Array} haystack An array of values.
|
1532
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1533
|
+
* @method contains
|
1534
|
+
* @static
|
1535
|
+
*/
|
1536
|
+
contains : function (needle /*:Object*/, haystack /*:Array*/,
|
1537
|
+
message /*:String*/) /*:Void*/ {
|
1538
|
+
|
1539
|
+
var found /*:Boolean*/ = false;
|
1540
|
+
var Assert = YAHOO.util.Assert;
|
1541
|
+
|
1542
|
+
//begin checking values
|
1543
|
+
for (var i=0; i < haystack.length && !found; i++){
|
1544
|
+
if (haystack[i] === needle) {
|
1545
|
+
found = true;
|
1546
|
+
}
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
if (!found){
|
1550
|
+
Assert.fail(Assert._formatMessage(message, "Value " + needle + " (" + (typeof needle) + ") not found in array [" + haystack + "]."));
|
1551
|
+
}
|
1552
|
+
},
|
1553
|
+
|
1554
|
+
/**
|
1555
|
+
* Asserts that a set of values are present in an array. This uses the triple equals
|
1556
|
+
* sign so no type cohersion may occur. For this assertion to pass, all values must
|
1557
|
+
* be found.
|
1558
|
+
* @param {Object[]} needles An array of values that are expected in the array.
|
1559
|
+
* @param {Array} haystack An array of values to check.
|
1560
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1561
|
+
* @method containsItems
|
1562
|
+
* @static
|
1563
|
+
*/
|
1564
|
+
containsItems : function (needles /*:Object[]*/, haystack /*:Array*/,
|
1565
|
+
message /*:String*/) /*:Void*/ {
|
1566
|
+
|
1567
|
+
//begin checking values
|
1568
|
+
for (var i=0; i < needles.length; i++){
|
1569
|
+
this.contains(needles[i], haystack, message);
|
1570
|
+
}
|
1571
|
+
},
|
1572
|
+
|
1573
|
+
/**
|
1574
|
+
* Asserts that a value matching some condition is present in an array. This uses
|
1575
|
+
* a function to determine a match.
|
1576
|
+
* @param {Function} matcher A function that returns true if the items matches or false if not.
|
1577
|
+
* @param {Array} haystack An array of values.
|
1578
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1579
|
+
* @method containsMatch
|
1580
|
+
* @static
|
1581
|
+
*/
|
1582
|
+
containsMatch : function (matcher /*:Function*/, haystack /*:Array*/,
|
1583
|
+
message /*:String*/) /*:Void*/ {
|
1584
|
+
|
1585
|
+
//check for valid matcher
|
1586
|
+
if (typeof matcher != "function"){
|
1587
|
+
throw new TypeError("ArrayAssert.containsMatch(): First argument must be a function.");
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
var found /*:Boolean*/ = false;
|
1591
|
+
var Assert = YAHOO.util.Assert;
|
1592
|
+
|
1593
|
+
//begin checking values
|
1594
|
+
for (var i=0; i < haystack.length && !found; i++){
|
1595
|
+
if (matcher(haystack[i])) {
|
1596
|
+
found = true;
|
1597
|
+
}
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
if (!found){
|
1601
|
+
Assert.fail(Assert._formatMessage(message, "No match found in array [" + haystack + "]."));
|
1602
|
+
}
|
1603
|
+
},
|
1604
|
+
|
1605
|
+
/**
|
1606
|
+
* Asserts that a value is not present in an array. This uses the triple equals
|
1607
|
+
* sign so no type cohersion may occur.
|
1608
|
+
* @param {Object} needle The value that is expected in the array.
|
1609
|
+
* @param {Array} haystack An array of values.
|
1610
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1611
|
+
* @method doesNotContain
|
1612
|
+
* @static
|
1613
|
+
*/
|
1614
|
+
doesNotContain : function (needle /*:Object*/, haystack /*:Array*/,
|
1615
|
+
message /*:String*/) /*:Void*/ {
|
1616
|
+
|
1617
|
+
var found /*:Boolean*/ = false;
|
1618
|
+
var Assert = YAHOO.util.Assert;
|
1619
|
+
|
1620
|
+
//begin checking values
|
1621
|
+
for (var i=0; i < haystack.length && !found; i++){
|
1622
|
+
if (haystack[i] === needle) {
|
1623
|
+
found = true;
|
1624
|
+
}
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
if (found){
|
1628
|
+
Assert.fail(Assert._formatMessage(message, "Value found in array [" + haystack + "]."));
|
1629
|
+
}
|
1630
|
+
},
|
1631
|
+
|
1632
|
+
/**
|
1633
|
+
* Asserts that a set of values are not present in an array. This uses the triple equals
|
1634
|
+
* sign so no type cohersion may occur. For this assertion to pass, all values must
|
1635
|
+
* not be found.
|
1636
|
+
* @param {Object[]} needles An array of values that are not expected in the array.
|
1637
|
+
* @param {Array} haystack An array of values to check.
|
1638
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1639
|
+
* @method doesNotContainItems
|
1640
|
+
* @static
|
1641
|
+
*/
|
1642
|
+
doesNotContainItems : function (needles /*:Object[]*/, haystack /*:Array*/,
|
1643
|
+
message /*:String*/) /*:Void*/ {
|
1644
|
+
|
1645
|
+
for (var i=0; i < needles.length; i++){
|
1646
|
+
this.doesNotContain(needles[i], haystack, message);
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
},
|
1650
|
+
|
1651
|
+
/**
|
1652
|
+
* Asserts that no values matching a condition are present in an array. This uses
|
1653
|
+
* a function to determine a match.
|
1654
|
+
* @param {Function} matcher A function that returns true if the items matches or false if not.
|
1655
|
+
* @param {Array} haystack An array of values.
|
1656
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1657
|
+
* @method doesNotContainMatch
|
1658
|
+
* @static
|
1659
|
+
*/
|
1660
|
+
doesNotContainMatch : function (matcher /*:Function*/, haystack /*:Array*/,
|
1661
|
+
message /*:String*/) /*:Void*/ {
|
1662
|
+
|
1663
|
+
//check for valid matcher
|
1664
|
+
if (typeof matcher != "function"){
|
1665
|
+
throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
var found /*:Boolean*/ = false;
|
1669
|
+
var Assert = YAHOO.util.Assert;
|
1670
|
+
|
1671
|
+
//begin checking values
|
1672
|
+
for (var i=0; i < haystack.length && !found; i++){
|
1673
|
+
if (matcher(haystack[i])) {
|
1674
|
+
found = true;
|
1675
|
+
}
|
1676
|
+
}
|
1677
|
+
|
1678
|
+
if (found){
|
1679
|
+
Assert.fail(Assert._formatMessage(message, "Value found in array [" + haystack + "]."));
|
1680
|
+
}
|
1681
|
+
},
|
1682
|
+
|
1683
|
+
/**
|
1684
|
+
* Asserts that the given value is contained in an array at the specified index.
|
1685
|
+
* This uses the triple equals sign so no type cohersion will occur.
|
1686
|
+
* @param {Object} needle The value to look for.
|
1687
|
+
* @param {Array} haystack The array to search in.
|
1688
|
+
* @param {int} index The index at which the value should exist.
|
1689
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1690
|
+
* @method indexOf
|
1691
|
+
* @static
|
1692
|
+
*/
|
1693
|
+
indexOf : function (needle /*:Object*/, haystack /*:Array*/, index /*:int*/, message /*:String*/) /*:Void*/ {
|
1694
|
+
|
1695
|
+
//try to find the value in the array
|
1696
|
+
for (var i=0; i < haystack.length; i++){
|
1697
|
+
if (haystack[i] === needle){
|
1698
|
+
YAHOO.util.Assert.areEqual(index, i, message || "Value exists at index " + i + " but should be at index " + index + ".");
|
1699
|
+
return;
|
1700
|
+
}
|
1701
|
+
}
|
1702
|
+
|
1703
|
+
var Assert = YAHOO.util.Assert;
|
1704
|
+
|
1705
|
+
//if it makes it here, it wasn't found at all
|
1706
|
+
Assert.fail(Assert._formatMessage(message, "Value doesn't exist in array [" + haystack + "]."));
|
1707
|
+
},
|
1708
|
+
|
1709
|
+
/**
|
1710
|
+
* Asserts that the values in an array are equal, and in the same position,
|
1711
|
+
* as values in another array. This uses the double equals sign
|
1712
|
+
* so type cohersion may occur. Note that the array objects themselves
|
1713
|
+
* need not be the same for this test to pass.
|
1714
|
+
* @param {Array} expected An array of the expected values.
|
1715
|
+
* @param {Array} actual Any array of the actual values.
|
1716
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1717
|
+
* @method itemsAreEqual
|
1718
|
+
* @static
|
1719
|
+
*/
|
1720
|
+
itemsAreEqual : function (expected /*:Array*/, actual /*:Array*/,
|
1721
|
+
message /*:String*/) /*:Void*/ {
|
1722
|
+
|
1723
|
+
//one may be longer than the other, so get the maximum length
|
1724
|
+
var len /*:int*/ = Math.max(expected.length, actual.length || 0);
|
1725
|
+
var Assert = YAHOO.util.Assert;
|
1726
|
+
|
1727
|
+
//begin checking values
|
1728
|
+
for (var i=0; i < len; i++){
|
1729
|
+
Assert.areEqual(expected[i], actual[i],
|
1730
|
+
Assert._formatMessage(message, "Values in position " + i + " are not equal."));
|
1731
|
+
}
|
1732
|
+
},
|
1733
|
+
|
1734
|
+
/**
|
1735
|
+
* Asserts that the values in an array are equivalent, and in the same position,
|
1736
|
+
* as values in another array. This uses a function to determine if the values
|
1737
|
+
* are equivalent. Note that the array objects themselves
|
1738
|
+
* need not be the same for this test to pass.
|
1739
|
+
* @param {Array} expected An array of the expected values.
|
1740
|
+
* @param {Array} actual Any array of the actual values.
|
1741
|
+
* @param {Function} comparator A function that returns true if the values are equivalent
|
1742
|
+
* or false if not.
|
1743
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1744
|
+
* @return {Void}
|
1745
|
+
* @method itemsAreEquivalent
|
1746
|
+
* @static
|
1747
|
+
*/
|
1748
|
+
itemsAreEquivalent : function (expected /*:Array*/, actual /*:Array*/,
|
1749
|
+
comparator /*:Function*/, message /*:String*/) /*:Void*/ {
|
1750
|
+
|
1751
|
+
//make sure the comparator is valid
|
1752
|
+
if (typeof comparator != "function"){
|
1753
|
+
throw new TypeError("ArrayAssert.itemsAreEquivalent(): Third argument must be a function.");
|
1754
|
+
}
|
1755
|
+
|
1756
|
+
//one may be longer than the other, so get the maximum length
|
1757
|
+
var len /*:int*/ = Math.max(expected.length, actual.length || 0);
|
1758
|
+
|
1759
|
+
//begin checking values
|
1760
|
+
for (var i=0; i < len; i++){
|
1761
|
+
if (!comparator(expected[i], actual[i])){
|
1762
|
+
throw new YAHOO.util.ComparisonFailure(YAHOO.util.Assert._formatMessage(message, "Values in position " + i + " are not equivalent."), expected[i], actual[i]);
|
1763
|
+
}
|
1764
|
+
}
|
1765
|
+
},
|
1766
|
+
|
1767
|
+
/**
|
1768
|
+
* Asserts that an array is empty.
|
1769
|
+
* @param {Array} actual The array to test.
|
1770
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1771
|
+
* @method isEmpty
|
1772
|
+
* @static
|
1773
|
+
*/
|
1774
|
+
isEmpty : function (actual /*:Array*/, message /*:String*/) /*:Void*/ {
|
1775
|
+
if (actual.length > 0){
|
1776
|
+
var Assert = YAHOO.util.Assert;
|
1777
|
+
Assert.fail(Assert._formatMessage(message, "Array should be empty."));
|
1778
|
+
}
|
1779
|
+
},
|
1780
|
+
|
1781
|
+
/**
|
1782
|
+
* Asserts that an array is not empty.
|
1783
|
+
* @param {Array} actual The array to test.
|
1784
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1785
|
+
* @method isNotEmpty
|
1786
|
+
* @static
|
1787
|
+
*/
|
1788
|
+
isNotEmpty : function (actual /*:Array*/, message /*:String*/) /*:Void*/ {
|
1789
|
+
if (actual.length === 0){
|
1790
|
+
var Assert = YAHOO.util.Assert;
|
1791
|
+
Assert.fail(Assert._formatMessage(message, "Array should not be empty."));
|
1792
|
+
}
|
1793
|
+
},
|
1794
|
+
|
1795
|
+
/**
|
1796
|
+
* Asserts that the values in an array are the same, and in the same position,
|
1797
|
+
* as values in another array. This uses the triple equals sign
|
1798
|
+
* so no type cohersion will occur. Note that the array objects themselves
|
1799
|
+
* need not be the same for this test to pass.
|
1800
|
+
* @param {Array} expected An array of the expected values.
|
1801
|
+
* @param {Array} actual Any array of the actual values.
|
1802
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1803
|
+
* @method itemsAreSame
|
1804
|
+
* @static
|
1805
|
+
*/
|
1806
|
+
itemsAreSame : function (expected /*:Array*/, actual /*:Array*/,
|
1807
|
+
message /*:String*/) /*:Void*/ {
|
1808
|
+
|
1809
|
+
//one may be longer than the other, so get the maximum length
|
1810
|
+
var len /*:int*/ = Math.max(expected.length, actual.length || 0);
|
1811
|
+
var Assert = YAHOO.util.Assert;
|
1812
|
+
|
1813
|
+
//begin checking values
|
1814
|
+
for (var i=0; i < len; i++){
|
1815
|
+
Assert.areSame(expected[i], actual[i],
|
1816
|
+
Assert._formatMessage(message, "Values in position " + i + " are not the same."));
|
1817
|
+
}
|
1818
|
+
},
|
1819
|
+
|
1820
|
+
/**
|
1821
|
+
* Asserts that the given value is contained in an array at the specified index,
|
1822
|
+
* starting from the back of the array.
|
1823
|
+
* This uses the triple equals sign so no type cohersion will occur.
|
1824
|
+
* @param {Object} needle The value to look for.
|
1825
|
+
* @param {Array} haystack The array to search in.
|
1826
|
+
* @param {int} index The index at which the value should exist.
|
1827
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1828
|
+
* @method lastIndexOf
|
1829
|
+
* @static
|
1830
|
+
*/
|
1831
|
+
lastIndexOf : function (needle /*:Object*/, haystack /*:Array*/, index /*:int*/, message /*:String*/) /*:Void*/ {
|
1832
|
+
|
1833
|
+
var Assert = YAHOO.util.Assert;
|
1834
|
+
|
1835
|
+
//try to find the value in the array
|
1836
|
+
for (var i=haystack.length; i >= 0; i--){
|
1837
|
+
if (haystack[i] === needle){
|
1838
|
+
Assert.areEqual(index, i, Assert._formatMessage(message, "Value exists at index " + i + " but should be at index " + index + "."));
|
1839
|
+
return;
|
1840
|
+
}
|
1841
|
+
}
|
1842
|
+
|
1843
|
+
//if it makes it here, it wasn't found at all
|
1844
|
+
Assert.fail(Assert._formatMessage(message, "Value doesn't exist in array."));
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
};
|
1848
|
+
YAHOO.namespace("util");
|
1849
|
+
|
1850
|
+
|
1851
|
+
//-----------------------------------------------------------------------------
|
1852
|
+
// ObjectAssert object
|
1853
|
+
//-----------------------------------------------------------------------------
|
1854
|
+
|
1855
|
+
/**
|
1856
|
+
* The ObjectAssert object provides functions to test JavaScript objects
|
1857
|
+
* for a variety of cases.
|
1858
|
+
*
|
1859
|
+
* @namespace YAHOO.util
|
1860
|
+
* @class ObjectAssert
|
1861
|
+
* @static
|
1862
|
+
*/
|
1863
|
+
YAHOO.util.ObjectAssert = {
|
1864
|
+
|
1865
|
+
/**
|
1866
|
+
* Asserts that all properties in the object exist in another object.
|
1867
|
+
* @param {Object} expected An object with the expected properties.
|
1868
|
+
* @param {Object} actual An object with the actual properties.
|
1869
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1870
|
+
* @method propertiesAreEqual
|
1871
|
+
* @static
|
1872
|
+
*/
|
1873
|
+
propertiesAreEqual : function (expected /*:Object*/, actual /*:Object*/,
|
1874
|
+
message /*:String*/) /*:Void*/ {
|
1875
|
+
|
1876
|
+
var Assert = YAHOO.util.Assert;
|
1877
|
+
|
1878
|
+
//get all properties in the object
|
1879
|
+
var properties /*:Array*/ = [];
|
1880
|
+
for (var property in expected){
|
1881
|
+
properties.push(property);
|
1882
|
+
}
|
1883
|
+
|
1884
|
+
//see if the properties are in the expected object
|
1885
|
+
for (var i=0; i < properties.length; i++){
|
1886
|
+
Assert.isNotUndefined(actual[properties[i]],
|
1887
|
+
Assert._formatMessage(message, "Property '" + properties[i] + "' expected."));
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
},
|
1891
|
+
|
1892
|
+
/**
|
1893
|
+
* Asserts that an object has a property with the given name.
|
1894
|
+
* @param {String} propertyName The name of the property to test.
|
1895
|
+
* @param {Object} object The object to search.
|
1896
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1897
|
+
* @method hasProperty
|
1898
|
+
* @static
|
1899
|
+
*/
|
1900
|
+
hasProperty : function (propertyName /*:String*/, object /*:Object*/, message /*:String*/) /*:Void*/ {
|
1901
|
+
if (!(propertyName in object)){
|
1902
|
+
var Assert = YAHOO.util.Assert;
|
1903
|
+
Assert.fail(Assert._formatMessage(message, "Property '" + propertyName + "' not found on object."));
|
1904
|
+
}
|
1905
|
+
},
|
1906
|
+
|
1907
|
+
/**
|
1908
|
+
* Asserts that a property with the given name exists on an object instance (not on its prototype).
|
1909
|
+
* @param {String} propertyName The name of the property to test.
|
1910
|
+
* @param {Object} object The object to search.
|
1911
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1912
|
+
* @method hasProperty
|
1913
|
+
* @static
|
1914
|
+
*/
|
1915
|
+
hasOwnProperty : function (propertyName /*:String*/, object /*:Object*/, message /*:String*/) /*:Void*/ {
|
1916
|
+
if (!YAHOO.lang.hasOwnProperty(object, propertyName)){
|
1917
|
+
var Assert = YAHOO.util.Assert;
|
1918
|
+
Assert.fail(Assert._formatMessage(message, "Property '" + propertyName + "' not found on object instance."));
|
1919
|
+
}
|
1920
|
+
}
|
1921
|
+
};
|
1922
|
+
//-----------------------------------------------------------------------------
|
1923
|
+
// DateAssert object
|
1924
|
+
//-----------------------------------------------------------------------------
|
1925
|
+
|
1926
|
+
/**
|
1927
|
+
* The DateAssert object provides functions to test JavaScript Date objects
|
1928
|
+
* for a variety of cases.
|
1929
|
+
*
|
1930
|
+
* @namespace YAHOO.util
|
1931
|
+
* @class DateAssert
|
1932
|
+
* @static
|
1933
|
+
*/
|
1934
|
+
|
1935
|
+
YAHOO.util.DateAssert = {
|
1936
|
+
|
1937
|
+
/**
|
1938
|
+
* Asserts that a date's month, day, and year are equal to another date's.
|
1939
|
+
* @param {Date} expected The expected date.
|
1940
|
+
* @param {Date} actual The actual date to test.
|
1941
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1942
|
+
* @method datesAreEqual
|
1943
|
+
* @static
|
1944
|
+
*/
|
1945
|
+
datesAreEqual : function (expected /*:Date*/, actual /*:Date*/, message /*:String*/){
|
1946
|
+
if (expected instanceof Date && actual instanceof Date){
|
1947
|
+
var Assert = YAHOO.util.Assert;
|
1948
|
+
Assert.areEqual(expected.getFullYear(), actual.getFullYear(), Assert._formatMessage(message, "Years should be equal."));
|
1949
|
+
Assert.areEqual(expected.getMonth(), actual.getMonth(), Assert._formatMessage(message, "Months should be equal."));
|
1950
|
+
Assert.areEqual(expected.getDate(), actual.getDate(), Assert._formatMessage(message, "Day of month should be equal."));
|
1951
|
+
} else {
|
1952
|
+
throw new TypeError("DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");
|
1953
|
+
}
|
1954
|
+
},
|
1955
|
+
|
1956
|
+
/**
|
1957
|
+
* Asserts that a date's hour, minutes, and seconds are equal to another date's.
|
1958
|
+
* @param {Date} expected The expected date.
|
1959
|
+
* @param {Date} actual The actual date to test.
|
1960
|
+
* @param {String} message (Optional) The message to display if the assertion fails.
|
1961
|
+
* @method timesAreEqual
|
1962
|
+
* @static
|
1963
|
+
*/
|
1964
|
+
timesAreEqual : function (expected /*:Date*/, actual /*:Date*/, message /*:String*/){
|
1965
|
+
if (expected instanceof Date && actual instanceof Date){
|
1966
|
+
var Assert = YAHOO.util.Assert;
|
1967
|
+
Assert.areEqual(expected.getHours(), actual.getHours(), Assert._formatMessage(message, "Hours should be equal."));
|
1968
|
+
Assert.areEqual(expected.getMinutes(), actual.getMinutes(), Assert._formatMessage(message, "Minutes should be equal."));
|
1969
|
+
Assert.areEqual(expected.getSeconds(), actual.getSeconds(), Assert._formatMessage(message, "Seconds should be equal."));
|
1970
|
+
} else {
|
1971
|
+
throw new TypeError("DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");
|
1972
|
+
}
|
1973
|
+
}
|
1974
|
+
|
1975
|
+
};
|
1976
|
+
YAHOO.register("yuitest_core", YAHOO.tool.TestRunner, {version: "2.8.1", build: "19"});
|