teabag 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +59 -59
- data/app/assets/javascripts/teabag-jasmine.js +229 -190
- data/app/assets/javascripts/teabag-mocha.js +217 -192
- data/app/assets/javascripts/teabag-qunit.js +3023 -0
- data/app/assets/javascripts/teabag/base/reporters/console.coffee +42 -26
- data/app/assets/javascripts/teabag/base/reporters/html.coffee +4 -3
- data/app/assets/javascripts/teabag/base/reporters/html/base_view.coffee +49 -0
- data/app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee +1 -1
- data/app/assets/javascripts/teabag/base/runner.coffee +10 -0
- data/app/assets/javascripts/teabag/base/teabag.coffee +15 -1
- data/app/assets/javascripts/teabag/jasmine.coffee +53 -5
- data/app/assets/javascripts/teabag/mocha.coffee +51 -5
- data/app/assets/javascripts/teabag/mocha/reporters/console.coffee +3 -2
- data/app/assets/javascripts/teabag/qunit.coffee +61 -0
- data/app/assets/javascripts/teabag/qunit/reporters/console.coffee +25 -0
- data/app/assets/javascripts/teabag/qunit/reporters/html.coffee +80 -0
- data/app/helpers/teabag/spec_helper.rb +6 -14
- data/lib/generators/teabag/install/templates/initializer.rb +2 -1
- data/lib/teabag/configuration.rb +15 -4
- data/lib/teabag/console.rb +5 -11
- data/lib/teabag/drivers/base_driver.rb +10 -0
- data/lib/teabag/{phantomjs → drivers/phantomjs}/runner.coffee +0 -0
- data/lib/teabag/drivers/phantomjs_driver.rb +25 -0
- data/lib/teabag/drivers/selenium_driver.rb +29 -0
- data/lib/teabag/formatters/base_formatter.rb +4 -2
- data/lib/teabag/formatters/{progress_formatter.rb → dot_formatter.rb} +5 -5
- data/lib/teabag/formatters/swayze_or_oprah_formatter.rb +1 -1
- data/lib/teabag/formatters/tap_y_formatter.rb +85 -0
- data/lib/teabag/result.rb +18 -29
- data/lib/teabag/runner.rb +2 -2
- data/lib/teabag/version.rb +1 -1
- data/spec/dummy/config/initializers/teabag.rb +6 -0
- data/spec/dummy/log/development.log +87684 -0
- data/spec/dummy/log/test.log +556 -0
- data/spec/dummy/tmp/cache/assets/C13/B50/sprockets%2F431452d41e5087d2211162d23c63789b +0 -0
- data/spec/dummy/tmp/cache/assets/C18/F90/sprockets%2F369a3f720404378b4162541fd432742d +0 -0
- data/spec/dummy/tmp/cache/assets/C2B/5D0/sprockets%2F98606f6051a5fc71379af24236793353 +0 -0
- data/spec/dummy/tmp/cache/assets/C4E/9B0/sprockets%2Fa807397434c9262c3d62da3e91152184 +0 -0
- data/spec/dummy/tmp/cache/assets/C59/250/sprockets%2Fa80d3fe493d2476e58c4323996064512 +0 -0
- data/spec/dummy/tmp/cache/assets/C72/150/sprockets%2F4194031b4b51b6422c14ac697e3455e5 +0 -0
- data/spec/dummy/tmp/cache/assets/C75/D50/sprockets%2F5302968a40e08d2c011aa38666d273f6 +0 -0
- data/spec/dummy/tmp/cache/assets/C78/6B0/sprockets%2F173640f631a07f48c900a9c2923c825b +0 -0
- data/spec/dummy/tmp/cache/assets/C78/EF0/sprockets%2F65f827a4a5337d05d037845161b41ab8 +0 -0
- data/spec/dummy/tmp/cache/assets/C78/F80/sprockets%2F9161622ddd251097a4ab816b8220984c +0 -0
- data/spec/dummy/tmp/cache/assets/C7A/EC0/sprockets%2F5c16e4214f5662e1b27932a57c43491b +0 -0
- data/spec/dummy/tmp/cache/assets/C7C/AC0/sprockets%2F29124be1160817c61bb4878894b2ba55 +0 -0
- data/spec/dummy/tmp/cache/assets/C80/F70/sprockets%2Fe5c9811902c221828ea647978f000be3 +0 -0
- data/spec/dummy/tmp/cache/assets/C87/2C0/sprockets%2F60f61c07481249fc7922664609fcae52 +0 -0
- data/spec/dummy/tmp/cache/assets/C89/700/sprockets%2F259935a7704fef0069303ea63fa89408 +0 -0
- data/spec/dummy/tmp/cache/assets/C8A/460/sprockets%2F77bffd9959420103906722b404ae8d59 +0 -0
- data/spec/dummy/tmp/cache/assets/C91/FA0/sprockets%2F2eb81283f5789ae91a69344552db3856 +0 -0
- data/spec/dummy/tmp/cache/assets/C97/430/sprockets%2Fc049582fd1c9178ff983323f75326f64 +0 -0
- data/spec/dummy/tmp/cache/assets/CA2/F50/sprockets%2F86094c5d1b6399d614b0771a3a0a45b0 +0 -0
- data/spec/dummy/tmp/cache/assets/CA6/2F0/sprockets%2F20040c18b672e4c4d2731a2a929d8b97 +0 -0
- data/spec/dummy/tmp/cache/assets/CA9/C40/sprockets%2F932b7e2cd1e067289ab51190800814df +0 -0
- data/spec/dummy/tmp/cache/assets/CAA/0C0/sprockets%2F057b0ce384f16d9202ae84473436cc35 +0 -0
- data/spec/dummy/tmp/cache/assets/CAD/410/sprockets%2F651414e5c7e86f05c5108dc71626b25c +0 -0
- data/spec/dummy/tmp/cache/assets/CB4/6A0/sprockets%2F7373c9de844b711519cb49c4f1b16822 +0 -0
- data/spec/dummy/tmp/cache/assets/CBB/FA0/sprockets%2F74922109263bdc965b2e9567eec6d154 +0 -0
- data/spec/dummy/tmp/cache/assets/CBF/630/sprockets%2F707d2db81468088470d476abff35388d +0 -0
- data/spec/dummy/tmp/cache/assets/CCE/C50/sprockets%2Fe12774c2fea852112414bb379a71f31a +0 -0
- data/spec/dummy/tmp/cache/assets/CD3/460/sprockets%2F7f3f6802b0b309ed142d0b671c9640c4 +0 -0
- data/spec/dummy/tmp/cache/assets/CD9/DD0/sprockets%2Fe5774759168a731da1c1149ecf0e1b03 +0 -0
- data/spec/dummy/tmp/cache/assets/CDB/630/sprockets%2Ffd1626fe1016c81d57217f7f80c4370a +0 -0
- data/spec/dummy/tmp/cache/assets/CE0/090/sprockets%2F48d5d35ae87d0723318b8bc257fa2237 +0 -0
- data/spec/dummy/tmp/cache/assets/CE1/250/sprockets%2Ffdc680a0d4383d37910e549ca96f5303 +0 -0
- data/spec/dummy/tmp/cache/assets/CE1/730/sprockets%2Fa1678837061e18d7aca0286c07acf676 +0 -0
- data/spec/dummy/tmp/cache/assets/CE2/190/sprockets%2F0183b0f4e9f302b8677a5e31c45c89c5 +0 -0
- data/spec/dummy/tmp/cache/assets/CE3/1F0/sprockets%2Fe69a515d3a9d14c669be8871012a7d07 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/270/sprockets%2F2c98152560d18470fec8cf4c6829b4d0 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/7C0/sprockets%2Fa03a2c86ce6724be8542295e1cf24798 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/600/sprockets%2F7656791c172a6037cfffe2a226291c9e +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/A60/sprockets%2Ff58eee249aa167d23f8220087bb46684 +0 -0
- data/spec/dummy/tmp/cache/assets/CE9/9E0/sprockets%2F135480d497ed7e4884462dc0ef0b80d7 +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/090/sprockets%2F55dcd7ace406b77208c380d496e37864 +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/680/sprockets%2F67f0794ef8c0576d5c7da34f4437305a +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/B40/sprockets%2F1150bf8d912aa100a132251eefaf6045 +0 -0
- data/spec/dummy/tmp/cache/assets/CEC/360/sprockets%2F264b79dde726b36d63fee272a0609469 +0 -0
- data/spec/dummy/tmp/cache/assets/CF4/6F0/sprockets%2Fed96f92571224b862b84d7078b86ded3 +0 -0
- data/spec/dummy/tmp/cache/assets/CF7/F10/sprockets%2F8c45854ebd195b52cc42bf3f99996336 +0 -0
- data/spec/dummy/tmp/cache/assets/CF8/780/sprockets%2F8845b81ff27cdb57c835836c9f91a265 +0 -0
- data/spec/dummy/tmp/cache/assets/CFB/210/sprockets%2F9104695bfbf9a9d4b94382e6e90487a9 +0 -0
- data/spec/dummy/tmp/cache/assets/CFC/380/sprockets%2Fa7443cbd671446a589867dd5f4a4f989 +0 -0
- data/spec/dummy/tmp/cache/assets/D00/110/sprockets%2F6a6353b7723a8b21708e0fbfe04bd422 +0 -0
- data/spec/dummy/tmp/cache/assets/D00/F60/sprockets%2F42e279b52511c47d26c0adb125fd04e8 +0 -0
- data/spec/dummy/tmp/cache/assets/D03/630/sprockets%2F5d8da32dba6a7be70426a1d554773701 +0 -0
- data/spec/dummy/tmp/cache/assets/D04/170/sprockets%2F76ab1dc02e6c7618852708a1e05a2df3 +0 -0
- data/spec/dummy/tmp/cache/assets/D04/480/sprockets%2F8bd8f10500b21d2f9d94e4cd1401c936 +0 -0
- data/spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d +0 -0
- data/spec/dummy/tmp/cache/assets/D09/BF0/sprockets%2F9e6bca5d26f50d9484385d51ba04312c +0 -0
- data/spec/dummy/tmp/cache/assets/D0B/740/sprockets%2F781d3a2f0449451e9f35c5b0e3e2df41 +0 -0
- data/spec/dummy/tmp/cache/assets/D0E/570/sprockets%2F90fe371bf8091e88a712124d9cdae260 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/D60/sprockets%2F06d6413e059dbac9a62155639ce88d2c +0 -0
- data/spec/dummy/tmp/cache/assets/D11/F80/sprockets%2F48961522f6cd1a15f2fe6e25f1b37a75 +0 -0
- data/spec/dummy/tmp/cache/assets/D12/F40/sprockets%2Fb6f95541e256c15909e0a5a5fbf2a359 +0 -0
- data/spec/dummy/tmp/cache/assets/D15/750/sprockets%2F8effdd3e668a4036260a3e370f3b6657 +0 -0
- data/spec/dummy/tmp/cache/assets/D17/710/sprockets%2Ffa49fb6823d466e79a195e0cd71340c5 +0 -0
- data/spec/dummy/tmp/cache/assets/D18/AF0/sprockets%2F8f572049bd1b0a6f1eb3d27979c9544c +0 -0
- data/spec/dummy/tmp/cache/assets/D1A/D30/sprockets%2F815a5177e9edba0c5c996182ef1b3675 +0 -0
- data/spec/dummy/tmp/cache/assets/D1B/730/sprockets%2Fcf6ce779d043d29aae915f599a413380 +0 -0
- data/spec/dummy/tmp/cache/assets/D1D/560/sprockets%2F1ca784ee7ba1922465147e7f8963eae5 +0 -0
- data/spec/dummy/tmp/cache/assets/D21/AD0/sprockets%2Fd471d7f687f61341d8b19efc41f39e44 +0 -0
- data/spec/dummy/tmp/cache/assets/D22/D70/sprockets%2Fe86ae12aa97067ed78aa94489484ec16 +0 -0
- data/spec/dummy/tmp/cache/assets/D2F/810/sprockets%2F1a2674b7dac8ff403c23a570475ace04 +0 -0
- data/spec/dummy/tmp/cache/assets/D30/480/sprockets%2Feb011f46c64dbefb1f7e21329644c240 +0 -0
- data/spec/dummy/tmp/cache/assets/D31/9C0/sprockets%2Fbd102a4f5a4985c3519dd6ab0295a1c6 +0 -0
- data/spec/dummy/tmp/cache/assets/D34/920/sprockets%2Ff234dd736ae50902ba074c526ca8f0c8 +0 -0
- data/spec/dummy/tmp/cache/assets/D35/7C0/sprockets%2Ff536a2606eaf7d542c0985104cb62baf +0 -0
- data/spec/dummy/tmp/cache/assets/D35/F00/sprockets%2F8e7f22358123b7eb5e21d17f442ce0ac +0 -0
- data/spec/dummy/tmp/cache/assets/D37/810/sprockets%2F99de576ce6ad42b5c0843fc21c2025b2 +0 -0
- data/spec/dummy/tmp/cache/assets/D37/FF0/sprockets%2F96841ca4cfae32c515077f3f5fc303b2 +0 -0
- data/spec/dummy/tmp/cache/assets/D39/BE0/sprockets%2Fdb727091cf3e4b4f6126c48b6063ef0b +0 -0
- data/spec/dummy/tmp/cache/assets/D3C/840/sprockets%2Fc6202ec91d567a85bd3d46dc43ea9108 +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/EC0/sprockets%2F1aa82cb99ef076aea10d472b30a58979 +0 -0
- data/spec/dummy/tmp/cache/assets/D3F/3A0/sprockets%2F1b3734b358a405ca6f92455db8e4b5ff +0 -0
- data/spec/dummy/tmp/cache/assets/D45/C30/sprockets%2Fcc744877558178a3adb77c441cadce70 +0 -0
- data/spec/dummy/tmp/cache/assets/D48/160/sprockets%2F32bae66fd65ce3643efb543182f2e885 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/1F0/sprockets%2F773b56f87127c6605e7d1d3faf2b6af6 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/A10/sprockets%2Fc4656bd995a6f297c26d19b13aadb963 +0 -0
- data/spec/dummy/tmp/cache/assets/D4A/A50/sprockets%2Fb95795be8b937dab770541e27ddb2e70 +0 -0
- data/spec/dummy/tmp/cache/assets/D4C/840/sprockets%2F7732c94884c24e764f109ce2deb2a9ed +0 -0
- data/spec/dummy/tmp/cache/assets/D50/D70/sprockets%2Fe2a3e6c95b11e0801a4eebae3a026026 +0 -0
- data/spec/dummy/tmp/cache/assets/D51/400/sprockets%2Ff5e433d8a31e80985b75ce598de236be +0 -0
- data/spec/dummy/tmp/cache/assets/D58/870/sprockets%2F3cef1ff075a050004b74ffa13c8c4f02 +0 -0
- data/spec/dummy/tmp/cache/assets/D5B/9D0/sprockets%2F9c18c0aa5bbe1b323c5022c98aa09f29 +0 -0
- data/spec/dummy/tmp/cache/assets/D5B/E60/sprockets%2F167c229432f74a17b4c6a07bbb19aacb +0 -0
- data/spec/dummy/tmp/cache/assets/D5C/710/sprockets%2F9427d05cee2caa721241a25a9af1d08f +0 -0
- data/spec/dummy/tmp/cache/assets/D5C/CC0/sprockets%2Faa8bf6de211f2765b0a26f112b971f0c +0 -0
- data/spec/dummy/tmp/cache/assets/D5E/FA0/sprockets%2Fc81c371ae2d61a6aa1708262fba79e0d +0 -0
- data/spec/dummy/tmp/cache/assets/D60/060/sprockets%2Fe8a6ac51dd42491eaa2f9130c1629eb2 +0 -0
- data/spec/dummy/tmp/cache/assets/D61/1F0/sprockets%2F0c7a6176d2fc4db00bb9a74d36380fe1 +0 -0
- data/spec/dummy/tmp/cache/assets/D61/BD0/sprockets%2Ff96fcad988ca7fea975e538c27188605 +0 -0
- data/spec/dummy/tmp/cache/assets/D65/AD0/sprockets%2Fcc53fff930eaf306c15c4568cb265c00 +0 -0
- data/spec/dummy/tmp/cache/assets/D67/030/sprockets%2Fb8b36ba6104c8dbe6297b4e61e6d33b1 +0 -0
- data/spec/dummy/tmp/cache/assets/D67/BC0/sprockets%2F35d2c2b45981ade5a2db2a9c7f37a615 +0 -0
- data/spec/dummy/tmp/cache/assets/D69/F90/sprockets%2F6a0795b7b38bd7e6142cd1b88211dade +0 -0
- data/spec/dummy/tmp/cache/assets/D6A/950/sprockets%2F429b1806cb7580ebf29f9a12c33cbea6 +0 -0
- data/spec/dummy/tmp/cache/assets/D6C/9C0/sprockets%2Fd66bdf546164ba223e20f56b5591ddfd +0 -0
- data/spec/dummy/tmp/cache/assets/D6D/530/sprockets%2F8d52dee91bff01a8a2306d8a7c9152a9 +0 -0
- data/spec/dummy/tmp/cache/assets/D6D/DA0/sprockets%2Fac936bf40b42227a2bf9d474ae9ec149 +0 -0
- data/spec/dummy/tmp/cache/assets/D6F/310/sprockets%2F624b651d37f7ec0c563c446fbf8afb32 +0 -0
- data/spec/dummy/tmp/cache/assets/D71/A70/sprockets%2F4f10f5dd56c8a3ff78c460bbe3723a39 +0 -0
- data/spec/dummy/tmp/cache/assets/D72/C10/sprockets%2Ffbdb5250837c5cb856f464eb2cb3388b +0 -0
- data/spec/dummy/tmp/cache/assets/D73/5D0/sprockets%2F5c8608f3e25d077fa3df8cd32b50c37f +0 -0
- data/spec/dummy/tmp/cache/assets/D73/C00/sprockets%2F9cf4bfb486e4ab461e3f275a3d974c30 +0 -0
- data/spec/dummy/tmp/cache/assets/D77/B30/sprockets%2F946cf2f17c7eb41037f9ee08ad67ec40 +0 -0
- data/spec/dummy/tmp/cache/assets/D78/2F0/sprockets%2F3c61f8915b8f717b1de788e6ecad122c +0 -0
- data/spec/dummy/tmp/cache/assets/D78/870/sprockets%2F8f3a7d4fcd104fa8e47f552f6630a49e +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/C10/sprockets%2F747c98c3cc7494a62dd882752adffb2b +0 -0
- data/spec/dummy/tmp/cache/assets/D7F/6C0/sprockets%2F77fe714bfff7e409a9d838cdf126700c +0 -0
- data/spec/dummy/tmp/cache/assets/D84/560/sprockets%2Ff09b671d3f5f8a48d7fa28e2c59ca389 +0 -0
- data/spec/dummy/tmp/cache/assets/D85/5D0/sprockets%2Fde362e334a475cfca1a30fa5b713b43a +0 -0
- data/spec/dummy/tmp/cache/assets/D8C/520/sprockets%2F221cd58a042baac534d27e4cfedc1188 +0 -0
- data/spec/dummy/tmp/cache/assets/D92/C00/sprockets%2F63c8bb5e2b2d9db4a2ed16f056a234c6 +0 -0
- data/spec/dummy/tmp/cache/assets/D97/520/sprockets%2Fea2442ae4caddb758dfb1964c601b476 +0 -0
- data/spec/dummy/tmp/cache/assets/D9C/510/sprockets%2Fab9bab3574dac2d1681189debb7d8255 +0 -0
- data/spec/dummy/tmp/cache/assets/D9D/440/sprockets%2F869f9acc13b88cf15a31d24a0ac3f6f6 +0 -0
- data/spec/dummy/tmp/cache/assets/D9E/CB0/sprockets%2Ff0efe0ab6bd753a8bb4481e46243d77f +0 -0
- data/spec/dummy/tmp/cache/assets/DA0/330/sprockets%2Fcbbb4de706387d50f48a72ee6c9c1b80 +0 -0
- data/spec/dummy/tmp/cache/assets/DA5/0A0/sprockets%2F7a4b5928cec69ab65afff309a04d6b47 +0 -0
- data/spec/dummy/tmp/cache/assets/DA6/D80/sprockets%2F8702dce2e6b9879a6add309e92ace2f0 +0 -0
- data/spec/dummy/tmp/cache/assets/DA8/C50/sprockets%2F0810627fddce930a399fc60d3be97fed +0 -0
- data/spec/dummy/tmp/cache/assets/DAA/1E0/sprockets%2F412dd3bd3026759a3f6ffe8cf9e7b93a +0 -0
- data/spec/dummy/tmp/cache/assets/DAA/2B0/sprockets%2Fe0c5d93fa08d139e198bfe47cd42b99a +0 -0
- data/spec/dummy/tmp/cache/assets/DAE/4E0/sprockets%2F88cc3ab99c608879dd56164dbcc2ccb7 +0 -0
- data/spec/dummy/tmp/cache/assets/DAE/6C0/sprockets%2F77c7a8676aeefa73156c55dfcf51cc46 +0 -0
- data/spec/dummy/tmp/cache/assets/DAF/5B0/sprockets%2F780e81d97e4eefcce73e0b82a5b1859d +0 -0
- data/spec/dummy/tmp/cache/assets/DB3/5D0/sprockets%2Fce1d4d75832c9bdeafd869f6f7b61725 +0 -0
- data/spec/dummy/tmp/cache/assets/DB5/040/sprockets%2F9a9da5df88713663b9fbc945facca891 +0 -0
- data/spec/dummy/tmp/cache/assets/DB5/860/sprockets%2Facf25fab3016425a0e03c9d190fd4eac +0 -0
- data/spec/dummy/tmp/cache/assets/DB9/220/sprockets%2Fd2dc4f59e70e73984997ffca8ad7f4a0 +0 -0
- data/spec/dummy/tmp/cache/assets/DC3/230/sprockets%2Fdf52e72eb73be91eccc60182191aed0b +0 -0
- data/spec/dummy/tmp/cache/assets/DC3/AC0/sprockets%2Fe29911eb34fdf4b710dd0d2c2cf24bc9 +0 -0
- data/spec/dummy/tmp/cache/assets/DC4/860/sprockets%2Fa01a3cf460ff15daae0f928d0f85f52e +0 -0
- data/spec/dummy/tmp/cache/assets/DC7/A10/sprockets%2F84a8af0fcbf401864e1ae5bf092cba94 +0 -0
- data/spec/dummy/tmp/cache/assets/DCB/620/sprockets%2F27a68cf9fe11fb1b6326d11eba7e76cb +0 -0
- data/spec/dummy/tmp/cache/assets/DCD/EB0/sprockets%2F4f77f509126ecbced7ea2a5ab290c8d4 +0 -0
- data/spec/dummy/tmp/cache/assets/DE3/6C0/sprockets%2F51c550cc1b3b021aa9aede66a5a36aff +0 -0
- data/spec/dummy/tmp/cache/assets/DE4/140/sprockets%2F139e4ab85d1aacb22c115fa136afdc8a +0 -0
- data/spec/dummy/tmp/cache/assets/DEB/110/sprockets%2F2dbdab0ce5babca645cdb5780004f875 +0 -0
- data/spec/dummy/tmp/cache/assets/DF1/1B0/sprockets%2F2b1bc202f9a338942edbccb2cfef0d67 +0 -0
- data/spec/dummy/tmp/cache/assets/DF6/0E0/sprockets%2F85b10db6e1afe643aba6d396abdd77f0 +0 -0
- data/spec/dummy/tmp/cache/assets/DF7/E10/sprockets%2F25e4253aba9a9adcefb72552fb1ff0c8 +0 -0
- data/spec/dummy/tmp/cache/assets/DF9/AD0/sprockets%2Fc700afd7cee3fe9d7ff8352b213b2c4a +0 -0
- data/spec/dummy/tmp/cache/assets/DFC/C20/sprockets%2Fd9178ad7e3b401c9fceafd64ea2b50d6 +0 -0
- data/spec/dummy/tmp/cache/assets/DFC/C30/sprockets%2Fb50a07cb30b0bd0eec8e98e5de79d65d +0 -0
- data/spec/dummy/tmp/cache/assets/E02/6E0/sprockets%2F63d6a5cdb8cefa64ef76b5c6e0fd3720 +0 -0
- data/spec/dummy/tmp/cache/assets/E08/5A0/sprockets%2Fe7148db8eea925c3c9f1ee340d53ceff +0 -0
- data/spec/dummy/tmp/cache/assets/E08/BB0/sprockets%2Fefac99af1af28543aef6fb607faa4973 +0 -0
- data/spec/dummy/tmp/cache/assets/E08/F20/sprockets%2F4fc5cdcd6974efe7adfe809b30bd6513 +0 -0
- data/spec/dummy/tmp/cache/assets/E16/D30/sprockets%2Fd69469e6e7439baacd8df989c0fdacc2 +0 -0
- data/spec/dummy/tmp/cache/assets/E17/EF0/sprockets%2Fa291ad64a26afd055dfadabbdf03f154 +0 -0
- data/spec/dummy/tmp/cache/assets/E41/250/sprockets%2F97cf8fe3d7ffaff076f655aefb36da03 +0 -0
- data/spec/dummy/tmp/cache/assets/E6E/260/sprockets%2Fd9f8ab8b91ef582cc6c99a3ba0dedfe6 +0 -0
- data/spec/dummy/tmp/cache/assets/F79/360/sprockets%2F0ce035fefee5ebdabc8efabfbdbd6ee4 +0 -0
- data/spec/javascripts/teabag/base/reporters/console_spec.coffee +69 -42
- data/spec/javascripts/teabag/base/reporters/html/base_view_spec.coffee +88 -0
- data/spec/javascripts/teabag/base/reporters/html_spec.coffee +218 -218
- data/spec/javascripts/teabag/base/runner_spec.coffee +22 -0
- data/spec/javascripts/teabag/base/teabag_spec.coffee +1 -1
- data/spec/javascripts/teabag/jasmine/models_jspec.coffee +101 -0
- data/spec/javascripts/teabag/jasmine/runner_jspec.coffee +1 -1
- data/spec/javascripts/teabag/mocha/models_mspec.coffee +95 -0
- data/spec/javascripts/teabag/mocha/reporters/console_mspec.coffee +4 -0
- data/spec/javascripts/teabag/mocha/runner_mspec.coffee +7 -7
- data/spec/javascripts/teabag/phantomjs/runner_spec.coffee +5 -5
- data/spec/teabag/configuration_spec.rb +2 -2
- data/spec/teabag/console_spec.rb +5 -17
- data/spec/teabag/drivers/phantomjs_driver_spec.rb +29 -0
- data/spec/teabag/drivers/selenium_driver_spec.rb +60 -0
- data/spec/teabag/formatters/{progress_formatter_spec.rb → dot_formatter_spec.rb} +14 -14
- data/spec/teabag/formatters/tap_y_formatter_spec.rb +190 -0
- data/spec/teabag/result_spec.rb +12 -42
- data/spec/teabag/runner_spec.rb +12 -6
- data/vendor/assets/javascripts/qunit-1.10.0.MIT.LICENSE +1 -0
- data/vendor/assets/javascripts/qunit-1.10.0.js +1977 -0
- metadata +161 -11
- data/app/assets/javascripts/teabag/base/reporters.coffee +0 -105
- data/spec/javascripts/teabag/base/reporters_spec.coffee +0 -267
@@ -0,0 +1,3023 @@
|
|
1
|
+
/**
|
2
|
+
* QUnit v1.10.0 - A JavaScript Unit Testing Framework
|
3
|
+
*
|
4
|
+
* http://qunitjs.com
|
5
|
+
*
|
6
|
+
* Copyright 2012 jQuery Foundation and other contributors
|
7
|
+
* Released under the MIT license.
|
8
|
+
* http://jquery.org/license
|
9
|
+
*/
|
10
|
+
|
11
|
+
|
12
|
+
(function( window ) {
|
13
|
+
|
14
|
+
var QUnit,
|
15
|
+
config,
|
16
|
+
onErrorFnPrev,
|
17
|
+
testId = 0,
|
18
|
+
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
|
19
|
+
toString = Object.prototype.toString,
|
20
|
+
hasOwn = Object.prototype.hasOwnProperty,
|
21
|
+
// Keep a local reference to Date (GH-283)
|
22
|
+
Date = window.Date,
|
23
|
+
defined = {
|
24
|
+
setTimeout: typeof window.setTimeout !== "undefined",
|
25
|
+
sessionStorage: (function() {
|
26
|
+
var x = "qunit-test-string";
|
27
|
+
try {
|
28
|
+
sessionStorage.setItem( x, x );
|
29
|
+
sessionStorage.removeItem( x );
|
30
|
+
return true;
|
31
|
+
} catch( e ) {
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
}())
|
35
|
+
};
|
36
|
+
|
37
|
+
function Test( settings ) {
|
38
|
+
extend( this, settings );
|
39
|
+
this.assertions = [];
|
40
|
+
this.testNumber = ++Test.count;
|
41
|
+
}
|
42
|
+
|
43
|
+
Test.count = 0;
|
44
|
+
|
45
|
+
Test.prototype = {
|
46
|
+
init: function() {
|
47
|
+
var a, b, li,
|
48
|
+
tests = id( "qunit-tests" );
|
49
|
+
|
50
|
+
if ( tests ) {
|
51
|
+
b = document.createElement( "strong" );
|
52
|
+
b.innerHTML = this.name;
|
53
|
+
|
54
|
+
// `a` initialized at top of scope
|
55
|
+
a = document.createElement( "a" );
|
56
|
+
a.innerHTML = "Rerun";
|
57
|
+
a.href = QUnit.url({ testNumber: this.testNumber });
|
58
|
+
|
59
|
+
li = document.createElement( "li" );
|
60
|
+
li.appendChild( b );
|
61
|
+
li.appendChild( a );
|
62
|
+
li.className = "running";
|
63
|
+
li.id = this.id = "qunit-test-output" + testId++;
|
64
|
+
|
65
|
+
tests.appendChild( li );
|
66
|
+
}
|
67
|
+
},
|
68
|
+
setup: function() {
|
69
|
+
if ( this.module !== config.previousModule ) {
|
70
|
+
if ( config.previousModule ) {
|
71
|
+
runLoggingCallbacks( "moduleDone", QUnit, {
|
72
|
+
name: config.previousModule,
|
73
|
+
failed: config.moduleStats.bad,
|
74
|
+
passed: config.moduleStats.all - config.moduleStats.bad,
|
75
|
+
total: config.moduleStats.all
|
76
|
+
});
|
77
|
+
}
|
78
|
+
config.previousModule = this.module;
|
79
|
+
config.moduleStats = { all: 0, bad: 0 };
|
80
|
+
runLoggingCallbacks( "moduleStart", QUnit, {
|
81
|
+
name: this.module
|
82
|
+
});
|
83
|
+
} else if ( config.autorun ) {
|
84
|
+
runLoggingCallbacks( "moduleStart", QUnit, {
|
85
|
+
name: this.module
|
86
|
+
});
|
87
|
+
}
|
88
|
+
|
89
|
+
config.current = this;
|
90
|
+
|
91
|
+
this.testEnvironment = extend({
|
92
|
+
setup: function() {},
|
93
|
+
teardown: function() {}
|
94
|
+
}, this.moduleTestEnvironment );
|
95
|
+
|
96
|
+
runLoggingCallbacks( "testStart", QUnit, {
|
97
|
+
name: this.testName,
|
98
|
+
module: this.module
|
99
|
+
});
|
100
|
+
|
101
|
+
// allow utility functions to access the current test environment
|
102
|
+
// TODO why??
|
103
|
+
QUnit.current_testEnvironment = this.testEnvironment;
|
104
|
+
|
105
|
+
if ( !config.pollution ) {
|
106
|
+
saveGlobal();
|
107
|
+
}
|
108
|
+
if ( config.notrycatch ) {
|
109
|
+
this.testEnvironment.setup.call( this.testEnvironment );
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
try {
|
113
|
+
this.testEnvironment.setup.call( this.testEnvironment );
|
114
|
+
} catch( e ) {
|
115
|
+
QUnit.pushFailure( "Setup failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) );
|
116
|
+
}
|
117
|
+
},
|
118
|
+
run: function() {
|
119
|
+
config.current = this;
|
120
|
+
|
121
|
+
var running = id( "qunit-testresult" );
|
122
|
+
|
123
|
+
if ( running ) {
|
124
|
+
running.innerHTML = "Running: <br/>" + this.name;
|
125
|
+
}
|
126
|
+
|
127
|
+
if ( this.async ) {
|
128
|
+
QUnit.stop();
|
129
|
+
}
|
130
|
+
|
131
|
+
if ( config.notrycatch ) {
|
132
|
+
this.callback.call( this.testEnvironment, QUnit.assert );
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
|
136
|
+
try {
|
137
|
+
this.callback.call( this.testEnvironment, QUnit.assert );
|
138
|
+
} catch( e ) {
|
139
|
+
QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + e.message, extractStacktrace( e, 0 ) );
|
140
|
+
// else next test will carry the responsibility
|
141
|
+
saveGlobal();
|
142
|
+
|
143
|
+
// Restart the tests if they're blocking
|
144
|
+
if ( config.blocking ) {
|
145
|
+
QUnit.start();
|
146
|
+
}
|
147
|
+
}
|
148
|
+
},
|
149
|
+
teardown: function() {
|
150
|
+
config.current = this;
|
151
|
+
if ( config.notrycatch ) {
|
152
|
+
this.testEnvironment.teardown.call( this.testEnvironment );
|
153
|
+
return;
|
154
|
+
} else {
|
155
|
+
try {
|
156
|
+
this.testEnvironment.teardown.call( this.testEnvironment );
|
157
|
+
} catch( e ) {
|
158
|
+
QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) );
|
159
|
+
}
|
160
|
+
}
|
161
|
+
checkPollution();
|
162
|
+
},
|
163
|
+
finish: function() {
|
164
|
+
config.current = this;
|
165
|
+
if ( config.requireExpects && this.expected == null ) {
|
166
|
+
QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
|
167
|
+
} else if ( this.expected != null && this.expected != this.assertions.length ) {
|
168
|
+
QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );
|
169
|
+
} else if ( this.expected == null && !this.assertions.length ) {
|
170
|
+
QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack );
|
171
|
+
}
|
172
|
+
|
173
|
+
var assertion, a, b, i, li, ol,
|
174
|
+
test = this,
|
175
|
+
good = 0,
|
176
|
+
bad = 0,
|
177
|
+
tests = id( "qunit-tests" );
|
178
|
+
|
179
|
+
config.stats.all += this.assertions.length;
|
180
|
+
config.moduleStats.all += this.assertions.length;
|
181
|
+
|
182
|
+
if ( tests ) {
|
183
|
+
ol = document.createElement( "ol" );
|
184
|
+
|
185
|
+
for ( i = 0; i < this.assertions.length; i++ ) {
|
186
|
+
assertion = this.assertions[i];
|
187
|
+
|
188
|
+
li = document.createElement( "li" );
|
189
|
+
li.className = assertion.result ? "pass" : "fail";
|
190
|
+
li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" );
|
191
|
+
ol.appendChild( li );
|
192
|
+
|
193
|
+
if ( assertion.result ) {
|
194
|
+
good++;
|
195
|
+
} else {
|
196
|
+
bad++;
|
197
|
+
config.stats.bad++;
|
198
|
+
config.moduleStats.bad++;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
// store result when possible
|
203
|
+
if ( QUnit.config.reorder && defined.sessionStorage ) {
|
204
|
+
if ( bad ) {
|
205
|
+
sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad );
|
206
|
+
} else {
|
207
|
+
sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName );
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
if ( bad === 0 ) {
|
212
|
+
ol.style.display = "none";
|
213
|
+
}
|
214
|
+
|
215
|
+
// `b` initialized at top of scope
|
216
|
+
b = document.createElement( "strong" );
|
217
|
+
b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
|
218
|
+
|
219
|
+
addEvent(b, "click", function() {
|
220
|
+
var next = b.nextSibling.nextSibling,
|
221
|
+
display = next.style.display;
|
222
|
+
next.style.display = display === "none" ? "block" : "none";
|
223
|
+
});
|
224
|
+
|
225
|
+
addEvent(b, "dblclick", function( e ) {
|
226
|
+
var target = e && e.target ? e.target : window.event.srcElement;
|
227
|
+
if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
|
228
|
+
target = target.parentNode;
|
229
|
+
}
|
230
|
+
if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
|
231
|
+
window.location = QUnit.url({ testNumber: test.testNumber });
|
232
|
+
}
|
233
|
+
});
|
234
|
+
|
235
|
+
// `li` initialized at top of scope
|
236
|
+
li = id( this.id );
|
237
|
+
li.className = bad ? "fail" : "pass";
|
238
|
+
li.removeChild( li.firstChild );
|
239
|
+
a = li.firstChild;
|
240
|
+
li.appendChild( b );
|
241
|
+
li.appendChild ( a );
|
242
|
+
li.appendChild( ol );
|
243
|
+
|
244
|
+
} else {
|
245
|
+
for ( i = 0; i < this.assertions.length; i++ ) {
|
246
|
+
if ( !this.assertions[i].result ) {
|
247
|
+
bad++;
|
248
|
+
config.stats.bad++;
|
249
|
+
config.moduleStats.bad++;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
runLoggingCallbacks( "testDone", QUnit, {
|
255
|
+
name: this.testName,
|
256
|
+
module: this.module,
|
257
|
+
failed: bad,
|
258
|
+
passed: this.assertions.length - bad,
|
259
|
+
total: this.assertions.length
|
260
|
+
});
|
261
|
+
|
262
|
+
QUnit.reset();
|
263
|
+
|
264
|
+
config.current = undefined;
|
265
|
+
},
|
266
|
+
|
267
|
+
queue: function() {
|
268
|
+
var bad,
|
269
|
+
test = this;
|
270
|
+
|
271
|
+
synchronize(function() {
|
272
|
+
test.init();
|
273
|
+
});
|
274
|
+
function run() {
|
275
|
+
// each of these can by async
|
276
|
+
synchronize(function() {
|
277
|
+
test.setup();
|
278
|
+
});
|
279
|
+
synchronize(function() {
|
280
|
+
test.run();
|
281
|
+
});
|
282
|
+
synchronize(function() {
|
283
|
+
test.teardown();
|
284
|
+
});
|
285
|
+
synchronize(function() {
|
286
|
+
test.finish();
|
287
|
+
});
|
288
|
+
}
|
289
|
+
|
290
|
+
// `bad` initialized at top of scope
|
291
|
+
// defer when previous test run passed, if storage is available
|
292
|
+
bad = QUnit.config.reorder && defined.sessionStorage &&
|
293
|
+
+sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName );
|
294
|
+
|
295
|
+
if ( bad ) {
|
296
|
+
run();
|
297
|
+
} else {
|
298
|
+
synchronize( run, true );
|
299
|
+
}
|
300
|
+
}
|
301
|
+
};
|
302
|
+
|
303
|
+
// Root QUnit object.
|
304
|
+
// `QUnit` initialized at top of scope
|
305
|
+
QUnit = {
|
306
|
+
|
307
|
+
// call on start of module test to prepend name to all tests
|
308
|
+
module: function( name, testEnvironment ) {
|
309
|
+
config.currentModule = name;
|
310
|
+
config.currentModuleTestEnvironment = testEnvironment;
|
311
|
+
config.modules[name] = true;
|
312
|
+
},
|
313
|
+
|
314
|
+
asyncTest: function( testName, expected, callback ) {
|
315
|
+
if ( arguments.length === 2 ) {
|
316
|
+
callback = expected;
|
317
|
+
expected = null;
|
318
|
+
}
|
319
|
+
|
320
|
+
QUnit.test( testName, expected, callback, true );
|
321
|
+
},
|
322
|
+
|
323
|
+
test: function( testName, expected, callback, async ) {
|
324
|
+
var test,
|
325
|
+
name = "<span class='test-name'>" + escapeInnerText( testName ) + "</span>";
|
326
|
+
|
327
|
+
if ( arguments.length === 2 ) {
|
328
|
+
callback = expected;
|
329
|
+
expected = null;
|
330
|
+
}
|
331
|
+
|
332
|
+
if ( config.currentModule ) {
|
333
|
+
name = "<span class='module-name'>" + config.currentModule + "</span>: " + name;
|
334
|
+
}
|
335
|
+
|
336
|
+
test = new Test({
|
337
|
+
name: name,
|
338
|
+
testName: testName,
|
339
|
+
expected: expected,
|
340
|
+
async: async,
|
341
|
+
callback: callback,
|
342
|
+
module: config.currentModule,
|
343
|
+
moduleTestEnvironment: config.currentModuleTestEnvironment,
|
344
|
+
stack: sourceFromStacktrace( 2 )
|
345
|
+
});
|
346
|
+
|
347
|
+
if ( !validTest( test ) ) {
|
348
|
+
return;
|
349
|
+
}
|
350
|
+
|
351
|
+
test.queue();
|
352
|
+
},
|
353
|
+
|
354
|
+
// Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
|
355
|
+
expect: function( asserts ) {
|
356
|
+
if (arguments.length === 1) {
|
357
|
+
config.current.expected = asserts;
|
358
|
+
} else {
|
359
|
+
return config.current.expected;
|
360
|
+
}
|
361
|
+
},
|
362
|
+
|
363
|
+
start: function( count ) {
|
364
|
+
config.semaphore -= count || 1;
|
365
|
+
// don't start until equal number of stop-calls
|
366
|
+
if ( config.semaphore > 0 ) {
|
367
|
+
return;
|
368
|
+
}
|
369
|
+
// ignore if start is called more often then stop
|
370
|
+
if ( config.semaphore < 0 ) {
|
371
|
+
config.semaphore = 0;
|
372
|
+
}
|
373
|
+
// A slight delay, to avoid any current callbacks
|
374
|
+
if ( defined.setTimeout ) {
|
375
|
+
window.setTimeout(function() {
|
376
|
+
if ( config.semaphore > 0 ) {
|
377
|
+
return;
|
378
|
+
}
|
379
|
+
if ( config.timeout ) {
|
380
|
+
clearTimeout( config.timeout );
|
381
|
+
}
|
382
|
+
|
383
|
+
config.blocking = false;
|
384
|
+
process( true );
|
385
|
+
}, 13);
|
386
|
+
} else {
|
387
|
+
config.blocking = false;
|
388
|
+
process( true );
|
389
|
+
}
|
390
|
+
},
|
391
|
+
|
392
|
+
stop: function( count ) {
|
393
|
+
config.semaphore += count || 1;
|
394
|
+
config.blocking = true;
|
395
|
+
|
396
|
+
if ( config.testTimeout && defined.setTimeout ) {
|
397
|
+
clearTimeout( config.timeout );
|
398
|
+
config.timeout = window.setTimeout(function() {
|
399
|
+
QUnit.ok( false, "Test timed out" );
|
400
|
+
config.semaphore = 1;
|
401
|
+
QUnit.start();
|
402
|
+
}, config.testTimeout );
|
403
|
+
}
|
404
|
+
}
|
405
|
+
};
|
406
|
+
|
407
|
+
// Asssert helpers
|
408
|
+
// All of these must call either QUnit.push() or manually do:
|
409
|
+
// - runLoggingCallbacks( "log", .. );
|
410
|
+
// - config.current.assertions.push({ .. });
|
411
|
+
QUnit.assert = {
|
412
|
+
/**
|
413
|
+
* Asserts rough true-ish result.
|
414
|
+
* @name ok
|
415
|
+
* @function
|
416
|
+
* @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
|
417
|
+
*/
|
418
|
+
ok: function( result, msg ) {
|
419
|
+
if ( !config.current ) {
|
420
|
+
throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
|
421
|
+
}
|
422
|
+
result = !!result;
|
423
|
+
|
424
|
+
var source,
|
425
|
+
details = {
|
426
|
+
module: config.current.module,
|
427
|
+
name: config.current.testName,
|
428
|
+
result: result,
|
429
|
+
message: msg
|
430
|
+
};
|
431
|
+
|
432
|
+
msg = escapeInnerText( msg || (result ? "okay" : "failed" ) );
|
433
|
+
msg = "<span class='test-message'>" + msg + "</span>";
|
434
|
+
|
435
|
+
if ( !result ) {
|
436
|
+
source = sourceFromStacktrace( 2 );
|
437
|
+
if ( source ) {
|
438
|
+
details.source = source;
|
439
|
+
msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr></table>";
|
440
|
+
}
|
441
|
+
}
|
442
|
+
runLoggingCallbacks( "log", QUnit, details );
|
443
|
+
config.current.assertions.push({
|
444
|
+
result: result,
|
445
|
+
message: msg
|
446
|
+
});
|
447
|
+
},
|
448
|
+
|
449
|
+
/**
|
450
|
+
* Assert that the first two arguments are equal, with an optional message.
|
451
|
+
* Prints out both actual and expected values.
|
452
|
+
* @name equal
|
453
|
+
* @function
|
454
|
+
* @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
|
455
|
+
*/
|
456
|
+
equal: function( actual, expected, message ) {
|
457
|
+
QUnit.push( expected == actual, actual, expected, message );
|
458
|
+
},
|
459
|
+
|
460
|
+
/**
|
461
|
+
* @name notEqual
|
462
|
+
* @function
|
463
|
+
*/
|
464
|
+
notEqual: function( actual, expected, message ) {
|
465
|
+
QUnit.push( expected != actual, actual, expected, message );
|
466
|
+
},
|
467
|
+
|
468
|
+
/**
|
469
|
+
* @name deepEqual
|
470
|
+
* @function
|
471
|
+
*/
|
472
|
+
deepEqual: function( actual, expected, message ) {
|
473
|
+
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
|
474
|
+
},
|
475
|
+
|
476
|
+
/**
|
477
|
+
* @name notDeepEqual
|
478
|
+
* @function
|
479
|
+
*/
|
480
|
+
notDeepEqual: function( actual, expected, message ) {
|
481
|
+
QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
|
482
|
+
},
|
483
|
+
|
484
|
+
/**
|
485
|
+
* @name strictEqual
|
486
|
+
* @function
|
487
|
+
*/
|
488
|
+
strictEqual: function( actual, expected, message ) {
|
489
|
+
QUnit.push( expected === actual, actual, expected, message );
|
490
|
+
},
|
491
|
+
|
492
|
+
/**
|
493
|
+
* @name notStrictEqual
|
494
|
+
* @function
|
495
|
+
*/
|
496
|
+
notStrictEqual: function( actual, expected, message ) {
|
497
|
+
QUnit.push( expected !== actual, actual, expected, message );
|
498
|
+
},
|
499
|
+
|
500
|
+
throws: function( block, expected, message ) {
|
501
|
+
var actual,
|
502
|
+
ok = false;
|
503
|
+
|
504
|
+
// 'expected' is optional
|
505
|
+
if ( typeof expected === "string" ) {
|
506
|
+
message = expected;
|
507
|
+
expected = null;
|
508
|
+
}
|
509
|
+
|
510
|
+
config.current.ignoreGlobalErrors = true;
|
511
|
+
try {
|
512
|
+
block.call( config.current.testEnvironment );
|
513
|
+
} catch (e) {
|
514
|
+
actual = e;
|
515
|
+
}
|
516
|
+
config.current.ignoreGlobalErrors = false;
|
517
|
+
|
518
|
+
if ( actual ) {
|
519
|
+
// we don't want to validate thrown error
|
520
|
+
if ( !expected ) {
|
521
|
+
ok = true;
|
522
|
+
// expected is a regexp
|
523
|
+
} else if ( QUnit.objectType( expected ) === "regexp" ) {
|
524
|
+
ok = expected.test( actual );
|
525
|
+
// expected is a constructor
|
526
|
+
} else if ( actual instanceof expected ) {
|
527
|
+
ok = true;
|
528
|
+
// expected is a validation function which returns true is validation passed
|
529
|
+
} else if ( expected.call( {}, actual ) === true ) {
|
530
|
+
ok = true;
|
531
|
+
}
|
532
|
+
|
533
|
+
QUnit.push( ok, actual, null, message );
|
534
|
+
} else {
|
535
|
+
QUnit.pushFailure( message, null, 'No exception was thrown.' );
|
536
|
+
}
|
537
|
+
}
|
538
|
+
};
|
539
|
+
|
540
|
+
/**
|
541
|
+
* @deprecate since 1.8.0
|
542
|
+
* Kept assertion helpers in root for backwards compatibility
|
543
|
+
*/
|
544
|
+
extend( QUnit, QUnit.assert );
|
545
|
+
|
546
|
+
/**
|
547
|
+
* @deprecated since 1.9.0
|
548
|
+
* Kept global "raises()" for backwards compatibility
|
549
|
+
*/
|
550
|
+
QUnit.raises = QUnit.assert.throws;
|
551
|
+
|
552
|
+
/**
|
553
|
+
* @deprecated since 1.0.0, replaced with error pushes since 1.3.0
|
554
|
+
* Kept to avoid TypeErrors for undefined methods.
|
555
|
+
*/
|
556
|
+
QUnit.equals = function() {
|
557
|
+
QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
|
558
|
+
};
|
559
|
+
QUnit.same = function() {
|
560
|
+
QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
|
561
|
+
};
|
562
|
+
|
563
|
+
// We want access to the constructor's prototype
|
564
|
+
(function() {
|
565
|
+
function F() {}
|
566
|
+
F.prototype = QUnit;
|
567
|
+
QUnit = new F();
|
568
|
+
// Make F QUnit's constructor so that we can add to the prototype later
|
569
|
+
QUnit.constructor = F;
|
570
|
+
}());
|
571
|
+
|
572
|
+
/**
|
573
|
+
* Config object: Maintain internal state
|
574
|
+
* Later exposed as QUnit.config
|
575
|
+
* `config` initialized at top of scope
|
576
|
+
*/
|
577
|
+
config = {
|
578
|
+
// The queue of tests to run
|
579
|
+
queue: [],
|
580
|
+
|
581
|
+
// block until document ready
|
582
|
+
blocking: true,
|
583
|
+
|
584
|
+
// when enabled, show only failing tests
|
585
|
+
// gets persisted through sessionStorage and can be changed in UI via checkbox
|
586
|
+
hidepassed: false,
|
587
|
+
|
588
|
+
// by default, run previously failed tests first
|
589
|
+
// very useful in combination with "Hide passed tests" checked
|
590
|
+
reorder: true,
|
591
|
+
|
592
|
+
// by default, modify document.title when suite is done
|
593
|
+
altertitle: true,
|
594
|
+
|
595
|
+
// when enabled, all tests must call expect()
|
596
|
+
requireExpects: false,
|
597
|
+
|
598
|
+
// add checkboxes that are persisted in the query-string
|
599
|
+
// when enabled, the id is set to `true` as a `QUnit.config` property
|
600
|
+
urlConfig: [
|
601
|
+
{
|
602
|
+
id: "noglobals",
|
603
|
+
label: "Check for Globals",
|
604
|
+
tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
|
605
|
+
},
|
606
|
+
{
|
607
|
+
id: "notrycatch",
|
608
|
+
label: "No try-catch",
|
609
|
+
tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
|
610
|
+
}
|
611
|
+
],
|
612
|
+
|
613
|
+
// Set of all modules.
|
614
|
+
modules: {},
|
615
|
+
|
616
|
+
// logging callback queues
|
617
|
+
begin: [],
|
618
|
+
done: [],
|
619
|
+
log: [],
|
620
|
+
testStart: [],
|
621
|
+
testDone: [],
|
622
|
+
moduleStart: [],
|
623
|
+
moduleDone: []
|
624
|
+
};
|
625
|
+
|
626
|
+
// Initialize more QUnit.config and QUnit.urlParams
|
627
|
+
(function() {
|
628
|
+
var i,
|
629
|
+
location = window.location || { search: "", protocol: "file:" },
|
630
|
+
params = location.search.slice( 1 ).split( "&" ),
|
631
|
+
length = params.length,
|
632
|
+
urlParams = {},
|
633
|
+
current;
|
634
|
+
|
635
|
+
if ( params[ 0 ] ) {
|
636
|
+
for ( i = 0; i < length; i++ ) {
|
637
|
+
current = params[ i ].split( "=" );
|
638
|
+
current[ 0 ] = decodeURIComponent( current[ 0 ] );
|
639
|
+
// allow just a key to turn on a flag, e.g., test.html?noglobals
|
640
|
+
current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
|
641
|
+
urlParams[ current[ 0 ] ] = current[ 1 ];
|
642
|
+
}
|
643
|
+
}
|
644
|
+
|
645
|
+
QUnit.urlParams = urlParams;
|
646
|
+
|
647
|
+
// String search anywhere in moduleName+testName
|
648
|
+
config.filter = urlParams.filter;
|
649
|
+
|
650
|
+
// Exact match of the module name
|
651
|
+
config.module = urlParams.module;
|
652
|
+
|
653
|
+
config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;
|
654
|
+
|
655
|
+
// Figure out if we're running the tests from a server or not
|
656
|
+
QUnit.isLocal = location.protocol === "file:";
|
657
|
+
}());
|
658
|
+
|
659
|
+
// Export global variables, unless an 'exports' object exists,
|
660
|
+
// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
|
661
|
+
if ( typeof exports === "undefined" ) {
|
662
|
+
extend( window, QUnit );
|
663
|
+
|
664
|
+
// Expose QUnit object
|
665
|
+
window.QUnit = QUnit;
|
666
|
+
}
|
667
|
+
|
668
|
+
// Extend QUnit object,
|
669
|
+
// these after set here because they should not be exposed as global functions
|
670
|
+
extend( QUnit, {
|
671
|
+
config: config,
|
672
|
+
|
673
|
+
// Initialize the configuration options
|
674
|
+
init: function() {
|
675
|
+
extend( config, {
|
676
|
+
stats: { all: 0, bad: 0 },
|
677
|
+
moduleStats: { all: 0, bad: 0 },
|
678
|
+
started: +new Date(),
|
679
|
+
updateRate: 1000,
|
680
|
+
blocking: false,
|
681
|
+
autostart: true,
|
682
|
+
autorun: false,
|
683
|
+
filter: "",
|
684
|
+
queue: [],
|
685
|
+
semaphore: 0
|
686
|
+
});
|
687
|
+
|
688
|
+
var tests, banner, result,
|
689
|
+
qunit = id( "qunit" );
|
690
|
+
|
691
|
+
if ( qunit ) {
|
692
|
+
qunit.innerHTML =
|
693
|
+
"<h1 id='qunit-header'>" + escapeInnerText( document.title ) + "</h1>" +
|
694
|
+
"<h2 id='qunit-banner'></h2>" +
|
695
|
+
"<div id='qunit-testrunner-toolbar'></div>" +
|
696
|
+
"<h2 id='qunit-userAgent'></h2>" +
|
697
|
+
"<ol id='qunit-tests'></ol>";
|
698
|
+
}
|
699
|
+
|
700
|
+
tests = id( "qunit-tests" );
|
701
|
+
banner = id( "qunit-banner" );
|
702
|
+
result = id( "qunit-testresult" );
|
703
|
+
|
704
|
+
if ( tests ) {
|
705
|
+
tests.innerHTML = "";
|
706
|
+
}
|
707
|
+
|
708
|
+
if ( banner ) {
|
709
|
+
banner.className = "";
|
710
|
+
}
|
711
|
+
|
712
|
+
if ( result ) {
|
713
|
+
result.parentNode.removeChild( result );
|
714
|
+
}
|
715
|
+
|
716
|
+
if ( tests ) {
|
717
|
+
result = document.createElement( "p" );
|
718
|
+
result.id = "qunit-testresult";
|
719
|
+
result.className = "result";
|
720
|
+
tests.parentNode.insertBefore( result, tests );
|
721
|
+
result.innerHTML = "Running...<br/> ";
|
722
|
+
}
|
723
|
+
},
|
724
|
+
|
725
|
+
// Resets the test setup. Useful for tests that modify the DOM.
|
726
|
+
reset: function() {
|
727
|
+
var fixture = id( "qunit-fixture" );
|
728
|
+
if ( fixture ) {
|
729
|
+
fixture.innerHTML = config.fixture;
|
730
|
+
}
|
731
|
+
},
|
732
|
+
|
733
|
+
// Trigger an event on an element.
|
734
|
+
// @example triggerEvent( document.body, "click" );
|
735
|
+
triggerEvent: function( elem, type, event ) {
|
736
|
+
if ( document.createEvent ) {
|
737
|
+
event = document.createEvent( "MouseEvents" );
|
738
|
+
event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
|
739
|
+
0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
740
|
+
|
741
|
+
elem.dispatchEvent( event );
|
742
|
+
} else if ( elem.fireEvent ) {
|
743
|
+
elem.fireEvent( "on" + type );
|
744
|
+
}
|
745
|
+
},
|
746
|
+
|
747
|
+
// Safe object type checking
|
748
|
+
is: function( type, obj ) {
|
749
|
+
return QUnit.objectType( obj ) == type;
|
750
|
+
},
|
751
|
+
|
752
|
+
objectType: function( obj ) {
|
753
|
+
if ( typeof obj === "undefined" ) {
|
754
|
+
return "undefined";
|
755
|
+
// consider: typeof null === object
|
756
|
+
}
|
757
|
+
if ( obj === null ) {
|
758
|
+
return "null";
|
759
|
+
}
|
760
|
+
|
761
|
+
var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || "";
|
762
|
+
|
763
|
+
switch ( type ) {
|
764
|
+
case "Number":
|
765
|
+
if ( isNaN(obj) ) {
|
766
|
+
return "nan";
|
767
|
+
}
|
768
|
+
return "number";
|
769
|
+
case "String":
|
770
|
+
case "Boolean":
|
771
|
+
case "Array":
|
772
|
+
case "Date":
|
773
|
+
case "RegExp":
|
774
|
+
case "Function":
|
775
|
+
return type.toLowerCase();
|
776
|
+
}
|
777
|
+
if ( typeof obj === "object" ) {
|
778
|
+
return "object";
|
779
|
+
}
|
780
|
+
return undefined;
|
781
|
+
},
|
782
|
+
|
783
|
+
push: function( result, actual, expected, message ) {
|
784
|
+
if ( !config.current ) {
|
785
|
+
throw new Error( "assertion outside test context, was " + sourceFromStacktrace() );
|
786
|
+
}
|
787
|
+
|
788
|
+
var output, source,
|
789
|
+
details = {
|
790
|
+
module: config.current.module,
|
791
|
+
name: config.current.testName,
|
792
|
+
result: result,
|
793
|
+
message: message,
|
794
|
+
actual: actual,
|
795
|
+
expected: expected
|
796
|
+
};
|
797
|
+
|
798
|
+
message = escapeInnerText( message ) || ( result ? "okay" : "failed" );
|
799
|
+
message = "<span class='test-message'>" + message + "</span>";
|
800
|
+
output = message;
|
801
|
+
|
802
|
+
if ( !result ) {
|
803
|
+
expected = escapeInnerText( QUnit.jsDump.parse(expected) );
|
804
|
+
actual = escapeInnerText( QUnit.jsDump.parse(actual) );
|
805
|
+
output += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + expected + "</pre></td></tr>";
|
806
|
+
|
807
|
+
if ( actual != expected ) {
|
808
|
+
output += "<tr class='test-actual'><th>Result: </th><td><pre>" + actual + "</pre></td></tr>";
|
809
|
+
output += "<tr class='test-diff'><th>Diff: </th><td><pre>" + QUnit.diff( expected, actual ) + "</pre></td></tr>";
|
810
|
+
}
|
811
|
+
|
812
|
+
source = sourceFromStacktrace();
|
813
|
+
|
814
|
+
if ( source ) {
|
815
|
+
details.source = source;
|
816
|
+
output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr>";
|
817
|
+
}
|
818
|
+
|
819
|
+
output += "</table>";
|
820
|
+
}
|
821
|
+
|
822
|
+
runLoggingCallbacks( "log", QUnit, details );
|
823
|
+
|
824
|
+
config.current.assertions.push({
|
825
|
+
result: !!result,
|
826
|
+
message: output
|
827
|
+
});
|
828
|
+
},
|
829
|
+
|
830
|
+
pushFailure: function( message, source, actual ) {
|
831
|
+
if ( !config.current ) {
|
832
|
+
throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
|
833
|
+
}
|
834
|
+
|
835
|
+
var output,
|
836
|
+
details = {
|
837
|
+
module: config.current.module,
|
838
|
+
name: config.current.testName,
|
839
|
+
result: false,
|
840
|
+
message: message
|
841
|
+
};
|
842
|
+
|
843
|
+
message = escapeInnerText( message ) || "error";
|
844
|
+
message = "<span class='test-message'>" + message + "</span>";
|
845
|
+
output = message;
|
846
|
+
|
847
|
+
output += "<table>";
|
848
|
+
|
849
|
+
if ( actual ) {
|
850
|
+
output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeInnerText( actual ) + "</pre></td></tr>";
|
851
|
+
}
|
852
|
+
|
853
|
+
if ( source ) {
|
854
|
+
details.source = source;
|
855
|
+
output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr>";
|
856
|
+
}
|
857
|
+
|
858
|
+
output += "</table>";
|
859
|
+
|
860
|
+
runLoggingCallbacks( "log", QUnit, details );
|
861
|
+
|
862
|
+
config.current.assertions.push({
|
863
|
+
result: false,
|
864
|
+
message: output
|
865
|
+
});
|
866
|
+
},
|
867
|
+
|
868
|
+
url: function( params ) {
|
869
|
+
params = extend( extend( {}, QUnit.urlParams ), params );
|
870
|
+
var key,
|
871
|
+
querystring = "?";
|
872
|
+
|
873
|
+
for ( key in params ) {
|
874
|
+
if ( !hasOwn.call( params, key ) ) {
|
875
|
+
continue;
|
876
|
+
}
|
877
|
+
querystring += encodeURIComponent( key ) + "=" +
|
878
|
+
encodeURIComponent( params[ key ] ) + "&";
|
879
|
+
}
|
880
|
+
return window.location.pathname + querystring.slice( 0, -1 );
|
881
|
+
},
|
882
|
+
|
883
|
+
extend: extend,
|
884
|
+
id: id,
|
885
|
+
addEvent: addEvent
|
886
|
+
// load, equiv, jsDump, diff: Attached later
|
887
|
+
});
|
888
|
+
|
889
|
+
/**
|
890
|
+
* @deprecated: Created for backwards compatibility with test runner that set the hook function
|
891
|
+
* into QUnit.{hook}, instead of invoking it and passing the hook function.
|
892
|
+
* QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
|
893
|
+
* Doing this allows us to tell if the following methods have been overwritten on the actual
|
894
|
+
* QUnit object.
|
895
|
+
*/
|
896
|
+
extend( QUnit.constructor.prototype, {
|
897
|
+
|
898
|
+
// Logging callbacks; all receive a single argument with the listed properties
|
899
|
+
// run test/logs.html for any related changes
|
900
|
+
begin: registerLoggingCallback( "begin" ),
|
901
|
+
|
902
|
+
// done: { failed, passed, total, runtime }
|
903
|
+
done: registerLoggingCallback( "done" ),
|
904
|
+
|
905
|
+
// log: { result, actual, expected, message }
|
906
|
+
log: registerLoggingCallback( "log" ),
|
907
|
+
|
908
|
+
// testStart: { name }
|
909
|
+
testStart: registerLoggingCallback( "testStart" ),
|
910
|
+
|
911
|
+
// testDone: { name, failed, passed, total }
|
912
|
+
testDone: registerLoggingCallback( "testDone" ),
|
913
|
+
|
914
|
+
// moduleStart: { name }
|
915
|
+
moduleStart: registerLoggingCallback( "moduleStart" ),
|
916
|
+
|
917
|
+
// moduleDone: { name, failed, passed, total }
|
918
|
+
moduleDone: registerLoggingCallback( "moduleDone" )
|
919
|
+
});
|
920
|
+
|
921
|
+
if ( typeof document === "undefined" || document.readyState === "complete" ) {
|
922
|
+
config.autorun = true;
|
923
|
+
}
|
924
|
+
|
925
|
+
QUnit.load = function() {
|
926
|
+
runLoggingCallbacks( "begin", QUnit, {} );
|
927
|
+
|
928
|
+
// Initialize the config, saving the execution queue
|
929
|
+
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes, moduleFilter,
|
930
|
+
numModules = 0,
|
931
|
+
moduleFilterHtml = "",
|
932
|
+
urlConfigHtml = "",
|
933
|
+
oldconfig = extend( {}, config );
|
934
|
+
|
935
|
+
QUnit.init();
|
936
|
+
extend(config, oldconfig);
|
937
|
+
|
938
|
+
config.blocking = false;
|
939
|
+
|
940
|
+
len = config.urlConfig.length;
|
941
|
+
|
942
|
+
for ( i = 0; i < len; i++ ) {
|
943
|
+
val = config.urlConfig[i];
|
944
|
+
if ( typeof val === "string" ) {
|
945
|
+
val = {
|
946
|
+
id: val,
|
947
|
+
label: val,
|
948
|
+
tooltip: "[no tooltip available]"
|
949
|
+
};
|
950
|
+
}
|
951
|
+
config[ val.id ] = QUnit.urlParams[ val.id ];
|
952
|
+
urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>";
|
953
|
+
}
|
954
|
+
|
955
|
+
moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " + ( config.module === undefined ? "selected" : "" ) + ">< All Modules ></option>";
|
956
|
+
for ( i in config.modules ) {
|
957
|
+
if ( config.modules.hasOwnProperty( i ) ) {
|
958
|
+
numModules += 1;
|
959
|
+
moduleFilterHtml += "<option value='" + encodeURIComponent(i) + "' " + ( config.module === i ? "selected" : "" ) + ">" + i + "</option>";
|
960
|
+
}
|
961
|
+
}
|
962
|
+
moduleFilterHtml += "</select>";
|
963
|
+
|
964
|
+
// `userAgent` initialized at top of scope
|
965
|
+
userAgent = id( "qunit-userAgent" );
|
966
|
+
if ( userAgent ) {
|
967
|
+
userAgent.innerHTML = navigator.userAgent;
|
968
|
+
}
|
969
|
+
|
970
|
+
// `banner` initialized at top of scope
|
971
|
+
banner = id( "qunit-header" );
|
972
|
+
if ( banner ) {
|
973
|
+
banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
|
974
|
+
}
|
975
|
+
|
976
|
+
// `toolbar` initialized at top of scope
|
977
|
+
toolbar = id( "qunit-testrunner-toolbar" );
|
978
|
+
if ( toolbar ) {
|
979
|
+
// `filter` initialized at top of scope
|
980
|
+
filter = document.createElement( "input" );
|
981
|
+
filter.type = "checkbox";
|
982
|
+
filter.id = "qunit-filter-pass";
|
983
|
+
|
984
|
+
addEvent( filter, "click", function() {
|
985
|
+
var tmp,
|
986
|
+
ol = document.getElementById( "qunit-tests" );
|
987
|
+
|
988
|
+
if ( filter.checked ) {
|
989
|
+
ol.className = ol.className + " hidepass";
|
990
|
+
} else {
|
991
|
+
tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
|
992
|
+
ol.className = tmp.replace( / hidepass /, " " );
|
993
|
+
}
|
994
|
+
if ( defined.sessionStorage ) {
|
995
|
+
if (filter.checked) {
|
996
|
+
sessionStorage.setItem( "qunit-filter-passed-tests", "true" );
|
997
|
+
} else {
|
998
|
+
sessionStorage.removeItem( "qunit-filter-passed-tests" );
|
999
|
+
}
|
1000
|
+
}
|
1001
|
+
});
|
1002
|
+
|
1003
|
+
if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) {
|
1004
|
+
filter.checked = true;
|
1005
|
+
// `ol` initialized at top of scope
|
1006
|
+
ol = document.getElementById( "qunit-tests" );
|
1007
|
+
ol.className = ol.className + " hidepass";
|
1008
|
+
}
|
1009
|
+
toolbar.appendChild( filter );
|
1010
|
+
|
1011
|
+
// `label` initialized at top of scope
|
1012
|
+
label = document.createElement( "label" );
|
1013
|
+
label.setAttribute( "for", "qunit-filter-pass" );
|
1014
|
+
label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." );
|
1015
|
+
label.innerHTML = "Hide passed tests";
|
1016
|
+
toolbar.appendChild( label );
|
1017
|
+
|
1018
|
+
urlConfigCheckboxes = document.createElement( 'span' );
|
1019
|
+
urlConfigCheckboxes.innerHTML = urlConfigHtml;
|
1020
|
+
addEvent( urlConfigCheckboxes, "change", function( event ) {
|
1021
|
+
var params = {};
|
1022
|
+
params[ event.target.name ] = event.target.checked ? true : undefined;
|
1023
|
+
window.location = QUnit.url( params );
|
1024
|
+
});
|
1025
|
+
toolbar.appendChild( urlConfigCheckboxes );
|
1026
|
+
|
1027
|
+
if (numModules > 1) {
|
1028
|
+
moduleFilter = document.createElement( 'span' );
|
1029
|
+
moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' );
|
1030
|
+
moduleFilter.innerHTML = moduleFilterHtml;
|
1031
|
+
addEvent( moduleFilter, "change", function() {
|
1032
|
+
var selectBox = moduleFilter.getElementsByTagName("select")[0],
|
1033
|
+
selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);
|
1034
|
+
|
1035
|
+
window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } );
|
1036
|
+
});
|
1037
|
+
toolbar.appendChild(moduleFilter);
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
// `main` initialized at top of scope
|
1042
|
+
main = id( "qunit-fixture" );
|
1043
|
+
if ( main ) {
|
1044
|
+
config.fixture = main.innerHTML;
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
if ( config.autostart ) {
|
1048
|
+
QUnit.start();
|
1049
|
+
}
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
addEvent( window, "load", QUnit.load );
|
1053
|
+
|
1054
|
+
// `onErrorFnPrev` initialized at top of scope
|
1055
|
+
// Preserve other handlers
|
1056
|
+
onErrorFnPrev = window.onerror;
|
1057
|
+
|
1058
|
+
// Cover uncaught exceptions
|
1059
|
+
// Returning true will surpress the default browser handler,
|
1060
|
+
// returning false will let it run.
|
1061
|
+
window.onerror = function ( error, filePath, linerNr ) {
|
1062
|
+
var ret = false;
|
1063
|
+
if ( onErrorFnPrev ) {
|
1064
|
+
ret = onErrorFnPrev( error, filePath, linerNr );
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
// Treat return value as window.onerror itself does,
|
1068
|
+
// Only do our handling if not surpressed.
|
1069
|
+
if ( ret !== true ) {
|
1070
|
+
if ( QUnit.config.current ) {
|
1071
|
+
if ( QUnit.config.current.ignoreGlobalErrors ) {
|
1072
|
+
return true;
|
1073
|
+
}
|
1074
|
+
QUnit.pushFailure( error, filePath + ":" + linerNr );
|
1075
|
+
} else {
|
1076
|
+
QUnit.test( "global failure", extend( function() {
|
1077
|
+
QUnit.pushFailure( error, filePath + ":" + linerNr );
|
1078
|
+
}, { validTest: validTest } ) );
|
1079
|
+
}
|
1080
|
+
return false;
|
1081
|
+
}
|
1082
|
+
|
1083
|
+
return ret;
|
1084
|
+
};
|
1085
|
+
|
1086
|
+
function done() {
|
1087
|
+
config.autorun = true;
|
1088
|
+
|
1089
|
+
// Log the last module results
|
1090
|
+
if ( config.currentModule ) {
|
1091
|
+
runLoggingCallbacks( "moduleDone", QUnit, {
|
1092
|
+
name: config.currentModule,
|
1093
|
+
failed: config.moduleStats.bad,
|
1094
|
+
passed: config.moduleStats.all - config.moduleStats.bad,
|
1095
|
+
total: config.moduleStats.all
|
1096
|
+
});
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
var i, key,
|
1100
|
+
banner = id( "qunit-banner" ),
|
1101
|
+
tests = id( "qunit-tests" ),
|
1102
|
+
runtime = +new Date() - config.started,
|
1103
|
+
passed = config.stats.all - config.stats.bad,
|
1104
|
+
html = [
|
1105
|
+
"Tests completed in ",
|
1106
|
+
runtime,
|
1107
|
+
" milliseconds.<br/>",
|
1108
|
+
"<span class='passed'>",
|
1109
|
+
passed,
|
1110
|
+
"</span> tests of <span class='total'>",
|
1111
|
+
config.stats.all,
|
1112
|
+
"</span> passed, <span class='failed'>",
|
1113
|
+
config.stats.bad,
|
1114
|
+
"</span> failed."
|
1115
|
+
].join( "" );
|
1116
|
+
|
1117
|
+
if ( banner ) {
|
1118
|
+
banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" );
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
if ( tests ) {
|
1122
|
+
id( "qunit-testresult" ).innerHTML = html;
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
if ( config.altertitle && typeof document !== "undefined" && document.title ) {
|
1126
|
+
// show ✖ for good, ✔ for bad suite result in title
|
1127
|
+
// use escape sequences in case file gets loaded with non-utf-8-charset
|
1128
|
+
document.title = [
|
1129
|
+
( config.stats.bad ? "\u2716" : "\u2714" ),
|
1130
|
+
document.title.replace( /^[\u2714\u2716] /i, "" )
|
1131
|
+
].join( " " );
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
// clear own sessionStorage items if all tests passed
|
1135
|
+
if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) {
|
1136
|
+
// `key` & `i` initialized at top of scope
|
1137
|
+
for ( i = 0; i < sessionStorage.length; i++ ) {
|
1138
|
+
key = sessionStorage.key( i++ );
|
1139
|
+
if ( key.indexOf( "qunit-test-" ) === 0 ) {
|
1140
|
+
sessionStorage.removeItem( key );
|
1141
|
+
}
|
1142
|
+
}
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
// scroll back to top to show results
|
1146
|
+
if ( window.scrollTo ) {
|
1147
|
+
window.scrollTo(0, 0);
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
runLoggingCallbacks( "done", QUnit, {
|
1151
|
+
failed: config.stats.bad,
|
1152
|
+
passed: passed,
|
1153
|
+
total: config.stats.all,
|
1154
|
+
runtime: runtime
|
1155
|
+
});
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
/** @return Boolean: true if this test should be ran */
|
1159
|
+
function validTest( test ) {
|
1160
|
+
var include,
|
1161
|
+
filter = config.filter && config.filter.toLowerCase(),
|
1162
|
+
module = config.module && config.module.toLowerCase(),
|
1163
|
+
fullName = (test.module + ": " + test.testName).toLowerCase();
|
1164
|
+
|
1165
|
+
// Internally-generated tests are always valid
|
1166
|
+
if ( test.callback && test.callback.validTest === validTest ) {
|
1167
|
+
delete test.callback.validTest;
|
1168
|
+
return true;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
if ( config.testNumber ) {
|
1172
|
+
return test.testNumber === config.testNumber;
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
|
1176
|
+
return false;
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
if ( !filter ) {
|
1180
|
+
return true;
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
include = filter.charAt( 0 ) !== "!";
|
1184
|
+
if ( !include ) {
|
1185
|
+
filter = filter.slice( 1 );
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
// If the filter matches, we need to honour include
|
1189
|
+
if ( fullName.indexOf( filter ) !== -1 ) {
|
1190
|
+
return include;
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
// Otherwise, do the opposite
|
1194
|
+
return !include;
|
1195
|
+
}
|
1196
|
+
|
1197
|
+
// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)
|
1198
|
+
// Later Safari and IE10 are supposed to support error.stack as well
|
1199
|
+
// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
|
1200
|
+
function extractStacktrace( e, offset ) {
|
1201
|
+
offset = offset === undefined ? 3 : offset;
|
1202
|
+
|
1203
|
+
var stack, include, i, regex;
|
1204
|
+
|
1205
|
+
if ( e.stacktrace ) {
|
1206
|
+
// Opera
|
1207
|
+
return e.stacktrace.split( "\n" )[ offset + 3 ];
|
1208
|
+
} else if ( e.stack ) {
|
1209
|
+
// Firefox, Chrome
|
1210
|
+
stack = e.stack.split( "\n" );
|
1211
|
+
if (/^error$/i.test( stack[0] ) ) {
|
1212
|
+
stack.shift();
|
1213
|
+
}
|
1214
|
+
if ( fileName ) {
|
1215
|
+
include = [];
|
1216
|
+
for ( i = offset; i < stack.length; i++ ) {
|
1217
|
+
if ( stack[ i ].indexOf( fileName ) != -1 ) {
|
1218
|
+
break;
|
1219
|
+
}
|
1220
|
+
include.push( stack[ i ] );
|
1221
|
+
}
|
1222
|
+
if ( include.length ) {
|
1223
|
+
return include.join( "\n" );
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
return stack[ offset ];
|
1227
|
+
} else if ( e.sourceURL ) {
|
1228
|
+
// Safari, PhantomJS
|
1229
|
+
// hopefully one day Safari provides actual stacktraces
|
1230
|
+
// exclude useless self-reference for generated Error objects
|
1231
|
+
if ( /qunit.js$/.test( e.sourceURL ) ) {
|
1232
|
+
return;
|
1233
|
+
}
|
1234
|
+
// for actual exceptions, this is useful
|
1235
|
+
return e.sourceURL + ":" + e.line;
|
1236
|
+
}
|
1237
|
+
}
|
1238
|
+
function sourceFromStacktrace( offset ) {
|
1239
|
+
try {
|
1240
|
+
throw new Error();
|
1241
|
+
} catch ( e ) {
|
1242
|
+
return extractStacktrace( e, offset );
|
1243
|
+
}
|
1244
|
+
}
|
1245
|
+
|
1246
|
+
function escapeInnerText( s ) {
|
1247
|
+
if ( !s ) {
|
1248
|
+
return "";
|
1249
|
+
}
|
1250
|
+
s = s + "";
|
1251
|
+
return s.replace( /[\&<>]/g, function( s ) {
|
1252
|
+
switch( s ) {
|
1253
|
+
case "&": return "&";
|
1254
|
+
case "<": return "<";
|
1255
|
+
case ">": return ">";
|
1256
|
+
default: return s;
|
1257
|
+
}
|
1258
|
+
});
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
function synchronize( callback, last ) {
|
1262
|
+
config.queue.push( callback );
|
1263
|
+
|
1264
|
+
if ( config.autorun && !config.blocking ) {
|
1265
|
+
process( last );
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
function process( last ) {
|
1270
|
+
function next() {
|
1271
|
+
process( last );
|
1272
|
+
}
|
1273
|
+
var start = new Date().getTime();
|
1274
|
+
config.depth = config.depth ? config.depth + 1 : 1;
|
1275
|
+
|
1276
|
+
while ( config.queue.length && !config.blocking ) {
|
1277
|
+
if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
|
1278
|
+
config.queue.shift()();
|
1279
|
+
} else {
|
1280
|
+
window.setTimeout( next, 13 );
|
1281
|
+
break;
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
config.depth--;
|
1285
|
+
if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
|
1286
|
+
done();
|
1287
|
+
}
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
function saveGlobal() {
|
1291
|
+
config.pollution = [];
|
1292
|
+
|
1293
|
+
if ( config.noglobals ) {
|
1294
|
+
for ( var key in window ) {
|
1295
|
+
// in Opera sometimes DOM element ids show up here, ignore them
|
1296
|
+
if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) {
|
1297
|
+
continue;
|
1298
|
+
}
|
1299
|
+
config.pollution.push( key );
|
1300
|
+
}
|
1301
|
+
}
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
function checkPollution( name ) {
|
1305
|
+
var newGlobals,
|
1306
|
+
deletedGlobals,
|
1307
|
+
old = config.pollution;
|
1308
|
+
|
1309
|
+
saveGlobal();
|
1310
|
+
|
1311
|
+
newGlobals = diff( config.pollution, old );
|
1312
|
+
if ( newGlobals.length > 0 ) {
|
1313
|
+
QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") );
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
deletedGlobals = diff( old, config.pollution );
|
1317
|
+
if ( deletedGlobals.length > 0 ) {
|
1318
|
+
QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") );
|
1319
|
+
}
|
1320
|
+
}
|
1321
|
+
|
1322
|
+
// returns a new Array with the elements that are in a but not in b
|
1323
|
+
function diff( a, b ) {
|
1324
|
+
var i, j,
|
1325
|
+
result = a.slice();
|
1326
|
+
|
1327
|
+
for ( i = 0; i < result.length; i++ ) {
|
1328
|
+
for ( j = 0; j < b.length; j++ ) {
|
1329
|
+
if ( result[i] === b[j] ) {
|
1330
|
+
result.splice( i, 1 );
|
1331
|
+
i--;
|
1332
|
+
break;
|
1333
|
+
}
|
1334
|
+
}
|
1335
|
+
}
|
1336
|
+
return result;
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
function extend( a, b ) {
|
1340
|
+
for ( var prop in b ) {
|
1341
|
+
if ( b[ prop ] === undefined ) {
|
1342
|
+
delete a[ prop ];
|
1343
|
+
|
1344
|
+
// Avoid "Member not found" error in IE8 caused by setting window.constructor
|
1345
|
+
} else if ( prop !== "constructor" || a !== window ) {
|
1346
|
+
a[ prop ] = b[ prop ];
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
|
1350
|
+
return a;
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
function addEvent( elem, type, fn ) {
|
1354
|
+
if ( elem.addEventListener ) {
|
1355
|
+
elem.addEventListener( type, fn, false );
|
1356
|
+
} else if ( elem.attachEvent ) {
|
1357
|
+
elem.attachEvent( "on" + type, fn );
|
1358
|
+
} else {
|
1359
|
+
fn();
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
|
1363
|
+
function id( name ) {
|
1364
|
+
return !!( typeof document !== "undefined" && document && document.getElementById ) &&
|
1365
|
+
document.getElementById( name );
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
function registerLoggingCallback( key ) {
|
1369
|
+
return function( callback ) {
|
1370
|
+
config[key].push( callback );
|
1371
|
+
};
|
1372
|
+
}
|
1373
|
+
|
1374
|
+
// Supports deprecated method of completely overwriting logging callbacks
|
1375
|
+
function runLoggingCallbacks( key, scope, args ) {
|
1376
|
+
//debugger;
|
1377
|
+
var i, callbacks;
|
1378
|
+
if ( QUnit.hasOwnProperty( key ) ) {
|
1379
|
+
QUnit[ key ].call(scope, args );
|
1380
|
+
} else {
|
1381
|
+
callbacks = config[ key ];
|
1382
|
+
for ( i = 0; i < callbacks.length; i++ ) {
|
1383
|
+
callbacks[ i ].call( scope, args );
|
1384
|
+
}
|
1385
|
+
}
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
// Test for equality any JavaScript type.
|
1389
|
+
// Author: Philippe Rathé <prathe@gmail.com>
|
1390
|
+
QUnit.equiv = (function() {
|
1391
|
+
|
1392
|
+
// Call the o related callback with the given arguments.
|
1393
|
+
function bindCallbacks( o, callbacks, args ) {
|
1394
|
+
var prop = QUnit.objectType( o );
|
1395
|
+
if ( prop ) {
|
1396
|
+
if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
|
1397
|
+
return callbacks[ prop ].apply( callbacks, args );
|
1398
|
+
} else {
|
1399
|
+
return callbacks[ prop ]; // or undefined
|
1400
|
+
}
|
1401
|
+
}
|
1402
|
+
}
|
1403
|
+
|
1404
|
+
// the real equiv function
|
1405
|
+
var innerEquiv,
|
1406
|
+
// stack to decide between skip/abort functions
|
1407
|
+
callers = [],
|
1408
|
+
// stack to avoiding loops from circular referencing
|
1409
|
+
parents = [],
|
1410
|
+
|
1411
|
+
getProto = Object.getPrototypeOf || function ( obj ) {
|
1412
|
+
return obj.__proto__;
|
1413
|
+
},
|
1414
|
+
callbacks = (function () {
|
1415
|
+
|
1416
|
+
// for string, boolean, number and null
|
1417
|
+
function useStrictEquality( b, a ) {
|
1418
|
+
if ( b instanceof a.constructor || a instanceof b.constructor ) {
|
1419
|
+
// to catch short annotaion VS 'new' annotation of a
|
1420
|
+
// declaration
|
1421
|
+
// e.g. var i = 1;
|
1422
|
+
// var j = new Number(1);
|
1423
|
+
return a == b;
|
1424
|
+
} else {
|
1425
|
+
return a === b;
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
return {
|
1430
|
+
"string": useStrictEquality,
|
1431
|
+
"boolean": useStrictEquality,
|
1432
|
+
"number": useStrictEquality,
|
1433
|
+
"null": useStrictEquality,
|
1434
|
+
"undefined": useStrictEquality,
|
1435
|
+
|
1436
|
+
"nan": function( b ) {
|
1437
|
+
return isNaN( b );
|
1438
|
+
},
|
1439
|
+
|
1440
|
+
"date": function( b, a ) {
|
1441
|
+
return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf();
|
1442
|
+
},
|
1443
|
+
|
1444
|
+
"regexp": function( b, a ) {
|
1445
|
+
return QUnit.objectType( b ) === "regexp" &&
|
1446
|
+
// the regex itself
|
1447
|
+
a.source === b.source &&
|
1448
|
+
// and its modifers
|
1449
|
+
a.global === b.global &&
|
1450
|
+
// (gmi) ...
|
1451
|
+
a.ignoreCase === b.ignoreCase &&
|
1452
|
+
a.multiline === b.multiline &&
|
1453
|
+
a.sticky === b.sticky;
|
1454
|
+
},
|
1455
|
+
|
1456
|
+
// - skip when the property is a method of an instance (OOP)
|
1457
|
+
// - abort otherwise,
|
1458
|
+
// initial === would have catch identical references anyway
|
1459
|
+
"function": function() {
|
1460
|
+
var caller = callers[callers.length - 1];
|
1461
|
+
return caller !== Object && typeof caller !== "undefined";
|
1462
|
+
},
|
1463
|
+
|
1464
|
+
"array": function( b, a ) {
|
1465
|
+
var i, j, len, loop;
|
1466
|
+
|
1467
|
+
// b could be an object literal here
|
1468
|
+
if ( QUnit.objectType( b ) !== "array" ) {
|
1469
|
+
return false;
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
len = a.length;
|
1473
|
+
if ( len !== b.length ) {
|
1474
|
+
// safe and faster
|
1475
|
+
return false;
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
// track reference to avoid circular references
|
1479
|
+
parents.push( a );
|
1480
|
+
for ( i = 0; i < len; i++ ) {
|
1481
|
+
loop = false;
|
1482
|
+
for ( j = 0; j < parents.length; j++ ) {
|
1483
|
+
if ( parents[j] === a[i] ) {
|
1484
|
+
loop = true;// dont rewalk array
|
1485
|
+
}
|
1486
|
+
}
|
1487
|
+
if ( !loop && !innerEquiv(a[i], b[i]) ) {
|
1488
|
+
parents.pop();
|
1489
|
+
return false;
|
1490
|
+
}
|
1491
|
+
}
|
1492
|
+
parents.pop();
|
1493
|
+
return true;
|
1494
|
+
},
|
1495
|
+
|
1496
|
+
"object": function( b, a ) {
|
1497
|
+
var i, j, loop,
|
1498
|
+
// Default to true
|
1499
|
+
eq = true,
|
1500
|
+
aProperties = [],
|
1501
|
+
bProperties = [];
|
1502
|
+
|
1503
|
+
// comparing constructors is more strict than using
|
1504
|
+
// instanceof
|
1505
|
+
if ( a.constructor !== b.constructor ) {
|
1506
|
+
// Allow objects with no prototype to be equivalent to
|
1507
|
+
// objects with Object as their constructor.
|
1508
|
+
if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) ||
|
1509
|
+
( getProto(b) === null && getProto(a) === Object.prototype ) ) ) {
|
1510
|
+
return false;
|
1511
|
+
}
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
// stack constructor before traversing properties
|
1515
|
+
callers.push( a.constructor );
|
1516
|
+
// track reference to avoid circular references
|
1517
|
+
parents.push( a );
|
1518
|
+
|
1519
|
+
for ( i in a ) { // be strict: don't ensures hasOwnProperty
|
1520
|
+
// and go deep
|
1521
|
+
loop = false;
|
1522
|
+
for ( j = 0; j < parents.length; j++ ) {
|
1523
|
+
if ( parents[j] === a[i] ) {
|
1524
|
+
// don't go down the same path twice
|
1525
|
+
loop = true;
|
1526
|
+
}
|
1527
|
+
}
|
1528
|
+
aProperties.push(i); // collect a's properties
|
1529
|
+
|
1530
|
+
if (!loop && !innerEquiv( a[i], b[i] ) ) {
|
1531
|
+
eq = false;
|
1532
|
+
break;
|
1533
|
+
}
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
callers.pop(); // unstack, we are done
|
1537
|
+
parents.pop();
|
1538
|
+
|
1539
|
+
for ( i in b ) {
|
1540
|
+
bProperties.push( i ); // collect b's properties
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
// Ensures identical properties name
|
1544
|
+
return eq && innerEquiv( aProperties.sort(), bProperties.sort() );
|
1545
|
+
}
|
1546
|
+
};
|
1547
|
+
}());
|
1548
|
+
|
1549
|
+
innerEquiv = function() { // can take multiple arguments
|
1550
|
+
var args = [].slice.apply( arguments );
|
1551
|
+
if ( args.length < 2 ) {
|
1552
|
+
return true; // end transition
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
return (function( a, b ) {
|
1556
|
+
if ( a === b ) {
|
1557
|
+
return true; // catch the most you can
|
1558
|
+
} else if ( a === null || b === null || typeof a === "undefined" ||
|
1559
|
+
typeof b === "undefined" ||
|
1560
|
+
QUnit.objectType(a) !== QUnit.objectType(b) ) {
|
1561
|
+
return false; // don't lose time with error prone cases
|
1562
|
+
} else {
|
1563
|
+
return bindCallbacks(a, callbacks, [ b, a ]);
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
// apply transition with (1..n) arguments
|
1567
|
+
}( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) );
|
1568
|
+
};
|
1569
|
+
|
1570
|
+
return innerEquiv;
|
1571
|
+
}());
|
1572
|
+
|
1573
|
+
/**
|
1574
|
+
* jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
|
1575
|
+
* http://flesler.blogspot.com Licensed under BSD
|
1576
|
+
* (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
|
1577
|
+
*
|
1578
|
+
* @projectDescription Advanced and extensible data dumping for Javascript.
|
1579
|
+
* @version 1.0.0
|
1580
|
+
* @author Ariel Flesler
|
1581
|
+
* @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
|
1582
|
+
*/
|
1583
|
+
QUnit.jsDump = (function() {
|
1584
|
+
function quote( str ) {
|
1585
|
+
return '"' + str.toString().replace( /"/g, '\\"' ) + '"';
|
1586
|
+
}
|
1587
|
+
function literal( o ) {
|
1588
|
+
return o + "";
|
1589
|
+
}
|
1590
|
+
function join( pre, arr, post ) {
|
1591
|
+
var s = jsDump.separator(),
|
1592
|
+
base = jsDump.indent(),
|
1593
|
+
inner = jsDump.indent(1);
|
1594
|
+
if ( arr.join ) {
|
1595
|
+
arr = arr.join( "," + s + inner );
|
1596
|
+
}
|
1597
|
+
if ( !arr ) {
|
1598
|
+
return pre + post;
|
1599
|
+
}
|
1600
|
+
return [ pre, inner + arr, base + post ].join(s);
|
1601
|
+
}
|
1602
|
+
function array( arr, stack ) {
|
1603
|
+
var i = arr.length, ret = new Array(i);
|
1604
|
+
this.up();
|
1605
|
+
while ( i-- ) {
|
1606
|
+
ret[i] = this.parse( arr[i] , undefined , stack);
|
1607
|
+
}
|
1608
|
+
this.down();
|
1609
|
+
return join( "[", ret, "]" );
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
var reName = /^function (\w+)/,
|
1613
|
+
jsDump = {
|
1614
|
+
parse: function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance
|
1615
|
+
stack = stack || [ ];
|
1616
|
+
var inStack, res,
|
1617
|
+
parser = this.parsers[ type || this.typeOf(obj) ];
|
1618
|
+
|
1619
|
+
type = typeof parser;
|
1620
|
+
inStack = inArray( obj, stack );
|
1621
|
+
|
1622
|
+
if ( inStack != -1 ) {
|
1623
|
+
return "recursion(" + (inStack - stack.length) + ")";
|
1624
|
+
}
|
1625
|
+
//else
|
1626
|
+
if ( type == "function" ) {
|
1627
|
+
stack.push( obj );
|
1628
|
+
res = parser.call( this, obj, stack );
|
1629
|
+
stack.pop();
|
1630
|
+
return res;
|
1631
|
+
}
|
1632
|
+
// else
|
1633
|
+
return ( type == "string" ) ? parser : this.parsers.error;
|
1634
|
+
},
|
1635
|
+
typeOf: function( obj ) {
|
1636
|
+
var type;
|
1637
|
+
if ( obj === null ) {
|
1638
|
+
type = "null";
|
1639
|
+
} else if ( typeof obj === "undefined" ) {
|
1640
|
+
type = "undefined";
|
1641
|
+
} else if ( QUnit.is( "regexp", obj) ) {
|
1642
|
+
type = "regexp";
|
1643
|
+
} else if ( QUnit.is( "date", obj) ) {
|
1644
|
+
type = "date";
|
1645
|
+
} else if ( QUnit.is( "function", obj) ) {
|
1646
|
+
type = "function";
|
1647
|
+
} else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {
|
1648
|
+
type = "window";
|
1649
|
+
} else if ( obj.nodeType === 9 ) {
|
1650
|
+
type = "document";
|
1651
|
+
} else if ( obj.nodeType ) {
|
1652
|
+
type = "node";
|
1653
|
+
} else if (
|
1654
|
+
// native arrays
|
1655
|
+
toString.call( obj ) === "[object Array]" ||
|
1656
|
+
// NodeList objects
|
1657
|
+
( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) )
|
1658
|
+
) {
|
1659
|
+
type = "array";
|
1660
|
+
} else {
|
1661
|
+
type = typeof obj;
|
1662
|
+
}
|
1663
|
+
return type;
|
1664
|
+
},
|
1665
|
+
separator: function() {
|
1666
|
+
return this.multiline ? this.HTML ? "<br />" : "\n" : this.HTML ? " " : " ";
|
1667
|
+
},
|
1668
|
+
indent: function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
|
1669
|
+
if ( !this.multiline ) {
|
1670
|
+
return "";
|
1671
|
+
}
|
1672
|
+
var chr = this.indentChar;
|
1673
|
+
if ( this.HTML ) {
|
1674
|
+
chr = chr.replace( /\t/g, " " ).replace( / /g, " " );
|
1675
|
+
}
|
1676
|
+
return new Array( this._depth_ + (extra||0) ).join(chr);
|
1677
|
+
},
|
1678
|
+
up: function( a ) {
|
1679
|
+
this._depth_ += a || 1;
|
1680
|
+
},
|
1681
|
+
down: function( a ) {
|
1682
|
+
this._depth_ -= a || 1;
|
1683
|
+
},
|
1684
|
+
setParser: function( name, parser ) {
|
1685
|
+
this.parsers[name] = parser;
|
1686
|
+
},
|
1687
|
+
// The next 3 are exposed so you can use them
|
1688
|
+
quote: quote,
|
1689
|
+
literal: literal,
|
1690
|
+
join: join,
|
1691
|
+
//
|
1692
|
+
_depth_: 1,
|
1693
|
+
// This is the list of parsers, to modify them, use jsDump.setParser
|
1694
|
+
parsers: {
|
1695
|
+
window: "[Window]",
|
1696
|
+
document: "[Document]",
|
1697
|
+
error: "[ERROR]", //when no parser is found, shouldn"t happen
|
1698
|
+
unknown: "[Unknown]",
|
1699
|
+
"null": "null",
|
1700
|
+
"undefined": "undefined",
|
1701
|
+
"function": function( fn ) {
|
1702
|
+
var ret = "function",
|
1703
|
+
name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];//functions never have name in IE
|
1704
|
+
|
1705
|
+
if ( name ) {
|
1706
|
+
ret += " " + name;
|
1707
|
+
}
|
1708
|
+
ret += "( ";
|
1709
|
+
|
1710
|
+
ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" );
|
1711
|
+
return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" );
|
1712
|
+
},
|
1713
|
+
array: array,
|
1714
|
+
nodelist: array,
|
1715
|
+
"arguments": array,
|
1716
|
+
object: function( map, stack ) {
|
1717
|
+
var ret = [ ], keys, key, val, i;
|
1718
|
+
QUnit.jsDump.up();
|
1719
|
+
if ( Object.keys ) {
|
1720
|
+
keys = Object.keys( map );
|
1721
|
+
} else {
|
1722
|
+
keys = [];
|
1723
|
+
for ( key in map ) {
|
1724
|
+
keys.push( key );
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
keys.sort();
|
1728
|
+
for ( i = 0; i < keys.length; i++ ) {
|
1729
|
+
key = keys[ i ];
|
1730
|
+
val = map[ key ];
|
1731
|
+
ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) );
|
1732
|
+
}
|
1733
|
+
QUnit.jsDump.down();
|
1734
|
+
return join( "{", ret, "}" );
|
1735
|
+
},
|
1736
|
+
node: function( node ) {
|
1737
|
+
var a, val,
|
1738
|
+
open = QUnit.jsDump.HTML ? "<" : "<",
|
1739
|
+
close = QUnit.jsDump.HTML ? ">" : ">",
|
1740
|
+
tag = node.nodeName.toLowerCase(),
|
1741
|
+
ret = open + tag;
|
1742
|
+
|
1743
|
+
for ( a in QUnit.jsDump.DOMAttrs ) {
|
1744
|
+
val = node[ QUnit.jsDump.DOMAttrs[a] ];
|
1745
|
+
if ( val ) {
|
1746
|
+
ret += " " + a + "=" + QUnit.jsDump.parse( val, "attribute" );
|
1747
|
+
}
|
1748
|
+
}
|
1749
|
+
return ret + close + open + "/" + tag + close;
|
1750
|
+
},
|
1751
|
+
functionArgs: function( fn ) {//function calls it internally, it's the arguments part of the function
|
1752
|
+
var args,
|
1753
|
+
l = fn.length;
|
1754
|
+
|
1755
|
+
if ( !l ) {
|
1756
|
+
return "";
|
1757
|
+
}
|
1758
|
+
|
1759
|
+
args = new Array(l);
|
1760
|
+
while ( l-- ) {
|
1761
|
+
args[l] = String.fromCharCode(97+l);//97 is 'a'
|
1762
|
+
}
|
1763
|
+
return " " + args.join( ", " ) + " ";
|
1764
|
+
},
|
1765
|
+
key: quote, //object calls it internally, the key part of an item in a map
|
1766
|
+
functionCode: "[code]", //function calls it internally, it's the content of the function
|
1767
|
+
attribute: quote, //node calls it internally, it's an html attribute value
|
1768
|
+
string: quote,
|
1769
|
+
date: quote,
|
1770
|
+
regexp: literal, //regex
|
1771
|
+
number: literal,
|
1772
|
+
"boolean": literal
|
1773
|
+
},
|
1774
|
+
DOMAttrs: {
|
1775
|
+
//attributes to dump from nodes, name=>realName
|
1776
|
+
id: "id",
|
1777
|
+
name: "name",
|
1778
|
+
"class": "className"
|
1779
|
+
},
|
1780
|
+
HTML: false,//if true, entities are escaped ( <, >, \t, space and \n )
|
1781
|
+
indentChar: " ",//indentation unit
|
1782
|
+
multiline: true //if true, items in a collection, are separated by a \n, else just a space.
|
1783
|
+
};
|
1784
|
+
|
1785
|
+
return jsDump;
|
1786
|
+
}());
|
1787
|
+
|
1788
|
+
// from Sizzle.js
|
1789
|
+
function getText( elems ) {
|
1790
|
+
var i, elem,
|
1791
|
+
ret = "";
|
1792
|
+
|
1793
|
+
for ( i = 0; elems[i]; i++ ) {
|
1794
|
+
elem = elems[i];
|
1795
|
+
|
1796
|
+
// Get the text from text nodes and CDATA nodes
|
1797
|
+
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
|
1798
|
+
ret += elem.nodeValue;
|
1799
|
+
|
1800
|
+
// Traverse everything else, except comment nodes
|
1801
|
+
} else if ( elem.nodeType !== 8 ) {
|
1802
|
+
ret += getText( elem.childNodes );
|
1803
|
+
}
|
1804
|
+
}
|
1805
|
+
|
1806
|
+
return ret;
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
// from jquery.js
|
1810
|
+
function inArray( elem, array ) {
|
1811
|
+
if ( array.indexOf ) {
|
1812
|
+
return array.indexOf( elem );
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
for ( var i = 0, length = array.length; i < length; i++ ) {
|
1816
|
+
if ( array[ i ] === elem ) {
|
1817
|
+
return i;
|
1818
|
+
}
|
1819
|
+
}
|
1820
|
+
|
1821
|
+
return -1;
|
1822
|
+
}
|
1823
|
+
|
1824
|
+
/*
|
1825
|
+
* Javascript Diff Algorithm
|
1826
|
+
* By John Resig (http://ejohn.org/)
|
1827
|
+
* Modified by Chu Alan "sprite"
|
1828
|
+
*
|
1829
|
+
* Released under the MIT license.
|
1830
|
+
*
|
1831
|
+
* More Info:
|
1832
|
+
* http://ejohn.org/projects/javascript-diff-algorithm/
|
1833
|
+
*
|
1834
|
+
* Usage: QUnit.diff(expected, actual)
|
1835
|
+
*
|
1836
|
+
* QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
|
1837
|
+
*/
|
1838
|
+
QUnit.diff = (function() {
|
1839
|
+
function diff( o, n ) {
|
1840
|
+
var i,
|
1841
|
+
ns = {},
|
1842
|
+
os = {};
|
1843
|
+
|
1844
|
+
for ( i = 0; i < n.length; i++ ) {
|
1845
|
+
if ( ns[ n[i] ] == null ) {
|
1846
|
+
ns[ n[i] ] = {
|
1847
|
+
rows: [],
|
1848
|
+
o: null
|
1849
|
+
};
|
1850
|
+
}
|
1851
|
+
ns[ n[i] ].rows.push( i );
|
1852
|
+
}
|
1853
|
+
|
1854
|
+
for ( i = 0; i < o.length; i++ ) {
|
1855
|
+
if ( os[ o[i] ] == null ) {
|
1856
|
+
os[ o[i] ] = {
|
1857
|
+
rows: [],
|
1858
|
+
n: null
|
1859
|
+
};
|
1860
|
+
}
|
1861
|
+
os[ o[i] ].rows.push( i );
|
1862
|
+
}
|
1863
|
+
|
1864
|
+
for ( i in ns ) {
|
1865
|
+
if ( !hasOwn.call( ns, i ) ) {
|
1866
|
+
continue;
|
1867
|
+
}
|
1868
|
+
if ( ns[i].rows.length == 1 && typeof os[i] != "undefined" && os[i].rows.length == 1 ) {
|
1869
|
+
n[ ns[i].rows[0] ] = {
|
1870
|
+
text: n[ ns[i].rows[0] ],
|
1871
|
+
row: os[i].rows[0]
|
1872
|
+
};
|
1873
|
+
o[ os[i].rows[0] ] = {
|
1874
|
+
text: o[ os[i].rows[0] ],
|
1875
|
+
row: ns[i].rows[0]
|
1876
|
+
};
|
1877
|
+
}
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
for ( i = 0; i < n.length - 1; i++ ) {
|
1881
|
+
if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&
|
1882
|
+
n[ i + 1 ] == o[ n[i].row + 1 ] ) {
|
1883
|
+
|
1884
|
+
n[ i + 1 ] = {
|
1885
|
+
text: n[ i + 1 ],
|
1886
|
+
row: n[i].row + 1
|
1887
|
+
};
|
1888
|
+
o[ n[i].row + 1 ] = {
|
1889
|
+
text: o[ n[i].row + 1 ],
|
1890
|
+
row: i + 1
|
1891
|
+
};
|
1892
|
+
}
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
for ( i = n.length - 1; i > 0; i-- ) {
|
1896
|
+
if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&
|
1897
|
+
n[ i - 1 ] == o[ n[i].row - 1 ]) {
|
1898
|
+
|
1899
|
+
n[ i - 1 ] = {
|
1900
|
+
text: n[ i - 1 ],
|
1901
|
+
row: n[i].row - 1
|
1902
|
+
};
|
1903
|
+
o[ n[i].row - 1 ] = {
|
1904
|
+
text: o[ n[i].row - 1 ],
|
1905
|
+
row: i - 1
|
1906
|
+
};
|
1907
|
+
}
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
return {
|
1911
|
+
o: o,
|
1912
|
+
n: n
|
1913
|
+
};
|
1914
|
+
}
|
1915
|
+
|
1916
|
+
return function( o, n ) {
|
1917
|
+
o = o.replace( /\s+$/, "" );
|
1918
|
+
n = n.replace( /\s+$/, "" );
|
1919
|
+
|
1920
|
+
var i, pre,
|
1921
|
+
str = "",
|
1922
|
+
out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ),
|
1923
|
+
oSpace = o.match(/\s+/g),
|
1924
|
+
nSpace = n.match(/\s+/g);
|
1925
|
+
|
1926
|
+
if ( oSpace == null ) {
|
1927
|
+
oSpace = [ " " ];
|
1928
|
+
}
|
1929
|
+
else {
|
1930
|
+
oSpace.push( " " );
|
1931
|
+
}
|
1932
|
+
|
1933
|
+
if ( nSpace == null ) {
|
1934
|
+
nSpace = [ " " ];
|
1935
|
+
}
|
1936
|
+
else {
|
1937
|
+
nSpace.push( " " );
|
1938
|
+
}
|
1939
|
+
|
1940
|
+
if ( out.n.length === 0 ) {
|
1941
|
+
for ( i = 0; i < out.o.length; i++ ) {
|
1942
|
+
str += "<del>" + out.o[i] + oSpace[i] + "</del>";
|
1943
|
+
}
|
1944
|
+
}
|
1945
|
+
else {
|
1946
|
+
if ( out.n[0].text == null ) {
|
1947
|
+
for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) {
|
1948
|
+
str += "<del>" + out.o[n] + oSpace[n] + "</del>";
|
1949
|
+
}
|
1950
|
+
}
|
1951
|
+
|
1952
|
+
for ( i = 0; i < out.n.length; i++ ) {
|
1953
|
+
if (out.n[i].text == null) {
|
1954
|
+
str += "<ins>" + out.n[i] + nSpace[i] + "</ins>";
|
1955
|
+
}
|
1956
|
+
else {
|
1957
|
+
// `pre` initialized at top of scope
|
1958
|
+
pre = "";
|
1959
|
+
|
1960
|
+
for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {
|
1961
|
+
pre += "<del>" + out.o[n] + oSpace[n] + "</del>";
|
1962
|
+
}
|
1963
|
+
str += " " + out.n[i].text + nSpace[i] + pre;
|
1964
|
+
}
|
1965
|
+
}
|
1966
|
+
}
|
1967
|
+
|
1968
|
+
return str;
|
1969
|
+
};
|
1970
|
+
}());
|
1971
|
+
|
1972
|
+
// for CommonJS enviroments, export everything
|
1973
|
+
if ( typeof exports !== "undefined" ) {
|
1974
|
+
extend(exports, QUnit);
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
// get at whatever the global object is, like window in browsers
|
1978
|
+
}( (function() {return this;}.call()) ));
|
1979
|
+
(function() {
|
1980
|
+
|
1981
|
+
this.Teabag = (function() {
|
1982
|
+
|
1983
|
+
function Teabag() {}
|
1984
|
+
|
1985
|
+
Teabag.defer = false;
|
1986
|
+
|
1987
|
+
Teabag.slow = 75;
|
1988
|
+
|
1989
|
+
Teabag.fixturePath = null;
|
1990
|
+
|
1991
|
+
Teabag.finished = false;
|
1992
|
+
|
1993
|
+
Teabag.Reporters = {};
|
1994
|
+
|
1995
|
+
Teabag.Date = Date;
|
1996
|
+
|
1997
|
+
Teabag.location = window.location;
|
1998
|
+
|
1999
|
+
Teabag.console = window.console;
|
2000
|
+
|
2001
|
+
Teabag.messages = [];
|
2002
|
+
|
2003
|
+
Teabag.execute = function() {
|
2004
|
+
if (this.defer) {
|
2005
|
+
this.defer = false;
|
2006
|
+
return;
|
2007
|
+
}
|
2008
|
+
return new Teabag.Runner();
|
2009
|
+
};
|
2010
|
+
|
2011
|
+
Teabag.log = function() {
|
2012
|
+
var _ref;
|
2013
|
+
this.messages.push(arguments[0]);
|
2014
|
+
return (_ref = this.console).log.apply(_ref, arguments);
|
2015
|
+
};
|
2016
|
+
|
2017
|
+
Teabag.getMessages = function() {
|
2018
|
+
var messages;
|
2019
|
+
messages = this.messages;
|
2020
|
+
this.messages = [];
|
2021
|
+
return messages;
|
2022
|
+
};
|
2023
|
+
|
2024
|
+
return Teabag;
|
2025
|
+
|
2026
|
+
})();
|
2027
|
+
|
2028
|
+
}).call(this);
|
2029
|
+
(function() {
|
2030
|
+
|
2031
|
+
Teabag.Runner = (function() {
|
2032
|
+
|
2033
|
+
Runner.run = false;
|
2034
|
+
|
2035
|
+
function Runner() {
|
2036
|
+
if (this.constructor.run) {
|
2037
|
+
return;
|
2038
|
+
}
|
2039
|
+
this.constructor.run = true;
|
2040
|
+
this.fixturePath = Teabag.fixturePath;
|
2041
|
+
this.params = this.getParams();
|
2042
|
+
this.setup();
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
Runner.prototype.getParams = function() {
|
2046
|
+
var name, param, params, value, _i, _len, _ref, _ref1;
|
2047
|
+
params = {};
|
2048
|
+
_ref = Teabag.location.search.substring(1).split("&");
|
2049
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2050
|
+
param = _ref[_i];
|
2051
|
+
_ref1 = param.split("="), name = _ref1[0], value = _ref1[1];
|
2052
|
+
params[decodeURIComponent(name)] = decodeURIComponent(value);
|
2053
|
+
}
|
2054
|
+
return params;
|
2055
|
+
};
|
2056
|
+
|
2057
|
+
Runner.prototype.getReporter = function() {
|
2058
|
+
if (this.params["reporter"]) {
|
2059
|
+
return Teabag.Reporters[this.params["reporter"]];
|
2060
|
+
} else {
|
2061
|
+
if (window.navigator.userAgent.match(/PhantomJS/)) {
|
2062
|
+
return Teabag.Reporters.Console;
|
2063
|
+
} else {
|
2064
|
+
return Teabag.Reporters.HTML;
|
2065
|
+
}
|
2066
|
+
}
|
2067
|
+
};
|
2068
|
+
|
2069
|
+
Runner.prototype.setup = function() {};
|
2070
|
+
|
2071
|
+
return Runner;
|
2072
|
+
|
2073
|
+
})();
|
2074
|
+
|
2075
|
+
}).call(this);
|
2076
|
+
(function() {
|
2077
|
+
|
2078
|
+
Teabag.Reporters.BaseView = (function() {
|
2079
|
+
|
2080
|
+
function BaseView() {
|
2081
|
+
this.elements = {};
|
2082
|
+
this.build();
|
2083
|
+
}
|
2084
|
+
|
2085
|
+
BaseView.prototype.build = function(className) {
|
2086
|
+
return this.el = this.createEl("li", className);
|
2087
|
+
};
|
2088
|
+
|
2089
|
+
BaseView.prototype.appendTo = function(el) {
|
2090
|
+
return el.appendChild(this.el);
|
2091
|
+
};
|
2092
|
+
|
2093
|
+
BaseView.prototype.append = function(el) {
|
2094
|
+
return this.el.appendChild(el);
|
2095
|
+
};
|
2096
|
+
|
2097
|
+
BaseView.prototype.createEl = function(type, className) {
|
2098
|
+
var el;
|
2099
|
+
if (className == null) {
|
2100
|
+
className = "";
|
2101
|
+
}
|
2102
|
+
el = document.createElement(type);
|
2103
|
+
el.className = className;
|
2104
|
+
return el;
|
2105
|
+
};
|
2106
|
+
|
2107
|
+
BaseView.prototype.findEl = function(id) {
|
2108
|
+
var _base;
|
2109
|
+
this.elements || (this.elements = {});
|
2110
|
+
return (_base = this.elements)[id] || (_base[id] = document.getElementById("teabag-" + id));
|
2111
|
+
};
|
2112
|
+
|
2113
|
+
BaseView.prototype.setText = function(id, value) {
|
2114
|
+
var el;
|
2115
|
+
el = this.findEl(id);
|
2116
|
+
return el.innerHTML = value;
|
2117
|
+
};
|
2118
|
+
|
2119
|
+
BaseView.prototype.setHtml = function(id, value, add) {
|
2120
|
+
var el;
|
2121
|
+
if (add == null) {
|
2122
|
+
add = false;
|
2123
|
+
}
|
2124
|
+
el = this.findEl(id);
|
2125
|
+
if (add) {
|
2126
|
+
return el.innerHTML += value;
|
2127
|
+
} else {
|
2128
|
+
return el.innerHTML = value;
|
2129
|
+
}
|
2130
|
+
};
|
2131
|
+
|
2132
|
+
BaseView.prototype.setClass = function(id, value) {
|
2133
|
+
var el;
|
2134
|
+
el = this.findEl(id);
|
2135
|
+
return el.className = value;
|
2136
|
+
};
|
2137
|
+
|
2138
|
+
BaseView.prototype.htmlSafe = function(str) {
|
2139
|
+
var el;
|
2140
|
+
el = document.createElement("div");
|
2141
|
+
el.appendChild(document.createTextNode(str));
|
2142
|
+
return el.innerHTML;
|
2143
|
+
};
|
2144
|
+
|
2145
|
+
return BaseView;
|
2146
|
+
|
2147
|
+
})();
|
2148
|
+
|
2149
|
+
}).call(this);
|
2150
|
+
(function() {
|
2151
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
2152
|
+
__hasProp = {}.hasOwnProperty,
|
2153
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2154
|
+
|
2155
|
+
Teabag.Reporters.HTML = (function(_super) {
|
2156
|
+
|
2157
|
+
__extends(HTML, _super);
|
2158
|
+
|
2159
|
+
function HTML() {
|
2160
|
+
this.toggleConfig = __bind(this.toggleConfig, this);
|
2161
|
+
|
2162
|
+
this.reportRunnerResults = __bind(this.reportRunnerResults, this);
|
2163
|
+
this.start = new Teabag.Date().getTime();
|
2164
|
+
this.config = {
|
2165
|
+
"use-catch": true,
|
2166
|
+
"build-full-report": false,
|
2167
|
+
"display-progress": true
|
2168
|
+
};
|
2169
|
+
this.total = {
|
2170
|
+
exist: 0,
|
2171
|
+
run: 0,
|
2172
|
+
passes: 0,
|
2173
|
+
failures: 0,
|
2174
|
+
skipped: 0
|
2175
|
+
};
|
2176
|
+
this.views = {
|
2177
|
+
specs: {},
|
2178
|
+
suites: {}
|
2179
|
+
};
|
2180
|
+
this.filter = false;
|
2181
|
+
this.readConfig();
|
2182
|
+
HTML.__super__.constructor.apply(this, arguments);
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
HTML.prototype.build = function() {
|
2186
|
+
this.buildLayout();
|
2187
|
+
this.el = this.findEl("report-all");
|
2188
|
+
this.setText("env-info", this.envInfo());
|
2189
|
+
this.setText("version", Teabag.version);
|
2190
|
+
this.findEl("toggles").onclick = this.toggleConfig;
|
2191
|
+
this.showConfiguration();
|
2192
|
+
return this.buildProgress();
|
2193
|
+
};
|
2194
|
+
|
2195
|
+
HTML.prototype.buildLayout = function() {
|
2196
|
+
var el;
|
2197
|
+
el = this.createEl("div");
|
2198
|
+
document.body.appendChild(el);
|
2199
|
+
return el.innerHTML = "<div class=\"teabag-clearfix\">\n <div id=\"teabag-title\">\n <h1>Teabag</h1>\n <ul>\n <li>version: <b id=\"teabag-version\"></b></li>\n <li id=\"teabag-env-info\"></li>\n </ul>\n </div>\n <div id=\"teabag-progress\"></div>\n <ul id=\"teabag-stats\">\n <li>passes: <b id=\"teabag-stats-passes\">0</b></li>\n <li>failures: <b id=\"teabag-stats-failures\">0</b></li>\n <li>skipped: <b id=\"teabag-stats-skipped\">0</b></li>\n <li>duration: <b id=\"teabag-stats-duration\">∞</b></li>\n </ul>\n</div>\n\n<div id=\"teabag-controls\" class=\"teabag-clearfix\">\n <div id=\"teabag-toggles\">\n <button id=\"teabag-use-catch\">Use Try/Catch</button>\n <button id=\"teabag-build-full-report\">Build Full Report</button>\n <button id=\"teabag-display-progress\">Display Progress</button>\n </div>\n <div id=\"teabag-filtered\">\n <button onclick=\"window.location.href = window.location.pathname\">Run All Specs</button>\n </div>\n</div>\n\n<hr/>\n\n<div id=\"teabag-report\">\n <ol id=\"teabag-report-failures\"></ol>\n <ol id=\"teabag-report-all\"></ol>\n</div>";
|
2200
|
+
};
|
2201
|
+
|
2202
|
+
HTML.prototype.buildProgress = function() {
|
2203
|
+
this.progress = Teabag.Reporters.HTML.ProgressView.create(this.config["display-progress"]);
|
2204
|
+
return this.progress.appendTo(this.findEl("progress"));
|
2205
|
+
};
|
2206
|
+
|
2207
|
+
HTML.prototype.reportRunnerStarting = function(runner) {
|
2208
|
+
this.total.exist = runner.total || runner.specs().length;
|
2209
|
+
if (this.total.exist) {
|
2210
|
+
return this.setText("stats-duration", "...");
|
2211
|
+
}
|
2212
|
+
};
|
2213
|
+
|
2214
|
+
HTML.prototype.reportSpecStarting = function(spec) {
|
2215
|
+
spec = new Teabag.Spec(spec);
|
2216
|
+
if (this.config["build-full-report"]) {
|
2217
|
+
this.reportView = new Teabag.Reporters.HTML.SpecView(spec, this);
|
2218
|
+
}
|
2219
|
+
return this.specStart = new Teabag.Date().getTime();
|
2220
|
+
};
|
2221
|
+
|
2222
|
+
HTML.prototype.reportSpecResults = function(spec) {
|
2223
|
+
this.total.run += 1;
|
2224
|
+
this.updateProgress();
|
2225
|
+
return this.updateStatus(spec);
|
2226
|
+
};
|
2227
|
+
|
2228
|
+
HTML.prototype.reportRunnerResults = function() {
|
2229
|
+
if (!this.total.run) {
|
2230
|
+
return;
|
2231
|
+
}
|
2232
|
+
this.setText("stats-duration", this.elapsedTime());
|
2233
|
+
if (!this.total.failures) {
|
2234
|
+
this.setStatus("passed");
|
2235
|
+
}
|
2236
|
+
this.setText("stats-passes", this.total.passes);
|
2237
|
+
this.setText("stats-failures", this.total.failures);
|
2238
|
+
if (this.total.run < this.total.exist) {
|
2239
|
+
this.total.skipped = this.total.exist - this.total.run;
|
2240
|
+
this.total.run = this.total.exist;
|
2241
|
+
}
|
2242
|
+
this.setText("stats-skipped", this.total.skipped);
|
2243
|
+
return this.updateProgress();
|
2244
|
+
};
|
2245
|
+
|
2246
|
+
HTML.prototype.elapsedTime = function() {
|
2247
|
+
return "" + (((new Teabag.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
|
2248
|
+
};
|
2249
|
+
|
2250
|
+
HTML.prototype.updateStat = function(name, value) {
|
2251
|
+
if (!this.config["display-progress"]) {
|
2252
|
+
return;
|
2253
|
+
}
|
2254
|
+
return this.setText("stats-" + name, value);
|
2255
|
+
};
|
2256
|
+
|
2257
|
+
HTML.prototype.updateStatus = function(spec) {
|
2258
|
+
var elapsed, result, _ref, _ref1;
|
2259
|
+
spec = new Teabag.Spec(spec);
|
2260
|
+
result = spec.result();
|
2261
|
+
if (result.skipped || result.status === "pending") {
|
2262
|
+
this.updateStat("skipped", this.total.skipped += 1);
|
2263
|
+
return;
|
2264
|
+
}
|
2265
|
+
elapsed = new Teabag.Date().getTime() - this.specStart;
|
2266
|
+
if (result.status === "passed") {
|
2267
|
+
this.updateStat("passes", this.total.passes += 1);
|
2268
|
+
return (_ref = this.reportView) != null ? _ref.updateState("passed", elapsed) : void 0;
|
2269
|
+
} else {
|
2270
|
+
this.updateStat("failures", this.total.failures += 1);
|
2271
|
+
if ((_ref1 = this.reportView) != null) {
|
2272
|
+
_ref1.updateState("failed", elapsed);
|
2273
|
+
}
|
2274
|
+
if (!this.config["build-full-report"]) {
|
2275
|
+
new Teabag.Reporters.HTML.FailureView(spec).appendTo(this.findEl("report-failures"));
|
2276
|
+
}
|
2277
|
+
return this.setStatus("failed");
|
2278
|
+
}
|
2279
|
+
};
|
2280
|
+
|
2281
|
+
HTML.prototype.updateProgress = function() {
|
2282
|
+
return this.progress.update(this.total.exist, this.total.run);
|
2283
|
+
};
|
2284
|
+
|
2285
|
+
HTML.prototype.showConfiguration = function() {
|
2286
|
+
var key, value, _ref, _results;
|
2287
|
+
_ref = this.config;
|
2288
|
+
_results = [];
|
2289
|
+
for (key in _ref) {
|
2290
|
+
value = _ref[key];
|
2291
|
+
_results.push(this.setClass(key, value ? "active" : ""));
|
2292
|
+
}
|
2293
|
+
return _results;
|
2294
|
+
};
|
2295
|
+
|
2296
|
+
HTML.prototype.setStatus = function(status) {
|
2297
|
+
return document.body.className = "teabag-" + status;
|
2298
|
+
};
|
2299
|
+
|
2300
|
+
HTML.prototype.setFilter = function(filter) {
|
2301
|
+
if (!filter) {
|
2302
|
+
return;
|
2303
|
+
}
|
2304
|
+
this.setClass("filtered", "teabag-filtered");
|
2305
|
+
return this.setHtml("filtered", "" + filter, true);
|
2306
|
+
};
|
2307
|
+
|
2308
|
+
HTML.prototype.readConfig = function() {
|
2309
|
+
var config;
|
2310
|
+
if (config = this.cookie("teabag")) {
|
2311
|
+
return this.config = config;
|
2312
|
+
}
|
2313
|
+
};
|
2314
|
+
|
2315
|
+
HTML.prototype.toggleConfig = function(e) {
|
2316
|
+
var button, name;
|
2317
|
+
button = e.target;
|
2318
|
+
if (button.tagName.toLowerCase() !== "button") {
|
2319
|
+
return;
|
2320
|
+
}
|
2321
|
+
name = button.getAttribute("id").replace(/^teabag-/, "");
|
2322
|
+
this.config[name] = !this.config[name];
|
2323
|
+
this.cookie("teabag", this.config);
|
2324
|
+
return this.refresh();
|
2325
|
+
};
|
2326
|
+
|
2327
|
+
HTML.prototype.refresh = function() {
|
2328
|
+
return window.location.href = window.location.href;
|
2329
|
+
};
|
2330
|
+
|
2331
|
+
HTML.prototype.cookie = function(name, value) {
|
2332
|
+
var date, match;
|
2333
|
+
if (value == null) {
|
2334
|
+
value = void 0;
|
2335
|
+
}
|
2336
|
+
if (value === void 0) {
|
2337
|
+
name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
|
2338
|
+
match = document.cookie.match(new RegExp("(?:^|;)\\s?" + name + "=(.*?)(?:;|$)", "i"));
|
2339
|
+
return match && JSON.parse(unescape(match[1]).split(" ")[0]);
|
2340
|
+
} else {
|
2341
|
+
date = new Teabag.Date();
|
2342
|
+
date.setDate(date.getDate() + 365);
|
2343
|
+
return document.cookie = "" + name + "=" + (escape(JSON.stringify(value))) + "; path=\"/\"; expires=" + (date.toUTCString()) + ";";
|
2344
|
+
}
|
2345
|
+
};
|
2346
|
+
|
2347
|
+
return HTML;
|
2348
|
+
|
2349
|
+
})(Teabag.Reporters.BaseView);
|
2350
|
+
|
2351
|
+
}).call(this);
|
2352
|
+
(function() {
|
2353
|
+
var __hasProp = {}.hasOwnProperty,
|
2354
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2355
|
+
|
2356
|
+
Teabag.Reporters.HTML.ProgressView = (function(_super) {
|
2357
|
+
|
2358
|
+
__extends(ProgressView, _super);
|
2359
|
+
|
2360
|
+
function ProgressView() {
|
2361
|
+
return ProgressView.__super__.constructor.apply(this, arguments);
|
2362
|
+
}
|
2363
|
+
|
2364
|
+
ProgressView.create = function(displayProgress) {
|
2365
|
+
if (displayProgress == null) {
|
2366
|
+
displayProgress = true;
|
2367
|
+
}
|
2368
|
+
if (!displayProgress) {
|
2369
|
+
return new Teabag.Reporters.HTML.ProgressView();
|
2370
|
+
}
|
2371
|
+
if (Teabag.Reporters.HTML.RadialProgressView.supported) {
|
2372
|
+
return new Teabag.Reporters.HTML.RadialProgressView();
|
2373
|
+
} else {
|
2374
|
+
return Teabag.Reporters.HTML.SimpleProgressView();
|
2375
|
+
}
|
2376
|
+
};
|
2377
|
+
|
2378
|
+
ProgressView.prototype.build = function() {
|
2379
|
+
return this.el = this.createEl("div", "teabag-indicator modeset-logo");
|
2380
|
+
};
|
2381
|
+
|
2382
|
+
ProgressView.prototype.update = function() {};
|
2383
|
+
|
2384
|
+
return ProgressView;
|
2385
|
+
|
2386
|
+
})(Teabag.Reporters.BaseView);
|
2387
|
+
|
2388
|
+
Teabag.Reporters.HTML.SimpleProgressView = (function(_super) {
|
2389
|
+
|
2390
|
+
__extends(SimpleProgressView, _super);
|
2391
|
+
|
2392
|
+
function SimpleProgressView() {
|
2393
|
+
return SimpleProgressView.__super__.constructor.apply(this, arguments);
|
2394
|
+
}
|
2395
|
+
|
2396
|
+
SimpleProgressView.prototype.build = function() {
|
2397
|
+
this.el = this.createEl("div", "simple-progress");
|
2398
|
+
return this.el.innerHTML = "<em id=\"teabag-progress-percent\">0%</em>\n<span id=\"teabag-progress-span\" class=\"teabag-indicator\"></span>";
|
2399
|
+
};
|
2400
|
+
|
2401
|
+
SimpleProgressView.prototype.update = function(total, run) {
|
2402
|
+
var percent;
|
2403
|
+
percent = total ? Math.ceil((run * 100) / total) : 0;
|
2404
|
+
return this.setHtml("progress-percent", "" + percent + "%");
|
2405
|
+
};
|
2406
|
+
|
2407
|
+
return SimpleProgressView;
|
2408
|
+
|
2409
|
+
})(Teabag.Reporters.HTML.ProgressView);
|
2410
|
+
|
2411
|
+
Teabag.Reporters.HTML.RadialProgressView = (function(_super) {
|
2412
|
+
|
2413
|
+
__extends(RadialProgressView, _super);
|
2414
|
+
|
2415
|
+
function RadialProgressView() {
|
2416
|
+
return RadialProgressView.__super__.constructor.apply(this, arguments);
|
2417
|
+
}
|
2418
|
+
|
2419
|
+
RadialProgressView.supported = !!document.createElement("canvas").getContext;
|
2420
|
+
|
2421
|
+
RadialProgressView.prototype.build = function() {
|
2422
|
+
this.el = this.createEl("div", "teabag-indicator radial-progress");
|
2423
|
+
return this.el.innerHTML = "<canvas id=\"teabag-progress-canvas\"></canvas>\n<em id=\"teabag-progress-percent\">0%</em>";
|
2424
|
+
};
|
2425
|
+
|
2426
|
+
RadialProgressView.prototype.appendTo = function() {
|
2427
|
+
var canvas;
|
2428
|
+
RadialProgressView.__super__.appendTo.apply(this, arguments);
|
2429
|
+
this.size = 80;
|
2430
|
+
try {
|
2431
|
+
canvas = this.findEl("progress-canvas");
|
2432
|
+
canvas.width = canvas.height = canvas.style.width = canvas.style.height = this.size;
|
2433
|
+
this.ctx = canvas.getContext("2d");
|
2434
|
+
this.ctx.strokeStyle = "#fff";
|
2435
|
+
return this.ctx.lineWidth = 1.5;
|
2436
|
+
} catch (e) {
|
2437
|
+
|
2438
|
+
}
|
2439
|
+
};
|
2440
|
+
|
2441
|
+
RadialProgressView.prototype.update = function(total, run) {
|
2442
|
+
var half, percent;
|
2443
|
+
percent = total ? Math.ceil((run * 100) / total) : 0;
|
2444
|
+
this.setHtml("progress-percent", "" + percent + "%");
|
2445
|
+
if (!this.ctx) {
|
2446
|
+
return;
|
2447
|
+
}
|
2448
|
+
half = this.size / 2;
|
2449
|
+
this.ctx.clearRect(0, 0, this.size, this.size);
|
2450
|
+
this.ctx.beginPath();
|
2451
|
+
this.ctx.arc(half, half, half - 1, 0, Math.PI * 2 * (percent / 100), false);
|
2452
|
+
return this.ctx.stroke();
|
2453
|
+
};
|
2454
|
+
|
2455
|
+
return RadialProgressView;
|
2456
|
+
|
2457
|
+
})(Teabag.Reporters.HTML.ProgressView);
|
2458
|
+
|
2459
|
+
}).call(this);
|
2460
|
+
(function() {
|
2461
|
+
var __hasProp = {}.hasOwnProperty,
|
2462
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2463
|
+
|
2464
|
+
Teabag.Reporters.HTML.SpecView = (function(_super) {
|
2465
|
+
var viewId;
|
2466
|
+
|
2467
|
+
__extends(SpecView, _super);
|
2468
|
+
|
2469
|
+
viewId = 0;
|
2470
|
+
|
2471
|
+
function SpecView(spec, reporter) {
|
2472
|
+
this.spec = spec;
|
2473
|
+
this.reporter = reporter;
|
2474
|
+
this.views = this.reporter.views;
|
2475
|
+
this.spec.viewId = viewId += 1;
|
2476
|
+
this.views.specs[this.spec.viewId] = this;
|
2477
|
+
SpecView.__super__.constructor.apply(this, arguments);
|
2478
|
+
}
|
2479
|
+
|
2480
|
+
SpecView.prototype.build = function() {
|
2481
|
+
var classes;
|
2482
|
+
classes = ["spec"];
|
2483
|
+
if (this.spec.pending) {
|
2484
|
+
classes.push("state-pending");
|
2485
|
+
}
|
2486
|
+
SpecView.__super__.build.call(this, classes.join(" "));
|
2487
|
+
this.el.innerHTML = "<a href=\"" + this.spec.link + "\">" + this.spec.description + "</a>";
|
2488
|
+
this.parentView = this.buildParent();
|
2489
|
+
return this.parentView.append(this.el);
|
2490
|
+
};
|
2491
|
+
|
2492
|
+
SpecView.prototype.buildParent = function() {
|
2493
|
+
var parent, view;
|
2494
|
+
parent = this.spec.parent;
|
2495
|
+
if (parent.viewId) {
|
2496
|
+
return this.views.suites[parent.viewId];
|
2497
|
+
} else {
|
2498
|
+
view = new Teabag.Reporters.HTML.SuiteView(parent, this.reporter);
|
2499
|
+
return this.views.suites[view.suite.viewId] = view;
|
2500
|
+
}
|
2501
|
+
};
|
2502
|
+
|
2503
|
+
SpecView.prototype.buildErrors = function() {
|
2504
|
+
var div, error, html, _i, _len, _ref;
|
2505
|
+
div = this.createEl("div");
|
2506
|
+
html = "";
|
2507
|
+
_ref = this.spec.errors();
|
2508
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2509
|
+
error = _ref[_i];
|
2510
|
+
html += "" + (this.htmlSafe(error.stack || error.message || "Stack trace unavailable"));
|
2511
|
+
}
|
2512
|
+
div.innerHTML = html;
|
2513
|
+
return this.append(div);
|
2514
|
+
};
|
2515
|
+
|
2516
|
+
SpecView.prototype.updateState = function(state, elapsed) {
|
2517
|
+
var classes, result, _base;
|
2518
|
+
result = this.spec.result();
|
2519
|
+
classes = ["state-" + state];
|
2520
|
+
if (elapsed > Teabag.slow) {
|
2521
|
+
classes.push("slow");
|
2522
|
+
}
|
2523
|
+
if (state !== "failed") {
|
2524
|
+
this.el.innerHTML += "<span>" + elapsed + "ms</span>";
|
2525
|
+
}
|
2526
|
+
this.el.className = classes.join(" ");
|
2527
|
+
if (result.status !== "passed") {
|
2528
|
+
this.buildErrors();
|
2529
|
+
}
|
2530
|
+
return typeof (_base = this.parentView).updateState === "function" ? _base.updateState(state) : void 0;
|
2531
|
+
};
|
2532
|
+
|
2533
|
+
return SpecView;
|
2534
|
+
|
2535
|
+
})(Teabag.Reporters.BaseView);
|
2536
|
+
|
2537
|
+
}).call(this);
|
2538
|
+
(function() {
|
2539
|
+
var __hasProp = {}.hasOwnProperty,
|
2540
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2541
|
+
|
2542
|
+
Teabag.Reporters.HTML.FailureView = (function(_super) {
|
2543
|
+
|
2544
|
+
__extends(FailureView, _super);
|
2545
|
+
|
2546
|
+
function FailureView(spec) {
|
2547
|
+
this.spec = spec;
|
2548
|
+
FailureView.__super__.constructor.apply(this, arguments);
|
2549
|
+
}
|
2550
|
+
|
2551
|
+
FailureView.prototype.build = function() {
|
2552
|
+
var error, html, _i, _len, _ref;
|
2553
|
+
FailureView.__super__.build.call(this, "spec");
|
2554
|
+
html = "<h1 class=\"teabag-clearfix\"><a href=\"" + this.spec.link + "\">" + this.spec.fullDescription + "</a></h1>";
|
2555
|
+
_ref = this.spec.errors();
|
2556
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2557
|
+
error = _ref[_i];
|
2558
|
+
html += "<div>" + (this.htmlSafe(error.stack || error.message || "Stack trace unavailable")) + "</div>";
|
2559
|
+
}
|
2560
|
+
return this.el.innerHTML = html;
|
2561
|
+
};
|
2562
|
+
|
2563
|
+
return FailureView;
|
2564
|
+
|
2565
|
+
})(Teabag.Reporters.BaseView);
|
2566
|
+
|
2567
|
+
}).call(this);
|
2568
|
+
(function() {
|
2569
|
+
var __hasProp = {}.hasOwnProperty,
|
2570
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2571
|
+
|
2572
|
+
Teabag.Reporters.HTML.SuiteView = (function(_super) {
|
2573
|
+
var viewId;
|
2574
|
+
|
2575
|
+
__extends(SuiteView, _super);
|
2576
|
+
|
2577
|
+
viewId = 0;
|
2578
|
+
|
2579
|
+
function SuiteView(suite, reporter) {
|
2580
|
+
this.suite = suite;
|
2581
|
+
this.reporter = reporter;
|
2582
|
+
this.views = this.reporter.views;
|
2583
|
+
this.suite.viewId = viewId += 1;
|
2584
|
+
this.views.suites[this.suite.viewId] = this;
|
2585
|
+
this.suite = new Teabag.Suite(suite);
|
2586
|
+
SuiteView.__super__.constructor.apply(this, arguments);
|
2587
|
+
}
|
2588
|
+
|
2589
|
+
SuiteView.prototype.build = function() {
|
2590
|
+
SuiteView.__super__.build.call(this, "suite");
|
2591
|
+
this.el.innerHTML = "<h1><a href=\"" + this.suite.link + "\">" + this.suite.description + "</a></h1>";
|
2592
|
+
this.parentView = this.buildParent();
|
2593
|
+
return this.parentView.append(this.el);
|
2594
|
+
};
|
2595
|
+
|
2596
|
+
SuiteView.prototype.buildParent = function() {
|
2597
|
+
var parent, view;
|
2598
|
+
parent = this.suite.parent;
|
2599
|
+
if (!parent) {
|
2600
|
+
return this.reporter;
|
2601
|
+
}
|
2602
|
+
if (parent.viewId) {
|
2603
|
+
return this.views.suites[parent.viewId];
|
2604
|
+
} else {
|
2605
|
+
view = new Teabag.Reporters.HTML.SuiteView(parent, this.reporter);
|
2606
|
+
return this.views.suites[view.suite.viewId] = view;
|
2607
|
+
}
|
2608
|
+
};
|
2609
|
+
|
2610
|
+
SuiteView.prototype.append = function(el) {
|
2611
|
+
if (!this.ol) {
|
2612
|
+
SuiteView.__super__.append.call(this, this.ol = this.createEl("ol"));
|
2613
|
+
}
|
2614
|
+
return this.ol.appendChild(el);
|
2615
|
+
};
|
2616
|
+
|
2617
|
+
SuiteView.prototype.updateState = function(state) {
|
2618
|
+
var _base;
|
2619
|
+
if (this.state === "failed") {
|
2620
|
+
return;
|
2621
|
+
}
|
2622
|
+
this.el.className = "" + (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
|
2623
|
+
if (typeof (_base = this.parentView).updateState === "function") {
|
2624
|
+
_base.updateState(state);
|
2625
|
+
}
|
2626
|
+
return this.state = state;
|
2627
|
+
};
|
2628
|
+
|
2629
|
+
return SuiteView;
|
2630
|
+
|
2631
|
+
})(Teabag.Reporters.BaseView);
|
2632
|
+
|
2633
|
+
}).call(this);
|
2634
|
+
(function() {
|
2635
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
2636
|
+
|
2637
|
+
Teabag.Reporters.Console = (function() {
|
2638
|
+
|
2639
|
+
function Console() {
|
2640
|
+
this.reportRunnerResults = __bind(this.reportRunnerResults, this);
|
2641
|
+
this.start = new Teabag.Date();
|
2642
|
+
this.suites = {};
|
2643
|
+
}
|
2644
|
+
|
2645
|
+
Console.prototype.reportRunnerStarting = function(runner) {
|
2646
|
+
return this.log({
|
2647
|
+
type: "runner",
|
2648
|
+
total: runner.total || runner.specs().length,
|
2649
|
+
start: JSON.parse(JSON.stringify(this.start))
|
2650
|
+
});
|
2651
|
+
};
|
2652
|
+
|
2653
|
+
Console.prototype.reportSuites = function() {
|
2654
|
+
var index, suite, _i, _len, _ref, _results;
|
2655
|
+
_ref = this.spec.getParents();
|
2656
|
+
_results = [];
|
2657
|
+
for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {
|
2658
|
+
suite = _ref[index];
|
2659
|
+
if (this.suites[suite.fullDescription]) {
|
2660
|
+
continue;
|
2661
|
+
}
|
2662
|
+
this.suites[suite.fullDescription] = true;
|
2663
|
+
_results.push(this.log({
|
2664
|
+
type: "suite",
|
2665
|
+
label: suite.description,
|
2666
|
+
level: index
|
2667
|
+
}));
|
2668
|
+
}
|
2669
|
+
return _results;
|
2670
|
+
};
|
2671
|
+
|
2672
|
+
Console.prototype.reportSpecResults = function(spec) {
|
2673
|
+
var result;
|
2674
|
+
this.spec = new Teabag.Spec(spec);
|
2675
|
+
result = this.spec.result();
|
2676
|
+
this.reportSuites();
|
2677
|
+
switch (result.status) {
|
2678
|
+
case "pending":
|
2679
|
+
return this.trackPending();
|
2680
|
+
case "failed":
|
2681
|
+
return this.trackFailure();
|
2682
|
+
default:
|
2683
|
+
return this.log({
|
2684
|
+
type: "spec",
|
2685
|
+
suite: this.spec.suiteName,
|
2686
|
+
label: this.spec.description,
|
2687
|
+
status: result.status,
|
2688
|
+
skipped: result.skipped
|
2689
|
+
});
|
2690
|
+
}
|
2691
|
+
};
|
2692
|
+
|
2693
|
+
Console.prototype.trackPending = function() {
|
2694
|
+
var result;
|
2695
|
+
result = this.spec.result();
|
2696
|
+
return this.log({
|
2697
|
+
type: "spec",
|
2698
|
+
suite: this.spec.suiteName,
|
2699
|
+
label: this.spec.description,
|
2700
|
+
status: result.status,
|
2701
|
+
skipped: result.skipped
|
2702
|
+
});
|
2703
|
+
};
|
2704
|
+
|
2705
|
+
Console.prototype.trackFailure = function() {
|
2706
|
+
var error, result, _i, _len, _ref, _results;
|
2707
|
+
result = this.spec.result();
|
2708
|
+
_ref = this.spec.errors();
|
2709
|
+
_results = [];
|
2710
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2711
|
+
error = _ref[_i];
|
2712
|
+
_results.push(this.log({
|
2713
|
+
type: "spec",
|
2714
|
+
suite: this.spec.suiteName,
|
2715
|
+
label: this.spec.description,
|
2716
|
+
status: result.status,
|
2717
|
+
skipped: result.skipped,
|
2718
|
+
link: this.spec.link,
|
2719
|
+
message: error.message,
|
2720
|
+
trace: error.stack || error.message || "Stack Trace Unavailable"
|
2721
|
+
}));
|
2722
|
+
}
|
2723
|
+
return _results;
|
2724
|
+
};
|
2725
|
+
|
2726
|
+
Console.prototype.reportRunnerResults = function() {
|
2727
|
+
this.log({
|
2728
|
+
type: "result",
|
2729
|
+
elapsed: ((new Teabag.Date().getTime() - this.start.getTime()) / 1000).toFixed(5)
|
2730
|
+
});
|
2731
|
+
return Teabag.finished = true;
|
2732
|
+
};
|
2733
|
+
|
2734
|
+
Console.prototype.log = function(obj) {
|
2735
|
+
if (obj == null) {
|
2736
|
+
obj = {};
|
2737
|
+
}
|
2738
|
+
obj["_teabag"] = true;
|
2739
|
+
return Teabag.log(JSON.stringify(obj));
|
2740
|
+
};
|
2741
|
+
|
2742
|
+
return Console;
|
2743
|
+
|
2744
|
+
})();
|
2745
|
+
|
2746
|
+
}).call(this);
|
2747
|
+
(function() {
|
2748
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
2749
|
+
__hasProp = {}.hasOwnProperty,
|
2750
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2751
|
+
|
2752
|
+
Teabag.Reporters.Console = (function(_super) {
|
2753
|
+
|
2754
|
+
__extends(Console, _super);
|
2755
|
+
|
2756
|
+
function Console(env) {
|
2757
|
+
this.reportSpecResults = __bind(this.reportSpecResults, this);
|
2758
|
+
Console.__super__.constructor.apply(this, arguments);
|
2759
|
+
env.log(this.reportSpecResults);
|
2760
|
+
env.testDone(this.reportSpecResults);
|
2761
|
+
env.done(this.reportRunnerResults);
|
2762
|
+
this.reportRunnerStarting();
|
2763
|
+
}
|
2764
|
+
|
2765
|
+
Console.prototype.reportRunnerStarting = function() {
|
2766
|
+
this.currentAssertions = [];
|
2767
|
+
return this.log({
|
2768
|
+
type: "runner",
|
2769
|
+
total: null,
|
2770
|
+
start: JSON.parse(JSON.stringify(this.start))
|
2771
|
+
});
|
2772
|
+
};
|
2773
|
+
|
2774
|
+
Console.prototype.reportSpecResults = function(result) {
|
2775
|
+
if (typeof result.total !== "number") {
|
2776
|
+
this.currentAssertions.push(result);
|
2777
|
+
return;
|
2778
|
+
}
|
2779
|
+
result.assertions = this.currentAssertions;
|
2780
|
+
this.currentAssertions = [];
|
2781
|
+
return Console.__super__.reportSpecResults.call(this, result);
|
2782
|
+
};
|
2783
|
+
|
2784
|
+
return Console;
|
2785
|
+
|
2786
|
+
})(Teabag.Reporters.Console);
|
2787
|
+
|
2788
|
+
}).call(this);
|
2789
|
+
(function() {
|
2790
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
2791
|
+
__hasProp = {}.hasOwnProperty,
|
2792
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2793
|
+
|
2794
|
+
Teabag.Reporters.HTML = (function(_super) {
|
2795
|
+
|
2796
|
+
__extends(HTML, _super);
|
2797
|
+
|
2798
|
+
function HTML(env) {
|
2799
|
+
this.reportRunnerResults = __bind(this.reportRunnerResults, this);
|
2800
|
+
|
2801
|
+
this.reportSpecResults = __bind(this.reportSpecResults, this);
|
2802
|
+
HTML.__super__.constructor.apply(this, arguments);
|
2803
|
+
env.log(this.reportSpecResults);
|
2804
|
+
env.testDone(this.reportSpecResults);
|
2805
|
+
env.done(this.reportRunnerResults);
|
2806
|
+
this.currentAssertions = [];
|
2807
|
+
this.reportRunnerStarting();
|
2808
|
+
}
|
2809
|
+
|
2810
|
+
HTML.prototype.reportRunnerStarting = function() {
|
2811
|
+
this.total.exist = null;
|
2812
|
+
return this.setText("stats-duration", "...");
|
2813
|
+
};
|
2814
|
+
|
2815
|
+
HTML.prototype.reportSpecResults = function(spec) {
|
2816
|
+
if (typeof spec.total !== "number") {
|
2817
|
+
this.currentAssertions.push(spec);
|
2818
|
+
return;
|
2819
|
+
}
|
2820
|
+
spec.assertions = this.currentAssertions;
|
2821
|
+
this.currentAssertions = [];
|
2822
|
+
this.reportSpecStarting(spec);
|
2823
|
+
return HTML.__super__.reportSpecResults.call(this, spec);
|
2824
|
+
};
|
2825
|
+
|
2826
|
+
HTML.prototype.reportRunnerResults = function(result) {
|
2827
|
+
this.total.exist = this.total.run = result.total;
|
2828
|
+
return HTML.__super__.reportRunnerResults.apply(this, arguments);
|
2829
|
+
};
|
2830
|
+
|
2831
|
+
HTML.prototype.readConfig = function() {
|
2832
|
+
HTML.__super__.readConfig.apply(this, arguments);
|
2833
|
+
return QUnit.config.notrycatch = this.config["use-catch"];
|
2834
|
+
};
|
2835
|
+
|
2836
|
+
HTML.prototype.envInfo = function() {
|
2837
|
+
return "qunit 1.10.0";
|
2838
|
+
};
|
2839
|
+
|
2840
|
+
return HTML;
|
2841
|
+
|
2842
|
+
})(Teabag.Reporters.HTML);
|
2843
|
+
|
2844
|
+
Teabag.Reporters.HTML.SpecView = (function(_super) {
|
2845
|
+
|
2846
|
+
__extends(SpecView, _super);
|
2847
|
+
|
2848
|
+
function SpecView() {
|
2849
|
+
return SpecView.__super__.constructor.apply(this, arguments);
|
2850
|
+
}
|
2851
|
+
|
2852
|
+
SpecView.prototype.buildErrors = function() {
|
2853
|
+
var div, error, html, _i, _len, _ref;
|
2854
|
+
div = this.createEl("div");
|
2855
|
+
html = "";
|
2856
|
+
_ref = this.spec.errors();
|
2857
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2858
|
+
error = _ref[_i];
|
2859
|
+
html += "<strong>" + error.message + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "<br/>";
|
2860
|
+
}
|
2861
|
+
div.innerHTML = html;
|
2862
|
+
return this.append(div);
|
2863
|
+
};
|
2864
|
+
|
2865
|
+
SpecView.prototype.buildParent = function() {
|
2866
|
+
var parent, view;
|
2867
|
+
parent = this.spec.parent;
|
2868
|
+
if (this.views.suites[parent.description]) {
|
2869
|
+
return this.views.suites[parent.description];
|
2870
|
+
} else {
|
2871
|
+
view = new Teabag.Reporters.HTML.SuiteView(parent, this.reporter);
|
2872
|
+
return this.views.suites[parent.description] = view;
|
2873
|
+
}
|
2874
|
+
};
|
2875
|
+
|
2876
|
+
return SpecView;
|
2877
|
+
|
2878
|
+
})(Teabag.Reporters.HTML.SpecView);
|
2879
|
+
|
2880
|
+
Teabag.Reporters.HTML.FailureView = (function(_super) {
|
2881
|
+
|
2882
|
+
__extends(FailureView, _super);
|
2883
|
+
|
2884
|
+
function FailureView() {
|
2885
|
+
return FailureView.__super__.constructor.apply(this, arguments);
|
2886
|
+
}
|
2887
|
+
|
2888
|
+
FailureView.prototype.build = function() {
|
2889
|
+
var error, html, _i, _len, _ref;
|
2890
|
+
FailureView.__super__.build.call(this, "spec");
|
2891
|
+
html = "<h1 class=\"teabag-clearfix\"><a href=\"" + this.spec.link + "\">" + this.spec.fullDescription + "</a></h1>";
|
2892
|
+
_ref = this.spec.errors();
|
2893
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2894
|
+
error = _ref[_i];
|
2895
|
+
html += "<div><strong>" + error.message + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
|
2896
|
+
}
|
2897
|
+
return this.el.innerHTML = html;
|
2898
|
+
};
|
2899
|
+
|
2900
|
+
return FailureView;
|
2901
|
+
|
2902
|
+
})(Teabag.Reporters.HTML.FailureView);
|
2903
|
+
|
2904
|
+
Teabag.Reporters.HTML.SuiteView = (function(_super) {
|
2905
|
+
|
2906
|
+
__extends(SuiteView, _super);
|
2907
|
+
|
2908
|
+
function SuiteView(suite, reporter) {
|
2909
|
+
this.suite = suite;
|
2910
|
+
this.reporter = reporter;
|
2911
|
+
this.views = this.reporter.views;
|
2912
|
+
this.views.suites[this.suite.description] = this;
|
2913
|
+
this.build();
|
2914
|
+
}
|
2915
|
+
|
2916
|
+
return SuiteView;
|
2917
|
+
|
2918
|
+
})(Teabag.Reporters.HTML.SuiteView);
|
2919
|
+
|
2920
|
+
}).call(this);
|
2921
|
+
(function() {
|
2922
|
+
var __hasProp = {}.hasOwnProperty,
|
2923
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2924
|
+
|
2925
|
+
Teabag.Runner = (function(_super) {
|
2926
|
+
var env;
|
2927
|
+
|
2928
|
+
__extends(Runner, _super);
|
2929
|
+
|
2930
|
+
env = QUnit;
|
2931
|
+
|
2932
|
+
env.config.autostart = false;
|
2933
|
+
|
2934
|
+
env.config.altertitle = false;
|
2935
|
+
|
2936
|
+
function Runner() {
|
2937
|
+
Runner.__super__.constructor.apply(this, arguments);
|
2938
|
+
env.start();
|
2939
|
+
}
|
2940
|
+
|
2941
|
+
Runner.prototype.setup = function() {
|
2942
|
+
var reporter;
|
2943
|
+
reporter = new (this.getReporter())(env);
|
2944
|
+
return typeof reporter.setFilter === "function" ? reporter.setFilter(this.params["grep"]) : void 0;
|
2945
|
+
};
|
2946
|
+
|
2947
|
+
return Runner;
|
2948
|
+
|
2949
|
+
})(Teabag.Runner);
|
2950
|
+
|
2951
|
+
Teabag.Spec = (function() {
|
2952
|
+
|
2953
|
+
function Spec(spec) {
|
2954
|
+
this.spec = spec;
|
2955
|
+
this.fullDescription = "" + this.spec.module + " " + this.spec.name;
|
2956
|
+
this.description = "" + this.spec.name + " (" + this.spec.failed + ", " + this.spec.passed + ", " + this.spec.total + ")";
|
2957
|
+
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
2958
|
+
this.parent = this.spec.module ? new Teabag.Suite({
|
2959
|
+
description: this.spec.module
|
2960
|
+
}) : null;
|
2961
|
+
this.suiteName = this.spec.module;
|
2962
|
+
this.viewId = this.spec.viewId;
|
2963
|
+
this.pending = false;
|
2964
|
+
}
|
2965
|
+
|
2966
|
+
Spec.prototype.errors = function() {
|
2967
|
+
var item, _i, _len, _ref, _results;
|
2968
|
+
if (!this.spec.failed) {
|
2969
|
+
return [];
|
2970
|
+
}
|
2971
|
+
_ref = this.spec.assertions;
|
2972
|
+
_results = [];
|
2973
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2974
|
+
item = _ref[_i];
|
2975
|
+
if (item.result) {
|
2976
|
+
continue;
|
2977
|
+
}
|
2978
|
+
_results.push({
|
2979
|
+
message: item.message,
|
2980
|
+
stack: item.source
|
2981
|
+
});
|
2982
|
+
}
|
2983
|
+
return _results;
|
2984
|
+
};
|
2985
|
+
|
2986
|
+
Spec.prototype.getParents = function() {
|
2987
|
+
if (!this.parent) {
|
2988
|
+
return [];
|
2989
|
+
}
|
2990
|
+
return [this.parent];
|
2991
|
+
};
|
2992
|
+
|
2993
|
+
Spec.prototype.result = function() {
|
2994
|
+
var status;
|
2995
|
+
status = "failed";
|
2996
|
+
if (!this.spec.failed) {
|
2997
|
+
status = "passed";
|
2998
|
+
}
|
2999
|
+
return {
|
3000
|
+
status: status,
|
3001
|
+
skipped: false
|
3002
|
+
};
|
3003
|
+
};
|
3004
|
+
|
3005
|
+
return Spec;
|
3006
|
+
|
3007
|
+
})();
|
3008
|
+
|
3009
|
+
Teabag.Suite = (function() {
|
3010
|
+
|
3011
|
+
function Suite(suite) {
|
3012
|
+
this.suite = suite;
|
3013
|
+
this.fullDescription = this.suite.description;
|
3014
|
+
this.description = this.suite.description;
|
3015
|
+
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
3016
|
+
this.parent = null;
|
3017
|
+
}
|
3018
|
+
|
3019
|
+
return Suite;
|
3020
|
+
|
3021
|
+
})();
|
3022
|
+
|
3023
|
+
}).call(this);
|