old_sql 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +24 -13
- data/app/controllers/old_sql/report_controller.rb +3 -17
- data/app/views/layouts/old_sql/chart.html.erb +11 -0
- data/app/views/old_sql/report/chart.html.erb +8 -25
- data/lib/generators/old_sql/templates/user_design_template.csv +2 -3
- data/lib/generators/old_sql/templates/user_old_sql_demo_chart_design.yml +18 -9
- data/lib/old_sql/report_design/chart.rb +2 -2
- data/lib/old_sql/report_design/chart_item.rb +4 -4
- data/lib/old_sql/report_design/chart_parser.rb +2 -2
- data/public/javascripts/old_sql/chart.js +33 -0
- metadata +5 -265
- data/public/javascripts/old_sql/MochiKit-1.4.2/Changes +0 -362
- data/public/javascripts/old_sql/MochiKit-1.4.2/LICENSE.txt +0 -69
- data/public/javascripts/old_sql/MochiKit-1.4.2/MANIFEST +0 -179
- data/public/javascripts/old_sql/MochiKit-1.4.2/META.json +0 -17
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Async.html +0 -814
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Base.html +0 -1703
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Color.html +0 -755
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DOM.html +0 -1197
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DateTime.html +0 -168
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DragAndDrop.html +0 -187
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Format.html +0 -300
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Iter.html +0 -524
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Logging.html +0 -420
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/LoggingPane.html +0 -142
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Position.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Selector.html +0 -240
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Signal.html +0 -508
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Sortable.html +0 -244
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Style.html +0 -385
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/VersionHistory.html +0 -384
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Visual.html +0 -1161
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/index.html +0 -447
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/js/toc.js +0 -113
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Async.rst +0 -767
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Base.rst +0 -1445
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Color.rst +0 -651
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DOM.rst +0 -1143
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DateTime.rst +0 -145
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DragAndDrop.rst +0 -197
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Format.rst +0 -258
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Iter.rst +0 -454
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Logging.rst +0 -348
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/LoggingPane.rst +0 -128
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Position.rst +0 -26
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Selector.rst +0 -203
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Signal.rst +0 -498
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Sortable.rst +0 -186
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Style.rst +0 -353
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/VersionHistory.rst +0 -362
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Visual.rst +0 -895
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/index.rst +0 -83
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/ajax_tables.css +0 -69
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/ajax_tables.js +0 -401
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/domains.json +0 -10
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/domains.xml +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/index.html +0 -96
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/color_wheel.css +0 -4
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/color_wheel.js +0 -95
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/index.html +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/dnd_sortable.css +0 -23
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/dropmarker.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/icon.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/index.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable2_test.html +0 -150
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable3_test.html +0 -42
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable4_test.html +0 -90
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable5_test.html +0 -29
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable_test.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable_tree_test.html +0 -189
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/draggable.css +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/draggable.js +0 -73
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/index.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_bigslide.html +0 -36
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_blind.html +0 -65
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_blindslide.html +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_combi.css +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_fadeappear.html +0 -61
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_grow_shrink.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_onload.html +0 -67
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_queue.html +0 -67
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_queue_limit.html +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_scroll.html +0 -483
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_slide.html +0 -62
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/full.html +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/icon.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/index.html +0 -150
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/index.html +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/interpreter.css +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/interpreter.js +0 -373
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/index.html +0 -78
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/key_events.css +0 -5
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/key_events.js +0 -85
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/index.html +0 -46
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/logging_pane.css +0 -78
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/logging_pane.js +0 -11
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/index.html +0 -74
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/mochiregexp.css +0 -73
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/mochiregexp.js +0 -125
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/index.html +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/mouse_events.css +0 -17
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/mouse_events.js +0 -59
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/index.html +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/rounded_corners.css +0 -3
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/rounded_corners.js +0 -19
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_boxes.html +0 -45
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_full.html +0 -119
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_ghost.html +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_hoverclass.html +0 -43
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_scroll.html +0 -91
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_snap.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/index.html +0 -93
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/simple_dnd.css +0 -64
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/index.html +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/sortable_tables.css +0 -66
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/sortable_tables.js +0 -203
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/SyntaxHighlighter.css +0 -177
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/Tests.html +0 -339
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushCSharp.js +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushDelphi.js +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushJScript.js +0 -22
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushPhp.js +0 -23
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushPython.js +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushSql.js +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushVb.js +0 -29
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushXml.js +0 -61
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shCore.js +0 -622
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.css +0 -1
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.html +0 -19
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.js +0 -70
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/bg_docheader.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/g_bullet.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/g_logo_doc.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/css/documentation.css +0 -130
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/css/general.css +0 -48
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Async.js +0 -682
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Base.js +0 -1489
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Color.js +0 -863
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DOM.js +0 -1256
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DateTime.js +0 -222
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DragAndDrop.js +0 -793
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Format.js +0 -304
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Iter.js +0 -844
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Logging.js +0 -315
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/LoggingPane.js +0 -353
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/MochiKit.js +0 -188
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/MockDOM.js +0 -115
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Position.js +0 -236
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Selector.js +0 -415
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Signal.js +0 -897
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Sortable.js +0 -589
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Style.js +0 -594
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Test.js +0 -162
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Visual.js +0 -2026
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/__package__.js +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/MochiKit.js +0 -7829
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/__package__.js +0 -6
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/customize.html +0 -251
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/FakeJSAN.js +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/SimpleTest.js +0 -381
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/TestRunner.js +0 -159
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/test.css +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/cli.js +0 -6
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/index.html +0 -25
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/standalone.js +0 -16
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Base.js +0 -577
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Color.js +0 -137
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_DateTime.js +0 -52
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_DragAndDrop.js +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Format.js +0 -89
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Iter.js +0 -186
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Logging.js +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Async.html +0 -408
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Async.json +0 -1
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Base.html +0 -34
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Color.html +0 -84
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DOM-Safari.html +0 -48
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DOM.html +0 -363
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DateTime.html +0 -39
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DragAndDrop.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Format.html +0 -39
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Iter.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-JSAN.html +0 -32
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Logging.html +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-MochiKit.html +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Selector.html +0 -295
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Signal.html +0 -43
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Style.html +0 -223
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Visual.html +0 -197
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Signal.js +0 -481
- data/public/javascripts/old_sql/plotkit-0.9.1/COPYING +0 -28
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Base.js +0 -406
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Canvas.js +0 -683
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/EasyPlot.js +0 -161
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Layout.js +0 -756
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/PlotKit.js +0 -151
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/PlotKit_Packed.js +0 -2177
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SVG.js +0 -705
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SweetCanvas.js +0 -348
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SweetSVG.js +0 -247
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/dummy.svg +0 -9
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/excanvas.js +0 -723
- data/public/javascripts/old_sql/plotkit-0.9.1/README +0 -1
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/MochiKitAdditions.html +0 -2
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/MochiKitAdditions.txt +0 -2
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Base.html +0 -302
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Base.txt +0 -139
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Canvas.html +0 -172
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Canvas.txt +0 -81
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.EasyPlot.html +0 -155
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.EasyPlot.txt +0 -50
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Layout.html +0 -428
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Layout.txt +0 -330
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.QuickStart.html +0 -368
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.QuickStart.txt +0 -256
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Renderer.html +0 -436
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Renderer.txt +0 -299
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SVG.html +0 -159
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SVG.txt +0 -64
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetCanvas.html +0 -131
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetCanvas.txt +0 -34
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetSVG.html +0 -131
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetSVG.txt +0 -34
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.html +0 -334
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.txt +0 -151
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/SVGCanvasCompat.html +0 -304
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/SVGCanvasCompat.txt +0 -144
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/barsample.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/black.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/blue.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/cyan.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/doc.css +0 -62
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/generate.py +0 -37
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/green.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/orange.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/piesample.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/purple.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/red.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/scripts/custom_rhino.jar +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/scripts/pack.py +0 -58
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/axis.html +0 -31
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/basic.html +0 -25
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/basic.js +0 -143
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/debug.html +0 -56
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo-svg.html +0 -58
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo-svg.js +0 -133
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo.html +0 -57
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo.js +0 -136
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/dynamic.html +0 -161
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/firefox.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/konqueror.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/mozilla.ico +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/msie.gif +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/opera.ico +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/safari.gif +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/labels-img.html +0 -38
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/labels.html +0 -43
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/prototype_compat.html +0 -28
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-easy.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-horiz.html +0 -53
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-neg.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-svg.html +0 -61
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart.html +0 -57
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sample.txt +0 -6
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg-sweet.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg-sweet.js +0 -141
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg.html +0 -26
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg.js +0 -147
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sweet.html +0 -24
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sweet.js +0 -89
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/tests.css +0 -66
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/testsvg.html +0 -20
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/testsvg.js +0 -31
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestRunner: A test runner for SimpleTest
|
|
3
|
-
* TODO:
|
|
4
|
-
*
|
|
5
|
-
* * Avoid moving iframes: That causes reloads on mozilla and opera.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
**/
|
|
9
|
-
var TestRunner = {};
|
|
10
|
-
TestRunner.logEnabled = false;
|
|
11
|
-
TestRunner._iframes = {};
|
|
12
|
-
TestRunner._iframeDocuments = {};
|
|
13
|
-
TestRunner._iframeRows = {};
|
|
14
|
-
TestRunner._currentTest = 0;
|
|
15
|
-
TestRunner._urls = [];
|
|
16
|
-
TestRunner._testsDiv = DIV();
|
|
17
|
-
TestRunner._progressDiv = DIV();
|
|
18
|
-
TestRunner._summaryDiv = DIV(null,
|
|
19
|
-
H1(null, "Tests Summary"),
|
|
20
|
-
TABLE(null,
|
|
21
|
-
THEAD(null,
|
|
22
|
-
TR(null,
|
|
23
|
-
TH(null, "Test"),
|
|
24
|
-
TH(null, "Passed"),
|
|
25
|
-
TH(null, "Failed")
|
|
26
|
-
)
|
|
27
|
-
),
|
|
28
|
-
TBODY()
|
|
29
|
-
)
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* This function is called after generating the summary.
|
|
34
|
-
**/
|
|
35
|
-
TestRunner.onComplete = null;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* If logEnabled is true, this is the logger that will be used.
|
|
39
|
-
**/
|
|
40
|
-
TestRunner.logger = MochiKit.Logging.logger;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Toggle element visibility
|
|
44
|
-
**/
|
|
45
|
-
TestRunner._toggle = function(el) {
|
|
46
|
-
if (el.className == "noshow") {
|
|
47
|
-
el.className = "";
|
|
48
|
-
el.style.cssText = "";
|
|
49
|
-
} else {
|
|
50
|
-
el.className = "noshow";
|
|
51
|
-
el.style.cssText = "width:0px; height:0px; border:0px;";
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Creates the iframe that contains a test
|
|
58
|
-
**/
|
|
59
|
-
TestRunner._makeIframe = function (url) {
|
|
60
|
-
var iframe = document.createElement('iframe');
|
|
61
|
-
iframe.src = url;
|
|
62
|
-
iframe.name = url;
|
|
63
|
-
iframe.width = "500";
|
|
64
|
-
var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
|
|
65
|
-
var tr = TR(null, TD({'colspan': '3'}, iframe));
|
|
66
|
-
iframe._row = tr;
|
|
67
|
-
tbody.appendChild(tr);
|
|
68
|
-
return iframe;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* TestRunner entry point.
|
|
73
|
-
*
|
|
74
|
-
* The arguments are the URLs of the test to be ran.
|
|
75
|
-
*
|
|
76
|
-
**/
|
|
77
|
-
TestRunner.runTests = function (/*url...*/) {
|
|
78
|
-
if (TestRunner.logEnabled)
|
|
79
|
-
TestRunner.logger.log("SimpleTest START");
|
|
80
|
-
|
|
81
|
-
var body = document.getElementsByTagName("body")[0];
|
|
82
|
-
appendChildNodes(body,
|
|
83
|
-
TestRunner._testsDiv,
|
|
84
|
-
TestRunner._progressDiv,
|
|
85
|
-
TestRunner._summaryDiv
|
|
86
|
-
);
|
|
87
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
88
|
-
TestRunner._urls.push(arguments[i]);
|
|
89
|
-
}
|
|
90
|
-
TestRunner.runNextTest();
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Run the next test. If no test remains, calls makeSummary
|
|
95
|
-
**/
|
|
96
|
-
TestRunner.runNextTest = function() {
|
|
97
|
-
if (TestRunner._currentTest < TestRunner._urls.length) {
|
|
98
|
-
var url = TestRunner._urls[TestRunner._currentTest];
|
|
99
|
-
var progress = SPAN(null,
|
|
100
|
-
"Running ", A({href:url}, url), "..."
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
if (TestRunner.logEnabled)
|
|
104
|
-
TestRunner.logger.log(scrapeText(progress));
|
|
105
|
-
|
|
106
|
-
TestRunner._progressDiv.appendChild(progress);
|
|
107
|
-
TestRunner._iframes[url] = TestRunner._makeIframe(url);
|
|
108
|
-
} else {
|
|
109
|
-
TestRunner.makeSummary();
|
|
110
|
-
if (TestRunner.onComplete)
|
|
111
|
-
TestRunner.onComplete();
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* This stub is called by SimpleTest when a test is finished.
|
|
117
|
-
**/
|
|
118
|
-
TestRunner.testFinished = function (doc) {
|
|
119
|
-
appendChildNodes(TestRunner._progressDiv, SPAN(null, "Done"), BR());
|
|
120
|
-
var finishedURL = TestRunner._urls[TestRunner._currentTest];
|
|
121
|
-
|
|
122
|
-
if (TestRunner.logEnabled)
|
|
123
|
-
TestRunner.logger.debug("SimpleTest finished " + finishedURL);
|
|
124
|
-
|
|
125
|
-
TestRunner._iframeDocuments[finishedURL] = doc;
|
|
126
|
-
// TestRunner._iframes[finishedURL].style.display = "none";
|
|
127
|
-
TestRunner._toggle(TestRunner._iframes[finishedURL]);
|
|
128
|
-
TestRunner._currentTest++;
|
|
129
|
-
TestRunner.runNextTest();
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Display the summary in the browser
|
|
134
|
-
**/
|
|
135
|
-
TestRunner.makeSummary = function() {
|
|
136
|
-
if (TestRunner.logEnabled)
|
|
137
|
-
TestRunner.logger.log("SimpleTest FINISHED");
|
|
138
|
-
var rows = [];
|
|
139
|
-
for (var url in TestRunner._iframeDocuments) {
|
|
140
|
-
var doc = TestRunner._iframeDocuments[url];
|
|
141
|
-
var nOK = withDocument(doc,
|
|
142
|
-
partial(getElementsByTagAndClassName, 'div', 'test_ok')
|
|
143
|
-
).length;
|
|
144
|
-
var nNotOK = withDocument(doc,
|
|
145
|
-
partial(getElementsByTagAndClassName, 'div', 'test_not_ok')
|
|
146
|
-
).length;
|
|
147
|
-
var toggle = partial(TestRunner._toggle, TestRunner._iframes[url]);
|
|
148
|
-
var jsurl = "TestRunner._toggle(TestRunner._iframes['" + url + "'])";
|
|
149
|
-
var row = TR(
|
|
150
|
-
{'style': {'backgroundColor': nNotOK > 0 ? "#f00":"#0f0"}},
|
|
151
|
-
TD(null, url),
|
|
152
|
-
TD(null, nOK),
|
|
153
|
-
TD(null, nNotOK)
|
|
154
|
-
);
|
|
155
|
-
row.onclick = toggle;
|
|
156
|
-
var tbody = TestRunner._summaryDiv.getElementsByTagName("tbody")[0];
|
|
157
|
-
tbody.insertBefore(row, TestRunner._iframes[url]._row)
|
|
158
|
-
}
|
|
159
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
.test_ok {
|
|
2
|
-
color: green;
|
|
3
|
-
display: none;
|
|
4
|
-
}
|
|
5
|
-
.test_not_ok {
|
|
6
|
-
color: red;
|
|
7
|
-
display: block;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.test_ok, .test_not_ok {
|
|
11
|
-
border-bottom-width: 2px;
|
|
12
|
-
border-bottom-style: solid;
|
|
13
|
-
border-bottom-color: black;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.all_pass {
|
|
17
|
-
background-color: lime;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.some_fail {
|
|
21
|
-
background-color: red;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.tests_report {
|
|
25
|
-
border-width: 2px;
|
|
26
|
-
border-style: solid;
|
|
27
|
-
width: 20em;
|
|
28
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<script type="text/javascript" src="../lib/MochiKit/MochiKit.js"></script>
|
|
4
|
-
<script type="text/javascript" src="SimpleTest/TestRunner.js"></script>
|
|
5
|
-
</head>
|
|
6
|
-
<body>
|
|
7
|
-
<script type="text/javascript">
|
|
8
|
-
TestRunner.runTests(
|
|
9
|
-
'test_MochiKit-Async.html',
|
|
10
|
-
'test_MochiKit-Base.html',
|
|
11
|
-
'test_MochiKit-DateTime.html',
|
|
12
|
-
'test_MochiKit-DOM.html',
|
|
13
|
-
'test_MochiKit-Style.html',
|
|
14
|
-
'test_MochiKit-Format.html',
|
|
15
|
-
'test_MochiKit-Iter.html',
|
|
16
|
-
'test_MochiKit-Logging.html',
|
|
17
|
-
'test_MochiKit-MochiKit.html',
|
|
18
|
-
'test_MochiKit-Color.html',
|
|
19
|
-
'test_MochiKit-Selector.html',
|
|
20
|
-
'test_MochiKit-Signal.html',
|
|
21
|
-
'test_MochiKit-Visual.html'
|
|
22
|
-
);
|
|
23
|
-
</script>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
load('tests/cli.js');
|
|
2
|
-
|
|
3
|
-
JSAN.use('MochiKit.Test');
|
|
4
|
-
|
|
5
|
-
print("[[ MochiKit.Base ]]");
|
|
6
|
-
runTests('tests.test_Base');
|
|
7
|
-
print("[[ MochiKit.Color ]]");
|
|
8
|
-
runTests('tests.test_Color');
|
|
9
|
-
print("[[ MochiKit.DateTime ]]");
|
|
10
|
-
runTests('tests.test_DateTime');
|
|
11
|
-
print("[[ MochiKit.Format ]]");
|
|
12
|
-
runTests('tests.test_Format');
|
|
13
|
-
print("[[ MochiKit.Iter ]]");
|
|
14
|
-
runTests('tests.test_Iter');
|
|
15
|
-
print("[[ MochiKit.Logging ]]");
|
|
16
|
-
runTests('tests.test_Logging');
|
|
@@ -1,577 +0,0 @@
|
|
|
1
|
-
if (typeof(dojo) != 'undefined') { dojo.require('MochiKit.Base'); }
|
|
2
|
-
if (typeof(JSAN) != 'undefined') { JSAN.use('MochiKit.Base'); }
|
|
3
|
-
if (typeof(tests) == 'undefined') { tests = {}; }
|
|
4
|
-
|
|
5
|
-
tests.test_Base = function (t) {
|
|
6
|
-
// test bind
|
|
7
|
-
var not_self = {"toString": function () { return "not self"; } };
|
|
8
|
-
var self = {"toString": function () { return "self"; } };
|
|
9
|
-
var func = function (arg) { return this.toString() + " " + arg; };
|
|
10
|
-
var boundFunc = bind(func, self);
|
|
11
|
-
not_self.boundFunc = boundFunc;
|
|
12
|
-
|
|
13
|
-
t.is( boundFunc("foo"), "self foo", "boundFunc bound to self properly" );
|
|
14
|
-
t.is( not_self.boundFunc("foo"), "self foo", "boundFunc bound to self on another obj" );
|
|
15
|
-
t.is( bind(boundFunc, not_self)("foo"), "not self foo", "boundFunc successfully rebound!" );
|
|
16
|
-
t.is( bind(boundFunc, undefined, "foo")(), "self foo", "boundFunc partial no self change" );
|
|
17
|
-
t.is( bind(boundFunc, not_self, "foo")(), "not self foo", "boundFunc partial self change" );
|
|
18
|
-
|
|
19
|
-
// test method
|
|
20
|
-
not_self = {"toString": function () { return "not self"; } };
|
|
21
|
-
self = {"toString": function () { return "self"; } };
|
|
22
|
-
func = function (arg) { return this.toString() + " " + arg; };
|
|
23
|
-
var boundMethod = method(self, func);
|
|
24
|
-
not_self.boundMethod = boundMethod;
|
|
25
|
-
|
|
26
|
-
t.is( boundMethod("foo"), "self foo", "boundMethod bound to self properly" );
|
|
27
|
-
t.is( not_self.boundMethod("foo"), "self foo", "boundMethod bound to self on another obj" );
|
|
28
|
-
t.is( method(not_self, boundMethod)("foo"), "not self foo", "boundMethod successfully rebound!" );
|
|
29
|
-
t.is( method(undefined, boundMethod, "foo")(), "self foo", "boundMethod partial no self change" );
|
|
30
|
-
t.is( method(not_self, boundMethod, "foo")(), "not self foo", "boundMethod partial self change" );
|
|
31
|
-
|
|
32
|
-
// test bindLate
|
|
33
|
-
self = {"toString": function () { return "self"; } };
|
|
34
|
-
boundFunc = bindLate("toString", self);
|
|
35
|
-
t.is( boundFunc(), "self", "bindLate binds properly" );
|
|
36
|
-
self.toString = function () { return "not self"; };
|
|
37
|
-
t.is( boundFunc(), "not self", "bindLate late function lookup" );
|
|
38
|
-
func = function (arg) { return this.toString() + " " + arg; };
|
|
39
|
-
boundFunc = bindLate(func, self);
|
|
40
|
-
t.is( boundFunc("foo"), "not self foo", "bindLate fallback to standard bind" );
|
|
41
|
-
|
|
42
|
-
// test bindMethods
|
|
43
|
-
|
|
44
|
-
var O = function (value) {
|
|
45
|
-
bindMethods(this);
|
|
46
|
-
this.value = value;
|
|
47
|
-
};
|
|
48
|
-
O.prototype.func = function () {
|
|
49
|
-
return this.value;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var o = new O("boring");
|
|
53
|
-
var p = {};
|
|
54
|
-
p.func = o.func;
|
|
55
|
-
var func = o.func;
|
|
56
|
-
t.is( o.func(), "boring", "bindMethods doesn't break shit" );
|
|
57
|
-
t.is( p.func(), "boring", "bindMethods works on other objects" );
|
|
58
|
-
t.is( func(), "boring", "bindMethods works on functions" );
|
|
59
|
-
|
|
60
|
-
var p = clone(o);
|
|
61
|
-
t.ok( p instanceof O, "cloned correct inheritance" );
|
|
62
|
-
var q = clone(p);
|
|
63
|
-
t.ok( q instanceof O, "clone-cloned correct inheritance" );
|
|
64
|
-
q.foo = "bar";
|
|
65
|
-
t.is( p.foo, undefined, "clone-clone is copy-on-write" );
|
|
66
|
-
p.bar = "foo";
|
|
67
|
-
t.is( o.bar, undefined, "clone is copy-on-write" );
|
|
68
|
-
t.is( q.bar, "foo", "clone-clone has proper delegation" );
|
|
69
|
-
// unbind
|
|
70
|
-
p.func = bind(p.func, null);
|
|
71
|
-
t.is( p.func(), "boring", "clone function calls correct" );
|
|
72
|
-
q.value = "awesome";
|
|
73
|
-
t.is( q.func(), "awesome", "clone really does work" );
|
|
74
|
-
|
|
75
|
-
// test boring boolean funcs
|
|
76
|
-
t.is( isNull(null), true, "isNull matches null" );
|
|
77
|
-
t.is( isNull(undefined), false, "isNull doesn't match undefined" );
|
|
78
|
-
t.is( isNull({}), false, "isNull doesn't match objects" );
|
|
79
|
-
|
|
80
|
-
t.is( isCallable(isCallable), true, "isCallable returns true on itself" );
|
|
81
|
-
t.is( isCallable(1), false, "isCallable returns false on numbers" );
|
|
82
|
-
|
|
83
|
-
t.is( isUndefined(null), false, "null is not undefined" );
|
|
84
|
-
t.is( isUndefined(""), false, "empty string is not undefined" );
|
|
85
|
-
t.is( isUndefined(undefined), true, "undefined is undefined" );
|
|
86
|
-
t.is( isUndefined({}.foo), true, "missing property is undefined" );
|
|
87
|
-
|
|
88
|
-
t.is( isUndefinedOrNull(null), true, "null is undefined or null" );
|
|
89
|
-
t.is( isUndefinedOrNull(""), false, "empty string is not undefined or null" );
|
|
90
|
-
t.is( isUndefinedOrNull(undefined), true, "undefined is undefined or null" );
|
|
91
|
-
t.is( isUndefinedOrNull({}.foo), true, "missing property is undefined or null" );
|
|
92
|
-
|
|
93
|
-
t.is( isEmpty(null), true, "isEmpty null" );
|
|
94
|
-
t.is( isEmpty([], [], ""), true, "isEmpty true" );
|
|
95
|
-
t.is( isEmpty([], [1], ""), true, "isEmpty true" );
|
|
96
|
-
t.is( isEmpty([1], [1], "1"), false, "isEmpty false" );
|
|
97
|
-
t.is( isEmpty([1], [1], "1"), false, "isEmpty false" );
|
|
98
|
-
|
|
99
|
-
t.is( isNotEmpty(null), false, "isNotEmpty null" );
|
|
100
|
-
t.is( isNotEmpty([], [], ""), false, "isNotEmpty false" );
|
|
101
|
-
t.is( isNotEmpty([], [1], ""), false, "isNotEmpty false" );
|
|
102
|
-
t.is( isNotEmpty([1], [1], "1"), true, "isNotEmpty true" );
|
|
103
|
-
t.is( isNotEmpty([1], [1], "1"), true, "isNotEmpty true" );
|
|
104
|
-
|
|
105
|
-
t.is( isArrayLike(undefined), false, "isArrayLike(undefined)" );
|
|
106
|
-
t.is( isArrayLike(null), false, "isArrayLike(null)" );
|
|
107
|
-
t.is( isArrayLike([]), true, "isArrayLike([])" );
|
|
108
|
-
|
|
109
|
-
// test extension of arrays
|
|
110
|
-
var a = [];
|
|
111
|
-
var b = [];
|
|
112
|
-
var three = [1, 2, 3];
|
|
113
|
-
|
|
114
|
-
extend(a, three, 1);
|
|
115
|
-
t.ok( objEqual(a, [2, 3]), "extend to an empty array" );
|
|
116
|
-
extend(a, three, 1)
|
|
117
|
-
t.ok( objEqual(a, [2, 3, 2, 3]), "extend to a non-empty array" );
|
|
118
|
-
|
|
119
|
-
extend(b, three);
|
|
120
|
-
t.ok( objEqual(b, three), "extend of an empty array" );
|
|
121
|
-
|
|
122
|
-
var c1 = extend(null, three);
|
|
123
|
-
t.ok( objEqual(c1, three), "extend null" );
|
|
124
|
-
var c2 = extend(undefined, three);
|
|
125
|
-
t.ok( objEqual(c2, three), "extend undefined" );
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
t.is( compare(1, 2), -1, "numbers compare lt" );
|
|
129
|
-
t.is( compare(2, 1), 1, "numbers compare gt" );
|
|
130
|
-
t.is( compare(1, 1), 0, "numbers compare eq" );
|
|
131
|
-
t.is( compare([1], [1]), 0, "arrays compare eq" );
|
|
132
|
-
t.is( compare([1], [1, 2]), -1, "arrays compare lt (length)" );
|
|
133
|
-
t.is( compare([1, 2], [2, 1]), -1, "arrays compare lt (contents)" );
|
|
134
|
-
t.is( compare([1, 2], [1]), 1, "arrays compare gt (length)" );
|
|
135
|
-
t.is( compare([2, 1], [1, 1]), 1, "arrays compare gt (contents)" );
|
|
136
|
-
|
|
137
|
-
// test partial application
|
|
138
|
-
var a = [];
|
|
139
|
-
var func = function (a, b) {
|
|
140
|
-
if (arguments.length != 2) {
|
|
141
|
-
return "bad args";
|
|
142
|
-
} else {
|
|
143
|
-
return this.value + a + b;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var self = {"value": 1, "func": func};
|
|
147
|
-
var self2 = {"value": 2};
|
|
148
|
-
t.is( self.func(2, 3), 6, "setup for test is correct" );
|
|
149
|
-
self.funcTwo = partial(self.func, 2);
|
|
150
|
-
t.is( self.funcTwo(3), 6, "partial application works" );
|
|
151
|
-
t.is( self.funcTwo(3), 6, "partial application works still" );
|
|
152
|
-
t.is( bind(self.funcTwo, self2)(3), 7, "rebinding partial works" );
|
|
153
|
-
self.funcTwo = bind(bind(self.funcTwo, self2), null);
|
|
154
|
-
t.is( self.funcTwo(3), 6, "re-unbinding partial application works" );
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// nodeWalk test
|
|
158
|
-
// ... looks a lot like a DOM tree on purpose
|
|
159
|
-
var tree = {
|
|
160
|
-
"id": "nodeWalkTestTree",
|
|
161
|
-
"test:int": "1",
|
|
162
|
-
"childNodes": [
|
|
163
|
-
{
|
|
164
|
-
"test:int": "2",
|
|
165
|
-
"childNodes": [
|
|
166
|
-
{"test:int": "5"},
|
|
167
|
-
"ignored string",
|
|
168
|
-
{"ignored": "object"},
|
|
169
|
-
["ignored", "list"],
|
|
170
|
-
{
|
|
171
|
-
"test:skipchildren": "1",
|
|
172
|
-
"childNodes": [{"test:int": 6}]
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
},
|
|
176
|
-
{"test:int": "3"},
|
|
177
|
-
{"test:int": "4"}
|
|
178
|
-
]
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
var visitedNodes = [];
|
|
182
|
-
nodeWalk(tree, function (node) {
|
|
183
|
-
var attr = node["test:int"];
|
|
184
|
-
if (attr) {
|
|
185
|
-
visitedNodes.push(attr);
|
|
186
|
-
}
|
|
187
|
-
if (node["test:skipchildren"]) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
return node.childNodes;
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
t.ok( objEqual(visitedNodes, ["1", "2", "3", "4", "5"]), "nodeWalk looks like it works");
|
|
194
|
-
|
|
195
|
-
// test map
|
|
196
|
-
var minusOne = function (x) { return x - 1; };
|
|
197
|
-
var res = map(minusOne, [1, 2, 3]);
|
|
198
|
-
t.ok( objEqual(res, [0, 1, 2]), "map works" );
|
|
199
|
-
|
|
200
|
-
var res2 = xmap(minusOne, 1, 2, 3);
|
|
201
|
-
t.ok( objEqual(res2, res), "xmap works" );
|
|
202
|
-
|
|
203
|
-
res = map(operator.add, [1, 2, 3], [2, 4, 6]);
|
|
204
|
-
t.ok( objEqual(res, [3, 6, 9]), "map(fn, p, q) works" );
|
|
205
|
-
|
|
206
|
-
res = map(operator.add, [1, 2, 3], [2, 4, 6, 8]);
|
|
207
|
-
t.ok( objEqual(res, [3, 6, 9]), "map(fn, p, q) works (q long)" );
|
|
208
|
-
|
|
209
|
-
res = map(operator.add, [1, 2, 3, 4], [2, 4, 6]);
|
|
210
|
-
t.ok( objEqual(res, [3, 6, 9]), "map(fn, p, q) works (p long)" );
|
|
211
|
-
|
|
212
|
-
res = map(null, [1, 2, 3], [2, 4, 6]);
|
|
213
|
-
t.ok( objEqual(res, [[1, 2], [2, 4], [3, 6]]), "map(null, p, q) works" );
|
|
214
|
-
|
|
215
|
-
res = zip([1, 2, 3], [2, 4, 6]);
|
|
216
|
-
t.ok( objEqual(res, [[1, 2], [2, 4], [3, 6]]), "zip(p, q) works" );
|
|
217
|
-
|
|
218
|
-
res = map(null, [1, 2, 3]);
|
|
219
|
-
t.ok( objEqual(res, [1, 2, 3]), "map(null, lst) works" );
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
t.is( isNotEmpty("foo"), true, "3 char string is not empty" );
|
|
225
|
-
t.is( isNotEmpty(""), false, "0 char string is empty" );
|
|
226
|
-
t.is( isNotEmpty([1, 2, 3]), true, "3 element list is not empty" );
|
|
227
|
-
t.is( isNotEmpty([]), false, "0 element list is empty" );
|
|
228
|
-
|
|
229
|
-
// test filter
|
|
230
|
-
var greaterThanThis = function (x) { return x > this; };
|
|
231
|
-
var greaterThanOne = function (x) { return x > 1; };
|
|
232
|
-
var res = filter(greaterThanOne, [-1, 0, 1, 2, 3]);
|
|
233
|
-
t.ok( objEqual(res, [2, 3]), "filter works" );
|
|
234
|
-
var res = filter(greaterThanThis, [-1, 0, 1, 2, 3], 1);
|
|
235
|
-
t.ok( objEqual(res, [2, 3]), "filter self works" );
|
|
236
|
-
var res2 = xfilter(greaterThanOne, -1, 0, 1, 2, 3);
|
|
237
|
-
t.ok( objEqual(res2, res), "xfilter works" );
|
|
238
|
-
|
|
239
|
-
t.is(objMax(1, 2, 9, 12, 42, -16, 16), 42, "objMax works (with numbers)");
|
|
240
|
-
t.is(objMin(1, 2, 9, 12, 42, -16, 16), -16, "objMin works (with numbers)");
|
|
241
|
-
|
|
242
|
-
// test adapter registry
|
|
243
|
-
|
|
244
|
-
var R = new AdapterRegistry();
|
|
245
|
-
R.register("callable", isCallable, function () { return "callable"; });
|
|
246
|
-
R.register("arrayLike", isArrayLike, function () { return "arrayLike"; });
|
|
247
|
-
t.is( R.match(function () {}), "callable", "registry found callable" );
|
|
248
|
-
t.is( R.match([]), "arrayLike", "registry found ArrayLike" );
|
|
249
|
-
try {
|
|
250
|
-
R.match(null);
|
|
251
|
-
t.ok( false, "non-matching didn't raise!" );
|
|
252
|
-
} catch (e) {
|
|
253
|
-
t.is( e, NotFound, "non-matching raised correctly" );
|
|
254
|
-
}
|
|
255
|
-
R.register("undefinedOrNull", isUndefinedOrNull, function () { return "undefinedOrNull" });
|
|
256
|
-
R.register("undefined", isUndefined, function () { return "undefined" });
|
|
257
|
-
t.is( R.match(undefined), "undefinedOrNull", "priorities are as documented" );
|
|
258
|
-
t.ok( R.unregister("undefinedOrNull"), "removed adapter" );
|
|
259
|
-
t.is( R.match(undefined), "undefined", "adapter was removed" );
|
|
260
|
-
R.register("undefinedOrNull", isUndefinedOrNull, function () { return "undefinedOrNull" }, true);
|
|
261
|
-
t.is( R.match(undefined), "undefinedOrNull", "override works" );
|
|
262
|
-
|
|
263
|
-
var a1 = {"a": 1, "b": 2, "c": 2};
|
|
264
|
-
var a2 = {"a": 2, "b": 1, "c": 2};
|
|
265
|
-
t.is( keyComparator("a")(a1, a2), -1, "keyComparator 1 lt" );
|
|
266
|
-
t.is( keyComparator("c")(a1, a2), 0, "keyComparator 1 eq" );
|
|
267
|
-
t.is( keyComparator("c", "b")(a1, a2), 1, "keyComparator 2 eq gt" );
|
|
268
|
-
t.is( keyComparator("c", "a")(a1, a2), -1, "keyComparator 2 eq lt" );
|
|
269
|
-
t.is( reverseKeyComparator("a")(a1, a2), 1, "reverseKeyComparator" );
|
|
270
|
-
t.is( compare(concat([1], [2], [3]), [1, 2, 3]), 0, "concat" );
|
|
271
|
-
t.is( repr("foo"), '"foo"', "string repr" );
|
|
272
|
-
t.is( repr(1), '1', "number repr" );
|
|
273
|
-
t.is( listMin([1, 3, 5, 3, -1]), -1, "listMin" );
|
|
274
|
-
t.is( objMin(1, 3, 5, 3, -1), -1, "objMin" );
|
|
275
|
-
t.is( listMax([1, 3, 5, 3, -1]), 5, "listMax" );
|
|
276
|
-
t.is( objMax(1, 3, 5, 3, -1), 5, "objMax" );
|
|
277
|
-
|
|
278
|
-
var v = keys(a1);
|
|
279
|
-
v.sort();
|
|
280
|
-
t.is( compare(v, ["a", "b", "c"]), 0, "keys" );
|
|
281
|
-
v = items(a1);
|
|
282
|
-
v.sort();
|
|
283
|
-
t.is( compare(v, [["a", 1], ["b", 2], ["c", 2]]), 0, "items" );
|
|
284
|
-
|
|
285
|
-
var StringMap = function() {};
|
|
286
|
-
a = new StringMap();
|
|
287
|
-
a.foo = "bar";
|
|
288
|
-
b = new StringMap();
|
|
289
|
-
b.foo = "bar";
|
|
290
|
-
try {
|
|
291
|
-
compare(a, b);
|
|
292
|
-
t.ok( false, "bad comparison registered!?" );
|
|
293
|
-
} catch (e) {
|
|
294
|
-
t.ok( e instanceof TypeError, "bad comparison raised TypeError" );
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
t.is( repr(a), "[object Object]", "default repr for StringMap" );
|
|
298
|
-
var isStringMap = function () {
|
|
299
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
300
|
-
if (!(arguments[i] instanceof StringMap)) {
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return true;
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
registerRepr("stringMap",
|
|
308
|
-
isStringMap,
|
|
309
|
-
function (obj) {
|
|
310
|
-
return "StringMap(" + repr(items(obj)) + ")";
|
|
311
|
-
}
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
t.is( repr(a), 'StringMap([["foo", "bar"]])', "repr worked" );
|
|
315
|
-
|
|
316
|
-
// not public API
|
|
317
|
-
MochiKit.Base.reprRegistry.unregister("stringMap");
|
|
318
|
-
|
|
319
|
-
t.is( repr(a), "[object Object]", "default repr for StringMap" );
|
|
320
|
-
|
|
321
|
-
registerComparator("stringMap",
|
|
322
|
-
isStringMap,
|
|
323
|
-
function (a, b) {
|
|
324
|
-
// no sorted(...) in base
|
|
325
|
-
a = items(a);
|
|
326
|
-
b = items(b);
|
|
327
|
-
a.sort(compare);
|
|
328
|
-
b.sort(compare);
|
|
329
|
-
return compare(a, b);
|
|
330
|
-
}
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
t.is( compare(a, b), 0, "registerComparator" );
|
|
334
|
-
|
|
335
|
-
update(a, {"foo": "bar"}, {"wibble": "baz"}, undefined, null, {"grr": 1});
|
|
336
|
-
t.is( a.foo, "bar", "update worked (first obj)" );
|
|
337
|
-
t.is( a.wibble, "baz", "update worked (second obj)" );
|
|
338
|
-
t.is( a.grr, 1, "update worked (skipped undefined and null)" );
|
|
339
|
-
t.is( compare(a, b), 1, "update worked (comparison)" );
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
setdefault(a, {"foo": "unf"}, {"bar": "web taco"} );
|
|
343
|
-
t.is( a.foo, "bar", "setdefault worked (skipped existing)" );
|
|
344
|
-
t.is( a.bar, "web taco", "setdefault worked (set non-existing)" );
|
|
345
|
-
|
|
346
|
-
a = null;
|
|
347
|
-
a = setdefault(null, {"foo": "bar"});
|
|
348
|
-
t.is( a.foo, "bar", "setdefault worked (self is null)" );
|
|
349
|
-
|
|
350
|
-
a = null;
|
|
351
|
-
a = setdefault(undefined, {"foo": "bar"});
|
|
352
|
-
t.is( a.foo, "bar", "setdefault worked (self is undefined)" );
|
|
353
|
-
|
|
354
|
-
a = null;
|
|
355
|
-
a = update(null, {"foo": "bar"}, {"wibble": "baz"}, undefined, null, {"grr": 1});
|
|
356
|
-
t.is( a.foo, "bar", "update worked (self is null, first obj)" );
|
|
357
|
-
t.is( a.wibble, "baz", "update worked (self is null, second obj)" );
|
|
358
|
-
t.is( a.grr, 1, "update worked (self is null, skipped undefined and null)" );
|
|
359
|
-
|
|
360
|
-
a = null;
|
|
361
|
-
a = update(undefined, {"foo": "bar"}, {"wibble": "baz"}, undefined, null, {"grr": 1});
|
|
362
|
-
t.is( a.foo, "bar", "update worked (self is undefined, first obj)" );
|
|
363
|
-
t.is( a.wibble, "baz", "update worked (self is undefined, second obj)" );
|
|
364
|
-
t.is( a.grr, 1, "update worked (self is undefined, skipped undefined and null)" );
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
var c = items(merge({"foo": "bar"}, {"wibble": "baz"}));
|
|
368
|
-
c.sort(compare);
|
|
369
|
-
t.is( compare(c, [["foo", "bar"], ["wibble", "baz"]]), 0, "merge worked" );
|
|
370
|
-
|
|
371
|
-
// not public API
|
|
372
|
-
MochiKit.Base.comparatorRegistry.unregister("stringMap");
|
|
373
|
-
|
|
374
|
-
try {
|
|
375
|
-
compare(a, b);
|
|
376
|
-
t.ok( false, "bad comparison registered!?" );
|
|
377
|
-
} catch (e) {
|
|
378
|
-
t.ok( e instanceof TypeError, "bad comparison raised TypeError" );
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
var o = {"__repr__": function () { return "__repr__"; }};
|
|
382
|
-
t.is( repr(o), "__repr__", "__repr__ protocol" );
|
|
383
|
-
t.is( repr(MochiKit.Base), MochiKit.Base.__repr__(), "__repr__ protocol when repr is defined" );
|
|
384
|
-
var o = {"NAME": "NAME"};
|
|
385
|
-
t.is( repr(o), "NAME", "NAME protocol (obj)" );
|
|
386
|
-
o = function () { return "TACO" };
|
|
387
|
-
o.NAME = "NAME";
|
|
388
|
-
t.is( repr(o), "NAME", "NAME protocol (func)" );
|
|
389
|
-
|
|
390
|
-
t.is( repr(MochiKit.Base.nameFunctions), "MochiKit.Base.nameFunctions", "test nameFunctions" );
|
|
391
|
-
// Done!
|
|
392
|
-
|
|
393
|
-
t.is( urlEncode("1+2=2").toUpperCase(), "1%2B2%3D2", "urlEncode" );
|
|
394
|
-
t.is( queryString(["a", "b"], [1, "two"]), "a=1&b=two", "queryString");
|
|
395
|
-
t.is( queryString({"a": 1}), "a=1", "one item alternate form queryString" );
|
|
396
|
-
var o = {"a": 1, "b": 2, "c": function() {}};
|
|
397
|
-
var res = queryString(o).split("&");
|
|
398
|
-
res.sort();
|
|
399
|
-
t.is( res.join("&"), "a=1&b=2", "two item alternate form queryString, function skip" );
|
|
400
|
-
var res = parseQueryString("1+1=2&b=3%3D2");
|
|
401
|
-
t.is( res["1 1"], "2", "parseQueryString pathological name" );
|
|
402
|
-
t.is( res.b, "3=2", "parseQueryString second name:value pair" );
|
|
403
|
-
var res = parseQueryString("foo=one&foo=two", true);
|
|
404
|
-
t.is( res["foo"].join(" "), "one two", "parseQueryString useArrays" );
|
|
405
|
-
var res = parseQueryString("?foo=2&bar=1");
|
|
406
|
-
t.is( res["foo"], "2", "parseQueryString strip leading question mark");
|
|
407
|
-
|
|
408
|
-
var res = parseQueryString("x=1&y=2");
|
|
409
|
-
t.is( typeof(res['&']), "undefined", "extra cruft in parseQueryString output");
|
|
410
|
-
|
|
411
|
-
t.is( serializeJSON("foo\n\r\b\f\t\u000B\u001B"), "\"foo\\n\\r\\b\\f\\t\\u000B\\u001B\"", "string JSON" );
|
|
412
|
-
t.is( serializeJSON(null), "null", "null JSON");
|
|
413
|
-
try {
|
|
414
|
-
serializeJSON(undefined);
|
|
415
|
-
t.ok(false, "undefined should not be serializable");
|
|
416
|
-
} catch (e) {
|
|
417
|
-
t.ok(e instanceof TypeError, "undefined not serializable");
|
|
418
|
-
}
|
|
419
|
-
t.is( serializeJSON(1), "1", "1 JSON");
|
|
420
|
-
t.is( serializeJSON(1.23), "1.23", "1.23 JSON");
|
|
421
|
-
t.is( serializeJSON(serializeJSON), null, "function JSON (null, not string)" );
|
|
422
|
-
t.is( serializeJSON([1, "2", 3.3]), "[1, \"2\", 3.3]", "array JSON" );
|
|
423
|
-
var res = evalJSON(serializeJSON({"a":1, "b":2}));
|
|
424
|
-
t.is( res.a, 1, "evalJSON on an object (1)" );
|
|
425
|
-
t.is( res.b, 2, "evalJSON on an object (2)" );
|
|
426
|
-
var res = {"a": 1, "b": 2, "json": function () { return this; }};
|
|
427
|
-
var res = evalJSON(serializeJSON(res));
|
|
428
|
-
t.is( res.a, 1, "evalJSON on an object that jsons self (1)" );
|
|
429
|
-
t.is( res.b, 2, "evalJSON on an object that jsons self (2)" );
|
|
430
|
-
var strJSON = {"a": 1, "b": 2, "json": function () { return "json"; }};
|
|
431
|
-
t.is( serializeJSON(strJSON), "\"json\"", "json serialization calling" );
|
|
432
|
-
t.is( serializeJSON([strJSON]), "[\"json\"]", "json serialization calling in a structure" );
|
|
433
|
-
t.is( evalJSON('/* {"result": 1} */').result, 1, "json comment stripping" );
|
|
434
|
-
t.is( evalJSON('/* {"*/ /*": 1} */')['*/ /*'], 1, "json comment stripping" );
|
|
435
|
-
registerJSON("isDateLike",
|
|
436
|
-
isDateLike,
|
|
437
|
-
function (d) {
|
|
438
|
-
return "this was a date";
|
|
439
|
-
}
|
|
440
|
-
);
|
|
441
|
-
t.is( serializeJSON(new Date()), "\"this was a date\"", "json registry" );
|
|
442
|
-
MochiKit.Base.jsonRegistry.unregister("isDateLike");
|
|
443
|
-
|
|
444
|
-
var a = {"foo": {"bar": 12, "wibble": 13}};
|
|
445
|
-
var b = {"foo": {"baz": 4, "bar": 16}, "bar": 4};
|
|
446
|
-
updatetree(a, b);
|
|
447
|
-
var expect = [["bar", 16], ["baz", 4], ["wibble", 13]];
|
|
448
|
-
var got = items(a.foo);
|
|
449
|
-
got.sort(compare);
|
|
450
|
-
t.is( repr(got), repr(expect), "updatetree merge" );
|
|
451
|
-
t.is( a.bar, 4, "updatetree insert" );
|
|
452
|
-
|
|
453
|
-
var aa = {"foo": {"bar": 12, "wibble": 13}};
|
|
454
|
-
var bb = {"foo": {"baz": 4, "bar": 16}, "bar": 4};
|
|
455
|
-
|
|
456
|
-
cc = updatetree(null, aa, bb);
|
|
457
|
-
got = items(cc.foo);
|
|
458
|
-
got.sort(compare);
|
|
459
|
-
t.is( repr(got), repr(expect), "updatetree merge (self is null)" );
|
|
460
|
-
t.is( cc.bar, 4, "updatetree insert (self is null)" );
|
|
461
|
-
|
|
462
|
-
cc = updatetree(undefined, aa, bb);
|
|
463
|
-
got = items(cc.foo);
|
|
464
|
-
got.sort(compare);
|
|
465
|
-
t.is( repr(got), repr(expect), "updatetree merge (self is undefined)" );
|
|
466
|
-
t.is( cc.bar, 4, "updatetree insert (self is undefined)" );
|
|
467
|
-
|
|
468
|
-
var c = counter();
|
|
469
|
-
t.is( c(), 1, "counter starts at 1" );
|
|
470
|
-
t.is( c(), 2, "counter increases" );
|
|
471
|
-
c = counter(2);
|
|
472
|
-
t.is( c(), 2, "counter starts at 2" );
|
|
473
|
-
t.is( c(), 3, "counter increases" );
|
|
474
|
-
|
|
475
|
-
t.is( findValue([1, 2, 3], 4), -1, "findValue returns -1 on not found");
|
|
476
|
-
t.is( findValue([1, 2, 3], 1), 0, "findValue returns correct index");
|
|
477
|
-
t.is( findValue([1, 2, 3], 1, 1), -1, "findValue honors start");
|
|
478
|
-
t.is( findValue([1, 2, 3], 2, 0, 1), -1, "findValue honors end");
|
|
479
|
-
t.is( findIdentical([1, 2, 3], 4), -1, "findIdentical returns -1");
|
|
480
|
-
t.is( findIdentical([1, 2, 3], 1), 0, "findIdentical returns correct index");
|
|
481
|
-
t.is( findIdentical([1, 2, 3], 1, 1), -1, "findIdentical honors start");
|
|
482
|
-
t.is( findIdentical([1, 2, 3], 2, 0, 1), -1, "findIdentical honors end");
|
|
483
|
-
|
|
484
|
-
var flat = flattenArguments(1, "2", 3, [4, [5, [6, 7], 8, [], 9]]);
|
|
485
|
-
var expect = [1, "2", 3, 4, 5, 6, 7, 8, 9];
|
|
486
|
-
t.is( repr(flat), repr(expect), "flattenArguments" );
|
|
487
|
-
|
|
488
|
-
var fn = function () {
|
|
489
|
-
return [this, concat(arguments)];
|
|
490
|
-
}
|
|
491
|
-
t.is( methodcaller("toLowerCase")("FOO"), "foo", "methodcaller with a method name" );
|
|
492
|
-
t.is( repr(methodcaller(fn, 2, 3)(1)), "[1, [2, 3]]", "methodcaller with a function" );
|
|
493
|
-
|
|
494
|
-
var f1 = function (x) { return [1, x]; };
|
|
495
|
-
var f2 = function (x) { return [2, x]; };
|
|
496
|
-
var f3 = function (x) { return [3, x]; };
|
|
497
|
-
t.is( repr(f1(f2(f3(4)))), "[1, [2, [3, 4]]]", "test the compose test" );
|
|
498
|
-
t.is( repr(compose(f1,f2,f3)(4)), "[1, [2, [3, 4]]]", "three fn composition works" );
|
|
499
|
-
t.is( repr(compose(compose(f1,f2),f3)(4)), "[1, [2, [3, 4]]]", "associative left" );
|
|
500
|
-
t.is( repr(compose(f1,compose(f2,f3))(4)), "[1, [2, [3, 4]]]", "associative right" );
|
|
501
|
-
|
|
502
|
-
try {
|
|
503
|
-
compose(f1, "foo");
|
|
504
|
-
t.ok( false, "wrong compose argument not raised!" );
|
|
505
|
-
} catch (e) {
|
|
506
|
-
t.is( e.name, 'TypeError', "wrong compose argument raised correctly" );
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
t.is(camelize('one'), 'one', 'one word');
|
|
510
|
-
t.is(camelize('one-two'), 'oneTwo', 'two words');
|
|
511
|
-
t.is(camelize('one-two-three'), 'oneTwoThree', 'three words');
|
|
512
|
-
t.is(camelize('1-one'), '1One', 'letter and word');
|
|
513
|
-
t.is(camelize('one-'), 'one', 'trailing hyphen');
|
|
514
|
-
t.is(camelize('-one'), 'One', 'starting hyphen');
|
|
515
|
-
t.is(camelize('o-two'), 'oTwo', 'one character and word');
|
|
516
|
-
|
|
517
|
-
var flat = flattenArray([1, "2", 3, [4, [5, [6, 7], 8, [], 9]]]);
|
|
518
|
-
var expect = [1, "2", 3, 4, 5, 6, 7, 8, 9];
|
|
519
|
-
t.is( repr(flat), repr(expect), "flattenArray" );
|
|
520
|
-
|
|
521
|
-
/* mean */
|
|
522
|
-
try {
|
|
523
|
-
mean();
|
|
524
|
-
t.ok( false, "mean no arguments didn't raise!" );
|
|
525
|
-
} catch (e) {
|
|
526
|
-
t.is( e.name, 'TypeError', "no arguments raised correctly" );
|
|
527
|
-
}
|
|
528
|
-
t.is( mean(1), 1, 'single argument (arg list)');
|
|
529
|
-
t.is( mean([1]), 1, 'single argument (array)');
|
|
530
|
-
t.is( mean(1,2,3), 2, 'three arguments (arg list)');
|
|
531
|
-
t.is( mean([1,2,3]), 2, 'three arguments (array)');
|
|
532
|
-
t.is( average(1), 1, 'test the average alias');
|
|
533
|
-
|
|
534
|
-
/* median */
|
|
535
|
-
try {
|
|
536
|
-
median();
|
|
537
|
-
t.ok( false, "median no arguments didn't raise!" );
|
|
538
|
-
} catch (e) {
|
|
539
|
-
t.is( e.name, 'TypeError', "no arguments raised correctly" );
|
|
540
|
-
}
|
|
541
|
-
t.is( median(1), 1, 'single argument (arg list)');
|
|
542
|
-
t.is( median([1]), 1, 'single argument (array)');
|
|
543
|
-
t.is( median(3,1,2), 2, 'three arguments (arg list)');
|
|
544
|
-
t.is( median([3,1,2]), 2, 'three arguments (array)');
|
|
545
|
-
t.is( median(3,1,2,4), 2.5, 'four arguments (arg list)');
|
|
546
|
-
t.is( median([3,1,2,4]), 2.5, 'four arguments (array)');
|
|
547
|
-
|
|
548
|
-
/* #185 */
|
|
549
|
-
t.is( serializeJSON(parseQueryString("")), "{}", "parseQueryString('')" );
|
|
550
|
-
t.is( serializeJSON(parseQueryString("", true)), "{}", "parseQueryString('', true)" );
|
|
551
|
-
|
|
552
|
-
/* #109 */
|
|
553
|
-
t.is( queryString({ids: [1,2,3]}), "ids=1&ids=2&ids=3", "queryString array value" );
|
|
554
|
-
t.is( queryString({ids: "123"}), "ids=123", "queryString string value" );
|
|
555
|
-
|
|
556
|
-
/* test values */
|
|
557
|
-
var o = {a: 1, b: 2, c: 4, d: -1};
|
|
558
|
-
var got = values(o);
|
|
559
|
-
got.sort();
|
|
560
|
-
t.is( repr(got), repr([-1, 1, 2, 4]), "values()" );
|
|
561
|
-
|
|
562
|
-
t.is( queryString([["foo", "bar"], ["baz", "wibble"]]), "foo=baz&bar=wibble" );
|
|
563
|
-
o = parseQueryString("foo=1=1=1&bar=2&baz&wibble=");
|
|
564
|
-
t.is( o.foo, "1=1=1", "parseQueryString multiple = first" );
|
|
565
|
-
t.is( o.bar, "2", "parseQueryString multiple = second" );
|
|
566
|
-
t.is( o.baz, "", "parseQueryString multiple = third" );
|
|
567
|
-
t.is( o.wibble, "", "parseQueryString multiple = fourth" );
|
|
568
|
-
|
|
569
|
-
/* queryString with null values */
|
|
570
|
-
t.is( queryString(["a", "b"], [1, null]), "a=1", "queryString with null value" );
|
|
571
|
-
t.is( queryString({"a": 1, "b": null}), "a=1", "queryString with null value" );
|
|
572
|
-
|
|
573
|
-
var reprFunc = function (a, b) {
|
|
574
|
-
return;
|
|
575
|
-
}
|
|
576
|
-
t.is( repr(reprFunc), "function (a, b) {...}", "repr of function" );
|
|
577
|
-
};
|