netzke-testing 1.0.0.0.pre → 1.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +15 -13
- data/app/assets/javascripts/netzke/testing/expect/expect.js +80 -48
- data/app/assets/javascripts/netzke/testing/helpers/actions.js.coffee +2 -3
- data/app/assets/javascripts/netzke/testing/helpers/expectations.js.coffee +9 -5
- data/app/assets/javascripts/netzke/testing/mocha/mocha.js +8411 -2527
- data/lib/netzke/testing/helpers.rb +4 -4
- data/lib/netzke/testing/version.rb +1 -1
- data/spec/rails_app/log/test.log +94 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/-o-YaVl0T7eDJ9OrOV9RGwqVsIWZFHy_ANOiYAzd5xs.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/07iOyrEomMGnZKLKBODn5NGKubEAwYg22zHsJOJLqGs.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/0ytTgUbUdaNC4f2HwTF9KPoNfEPoelbdxEEonmXcFY8.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/1fidLos4TsMC1Jzat66F4EuJMnvA4Ek4Yq3Wx_diqLA.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/2vHlMhGtlMaZb82omedAl26ALVO0Fkpnzrs2A0t0dhQ.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/39zPPJcr0tE1H4qUKdVLTgBn95i3CcWTw7iIySpP6cs.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/3zmYCO5dspDitWP7JYhr__7BgKz1CVbO5G5II9Glh9Q.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/4_18vLnsZaNqO4dzM3KZwlOI_W46PV3HB7wQnYnmFcQ.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/5GrPnQc9e0-MX1Gp22so31KMZYHH0py0br_lgFkZ_kI.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/5dJ6VNUb4OFNV6u-YrjcCBnPJuR9tf9hL3s_faXrBP0.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/6Hb98UcW0wjj_i_HD2j2tX9E_IWDhUs7jytk9bRWTD4.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/9EFnUGe2JNSgdn0_guGDgGlzN9fSRTV-LUCHI9Np3m0.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/9rQm4rWb6Fyy0YNY6qIn3Klwh-E-riSs3vJu81_Gyto.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/ALdwNICuA37_nmLiqc8RMqu61rCn_g8j-_jvCtDZIM0.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/BT0NlH5e-SMXSFoONZqKAfPuxkCaZq9t03GG-tbqf2A.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Bl29XyeX1cHzQPc9fI44GTuVcxQL6XfPJVt_GX6lhzo.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/CeuWmVqZWhwboK9KGiK-VGwtZYLrqCRI93rvJQIBTXs.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/D_M27jz_Y2ZtpKgI0NLbeaMjjW-dnm5H-q6vlb9Cgdc.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/DyZ-otksXNhNzMmBzaVD-I26JqXpFnAAHKDNiDm0AnA.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/FXVz3Pwk3Lx2AlWWo3N60Q7YFpQ09dRh1TrauXneQAA.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Gr8ZzR4L-gtkpAh9nM59jAeEZdyf-OdokQaWCec_INo.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/H09-6S0HJW5eYPA2z1phpE0atkN0CGHs1N_3NeX1vg0.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/HqBAFMrJkSiiEp7NwTEVCY6TfMEq6uCsOyT4hkxQzl0.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/LLDmKhbry6kmwl-luJ7zqH0EpQzgmXaiphllEglzBPY.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/L_-HXUTuvz1fj3rSHaqPaaqmdrcKL_nAjJjFRYsCKns.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/N2bgPvor8Oc-6ruUenJnq3JCgXTFOxboIXy77NtSpn4.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/NOfTwd49eb86ANBlpdBndMO4ImhsuP1GRpxDAgwAfx4.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/OMy74nraRyab7NpwdTKgIcT71Nor8p3vccpmPY9JFVg.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Q7419vAxXSvXRDjq-scnxsPHd0HadXBzkG4xsnYq9Qs.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/QHDu6s3NsziHdqvv8bty6Ez-fJ32BUsSh-cTb1jMwew.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/QW--4tkWOk_XF1gyoYZDRCyDehMpmnuVayrZKMVqZ7M.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Qil2vZGP6D36sK3wv91KnVKtRUrj6cr1QQskelyTk9Y.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/RBIGkPIcm4EWMEbCxZN202ZnpKF-q7vmu9Wd1d2KBCg.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/REXd2v4jF9rojlxSTKezbfWQHrV0h16YKzAyEyJFWEM.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Rzez3kkE4eNMtC1yya3kzO7BXS6d7LAAKDMPkxOuG_0.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/ScFPNKnHQisSmiOxG1guWdIbbXilNmOQhME5BDwNiv4.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Ui7uJXKUZafSM-Pg057JUmpEm6b1W8Nv-0yn3fz3xZ0.cache +106 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/Uz0vobQn_2cof5CLzZsjRzJWBGzGfa3a9ouwXy2FjC4.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/W6Eph3scwYK-6sdVKmEL27OnPYBnKiP8kmH8bCHCsJA.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/WPeLjGJ9cBoHaKcawtXwNU9UEiNKXtjT6if7aDyJ-iE.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/YLGNWWpHA4nUart3qBGUKfKtjEfDi6XBOOmqOM2dwsY.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/YWY4C1elKF3eYF9e4lGmKJ8Mlw7w-fDkMF5zkR_DOHU.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/_F-1UKfUa2G5bFoBdU02i5zBUtpiYzqiMUnu0QU5ePY.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/_PrGVuJb9IMfw0jLcId6JwfiXGtsgrKsYvQ_oFFvnpg.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/aEe8dZBMoJN_L7dQ9O90etuJwhYBZaxRLXPLkI4lwXU.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/aIoqzJKq3BKLPn0NJ80EsPM54p1fTGdEaS1LhASLplY.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/azdeIsF9HPA4WivyJx01EAdzHHXs1UJ6Pu8SOb2Ex0E.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/bigAjWfxtrTpxpryFTjOzuZDpQN1TQn2LgyC2UX608A.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/cC4aVV6WxpZQ1JV9tiqJ7c1SHial-X4fXVKIL_0cSNk.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/codNO61Rpx13n_h4WzazQzWJbqM2w7xTmJBkRVGASrE.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/dffd5W19TVYHR7lYQ0z0g1-48SLMJ8w-3bcHGKSvk08.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/eGYqHx1cCGAuRnisa20DTioHGAdMqGSeYY4IeG4Aq18.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/fOMwhE_LoK6PBz43rr86imRHqStpfn-j0zKwNCEFA7A.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/i4_Ww4zBhRbFxc9qsCIEWpRilLf1e0Z6XnnWNP6aDk4.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/iJJjYfLFaJGOB1qhv6XaJXbg6cr-dXZT3m6NbIKJevw.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/j0GxKFTTXVLhgLP0leVrUzi9J5Vk0iv5I3Etnvf1hKo.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/jUcv_4GPi-D5jFNvcEkNKl60eXmJV3voiuFymwpMEZc.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/jm7Gb16iEsab2-4biVjNid9a3ke7Hsf5sazXIGeh2AA.cache +2 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/lQyPIDuSoqpRLpSFgmdv8Rps26WUfL-WnrGh8X1QrZk.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/ldEt04XepuHp4zFw0wvm2tmp7PHzbvoMqE0dMgHHyiM.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/ll77fKHQUerwje4lfYSqXNfr3bbSm72YVxIeBEmyppc.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/mLQH-sbNxQ8DaRts0YE737TG8kOVWTVCss14WfPAZ7g.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/moNLOTsHz0Ydgt_tVujBaPpE86MfBSWgb6Epm6bsPqY.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/nONU3x7H75eQ2Xaw3GMC0pKEWPyMtRxMJ9Y-l0Ayq6M.cache +33 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/o-8a91fGF4bF1Mo6fJYIzosTQ-z0oMNGqELLH9S-GxM.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/piE6YVSIuBGMcd2x9kKYtpRLjB-sOJ2sdaeKIssE6wg.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/pp0d6Mo8UZHyEjp0aPeDYY5LE_QPXLXy8tioOcVQlkI.cache +3 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/rIo7JXnH6RylOxntf3nby_YI_Y3PtklcrYF_ZlbocTY.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/rdNEJjsX13ByMJoPOuPtykhHbAIZGrqz9xdWy9P4seI.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/sbkgYxjKRuP8wk525y6VBNm00JCRW3rELt3mRvcfhUo.cache +13 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/soD41VoXkrbH1EpLB28yGAgncKYlSlPzn2QG6FpLmTY.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/tOP7iXMW__b5nlhKzVYB6w2CqeCooG4O8M4B5dXqgSk.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/tlD3wYEmMzUG8rkcNz9GwHodH3fku_b240j895xS0Xw.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/tr62WvZYSb5NNmu1FPwoBQzTXhHF6e3PoixrqWHGK1I.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/ty1cXRpXqEnPYMFWKm8qVoLv1JkiOtT9BWTaSXoLI9c.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/vbftfVT4MTnYWfCL30aVfw2QofXiWvLUejwi11r_mPU.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/wKOMf-Sw5RV2z6tocysQ-Lp_WjC4AKfSftpnK9-CUcg.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/wisHDpCMSc22lTsGeee4BWwERbE5ZVWMsArIV1XI41g.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/wmPDgrxhKM3ep5L2Wpxxp0zjuvgNXYHKlFY7a8Cv_mY.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/xz5aZYcS9RYBKIAYIGo8NA6OJ0zS1A_2YUjm-5YEgX8.cache +0 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/yqnrYB_p9wjvOW9aTar8YP17tUVeKL0vv5gKw42K-xs.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/zVcdr4mnvtszU1y-2twwNb1pKNesauWRZEzeg8KuyI8.cache +1 -0
- data/spec/rails_app/tmp/cache/sprockets/v3.0/zqUk2pSqqUA61GTRQEHqzW2awxP7nrwKFq17PEgofBI.cache +2 -0
- data/spec/testing_controller_spec.rb +4 -4
- metadata +276 -110
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b58718443ad4b23a279f6226b5ef051d74b81ae
|
4
|
+
data.tar.gz: 87872368981f5412da05cb26474022f254b819f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6b0f9c04bcded978cae648bbb2f81e57c3cfb5def23fea10bca98c4e110817588007addb4c8b5ed396f014d7f1ee0595d27cc221dcd824486c3ada3bca2b6b7e
|
7
|
+
data.tar.gz: 617af0c8413a46ed46b5dc29174571c017c335a76d410b67801d10fc76834b13998e3f1d61c5a730fec4d2155176b214287070b818058eb5d86d445987a6c761
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -29,8 +29,7 @@ example spec may look like this (in `spec/features/javascripts/user_grid.js.coff
|
|
29
29
|
|
30
30
|
describe 'UserGrid', ->
|
31
31
|
it 'shows proper title', ->
|
32
|
-
grid
|
33
|
-
expect(grid.getHeader().title).to.eql 'Test component'
|
32
|
+
expect(grid().getHeader().title).to.eql 'Test component'
|
34
33
|
|
35
34
|
This spec can be run by appending the `spec` parameter to the url:
|
36
35
|
|
@@ -38,7 +37,7 @@ This spec can be run by appending the `spec` parameter to the url:
|
|
38
37
|
|
39
38
|
Specs can be structured into directories. For example, let's say we have a namescope for admin components:
|
40
39
|
|
41
|
-
class Admin::UserGrid < Netzke::
|
40
|
+
class Admin::UserGrid < Netzke::Grid::Base
|
42
41
|
end
|
43
42
|
|
44
43
|
It makes sense to put the corresponding specs in `spec/features/javascripts/admin/user_grid.js.coffee`. In this case,
|
@@ -111,9 +110,9 @@ helper provided by the `netzke_testing` gem. Here's an example (in `spec/user_gr
|
|
111
110
|
feature GridWithDestructiveButton do
|
112
111
|
it 'allows instant removing of all records with a single button click', js: true do
|
113
112
|
10.times { FactoryGirl.create :user }
|
114
|
-
User.count.
|
113
|
+
expect(User.count).to eql == 10
|
115
114
|
run_mocha_spec 'grid_with_destructive_button'
|
116
|
-
User.count.
|
115
|
+
expect(User.count).to eql == 0
|
117
116
|
end
|
118
117
|
end
|
119
118
|
|
@@ -150,12 +149,15 @@ However, keep in mind, that this won't have effect on running specs manually in
|
|
150
149
|
|
151
150
|
Asynchronous helpers like `wait` can either call the provided callback function, or (if none was provided) return a promise, so you can do:
|
152
151
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
152
|
+
it 'does something asynchronous', ->
|
153
|
+
wait().
|
154
|
+
.then ->
|
155
|
+
doSomething()
|
156
|
+
wait()
|
157
|
+
.then
|
158
|
+
doSomeMore()
|
159
|
+
|
160
|
+
NOTE: we should not use the `done` parameter here, as promises are handled differently than callbacks by Mocha.
|
159
161
|
|
160
162
|
## Note on headless browser testing
|
161
163
|
|
@@ -165,7 +167,7 @@ No headless browsers like PhantomJS or WebKit were used for testing because our
|
|
165
167
|
|
166
168
|
* Ruby >= 1.9.3
|
167
169
|
* Rails ~> 4.2.0
|
168
|
-
* Ext JS = 5.1.
|
170
|
+
* Ext JS = 5.1.1
|
169
171
|
|
170
172
|
---
|
171
|
-
Copyright (c) 2009-
|
173
|
+
Copyright (c) 2009-2016 [Good Bit Labs](http://goodbitlabs.com/), released under the same license as [Ext JS](https://www.sencha.com/legal/#Sencha_Ext_JS)
|
@@ -1,10 +1,6 @@
|
|
1
|
-
|
2
1
|
(function (global, module) {
|
3
2
|
|
4
|
-
|
5
|
-
var module = { exports: {} }
|
6
|
-
, exports = module.exports
|
7
|
-
}
|
3
|
+
var exports = module.exports;
|
8
4
|
|
9
5
|
/**
|
10
6
|
* Exports.
|
@@ -17,7 +13,7 @@
|
|
17
13
|
* Exports version.
|
18
14
|
*/
|
19
15
|
|
20
|
-
expect.version = '0.1
|
16
|
+
expect.version = '0.3.1';
|
21
17
|
|
22
18
|
/**
|
23
19
|
* Possible assertion flags.
|
@@ -56,7 +52,7 @@
|
|
56
52
|
}
|
57
53
|
|
58
54
|
var $flags = flag ? flags[flag] : keys(flags)
|
59
|
-
, self = this
|
55
|
+
, self = this;
|
60
56
|
|
61
57
|
if ($flags) {
|
62
58
|
for (var i = 0, l = $flags.length; i < l; i++) {
|
@@ -71,7 +67,7 @@
|
|
71
67
|
var old = this[name];
|
72
68
|
this[name] = function () {
|
73
69
|
return old.apply(self, arguments);
|
74
|
-
}
|
70
|
+
};
|
75
71
|
|
76
72
|
for (var fn in Assertion.prototype) {
|
77
73
|
if (Assertion.prototype.hasOwnProperty(fn) && fn != name) {
|
@@ -83,7 +79,7 @@
|
|
83
79
|
}
|
84
80
|
}
|
85
81
|
}
|
86
|
-
}
|
82
|
+
}
|
87
83
|
|
88
84
|
/**
|
89
85
|
* Performs an assertion
|
@@ -91,12 +87,19 @@
|
|
91
87
|
* @api private
|
92
88
|
*/
|
93
89
|
|
94
|
-
Assertion.prototype.assert = function (truth, msg, error) {
|
90
|
+
Assertion.prototype.assert = function (truth, msg, error, expected) {
|
95
91
|
var msg = this.flags.not ? error : msg
|
96
|
-
, ok = this.flags.not ? !truth : truth
|
92
|
+
, ok = this.flags.not ? !truth : truth
|
93
|
+
, err;
|
97
94
|
|
98
95
|
if (!ok) {
|
99
|
-
|
96
|
+
err = new Error(msg.call(this));
|
97
|
+
if (arguments.length > 3) {
|
98
|
+
err.actual = this.obj;
|
99
|
+
err.expected = expected;
|
100
|
+
err.showDiff = true;
|
101
|
+
}
|
102
|
+
throw err;
|
100
103
|
}
|
101
104
|
|
102
105
|
this.and = new Assertion(this.obj);
|
@@ -115,6 +118,19 @@
|
|
115
118
|
, function(){ return 'expected ' + i(this.obj) + ' to be falsy' });
|
116
119
|
};
|
117
120
|
|
121
|
+
/**
|
122
|
+
* Creates an anonymous function which calls fn with arguments.
|
123
|
+
*
|
124
|
+
* @api public
|
125
|
+
*/
|
126
|
+
|
127
|
+
Assertion.prototype.withArgs = function() {
|
128
|
+
expect(this.obj).to.be.a('function');
|
129
|
+
var fn = this.obj;
|
130
|
+
var args = Array.prototype.slice.call(arguments);
|
131
|
+
return expect(function() { fn.apply(null, args); });
|
132
|
+
};
|
133
|
+
|
118
134
|
/**
|
119
135
|
* Assert that the function throws.
|
120
136
|
*
|
@@ -122,30 +138,31 @@
|
|
122
138
|
* @api public
|
123
139
|
*/
|
124
140
|
|
141
|
+
Assertion.prototype['throw'] =
|
125
142
|
Assertion.prototype.throwError =
|
126
143
|
Assertion.prototype.throwException = function (fn) {
|
127
144
|
expect(this.obj).to.be.a('function');
|
128
145
|
|
129
146
|
var thrown = false
|
130
|
-
, not = this.flags.not
|
147
|
+
, not = this.flags.not;
|
131
148
|
|
132
149
|
try {
|
133
150
|
this.obj();
|
134
151
|
} catch (e) {
|
135
|
-
if (
|
136
|
-
fn(e);
|
137
|
-
} else if ('object' == typeof fn) {
|
152
|
+
if (isRegExp(fn)) {
|
138
153
|
var subject = 'string' == typeof e ? e : e.message;
|
139
154
|
if (not) {
|
140
155
|
expect(subject).to.not.match(fn);
|
141
156
|
} else {
|
142
157
|
expect(subject).to.match(fn);
|
143
158
|
}
|
159
|
+
} else if ('function' == typeof fn) {
|
160
|
+
fn(e);
|
144
161
|
}
|
145
162
|
thrown = true;
|
146
163
|
}
|
147
164
|
|
148
|
-
if (
|
165
|
+
if (isRegExp(fn) && not) {
|
149
166
|
// in the presence of a matcher, ensure the `not` only applies to
|
150
167
|
// the matching.
|
151
168
|
this.flags.not = false;
|
@@ -212,9 +229,10 @@
|
|
212
229
|
|
213
230
|
Assertion.prototype.eql = function (obj) {
|
214
231
|
this.assert(
|
215
|
-
expect.eql(obj,
|
232
|
+
expect.eql(this.obj, obj)
|
216
233
|
, function(){ return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) }
|
217
|
-
, function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) }
|
234
|
+
, function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) }
|
235
|
+
, obj);
|
218
236
|
return this;
|
219
237
|
};
|
220
238
|
|
@@ -250,9 +268,10 @@
|
|
250
268
|
// typeof with support for 'array'
|
251
269
|
this.assert(
|
252
270
|
'array' == type ? isArray(this.obj) :
|
253
|
-
'
|
254
|
-
|
255
|
-
|
271
|
+
'regexp' == type ? isRegExp(this.obj) :
|
272
|
+
'object' == type
|
273
|
+
? 'object' == typeof this.obj && null !== this.obj
|
274
|
+
: type == typeof this.obj
|
256
275
|
, function(){ return 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type }
|
257
276
|
, function(){ return 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type });
|
258
277
|
} else {
|
@@ -459,6 +478,7 @@
|
|
459
478
|
|
460
479
|
return this;
|
461
480
|
};
|
481
|
+
|
462
482
|
/**
|
463
483
|
* Assert a failure.
|
464
484
|
*
|
@@ -466,8 +486,8 @@
|
|
466
486
|
* @api public
|
467
487
|
*/
|
468
488
|
Assertion.prototype.fail = function (msg) {
|
469
|
-
|
470
|
-
this.assert(false,
|
489
|
+
var error = function() { return msg || "explicit failure"; }
|
490
|
+
this.assert(false, error, error);
|
471
491
|
return this;
|
472
492
|
};
|
473
493
|
|
@@ -496,7 +516,7 @@
|
|
496
516
|
}
|
497
517
|
}
|
498
518
|
return true;
|
499
|
-
}
|
519
|
+
}
|
500
520
|
|
501
521
|
/**
|
502
522
|
* Array indexOf compatibility.
|
@@ -518,14 +538,13 @@
|
|
518
538
|
; i < j && arr[i] !== o; i++);
|
519
539
|
|
520
540
|
return j <= i ? -1 : i;
|
521
|
-
}
|
541
|
+
}
|
522
542
|
|
523
543
|
// https://gist.github.com/1044128/
|
524
544
|
var getOuterHTML = function(element) {
|
525
545
|
if ('outerHTML' in element) return element.outerHTML;
|
526
546
|
var ns = "http://www.w3.org/1999/xhtml";
|
527
547
|
var container = document.createElementNS(ns, '_');
|
528
|
-
var elemProto = (window.HTMLElement || window.Element).prototype;
|
529
548
|
var xmlSerializer = new XMLSerializer();
|
530
549
|
var html;
|
531
550
|
if (document.xmlVersion) {
|
@@ -562,7 +581,7 @@
|
|
562
581
|
|
563
582
|
function stylize (str) {
|
564
583
|
return str;
|
565
|
-
}
|
584
|
+
}
|
566
585
|
|
567
586
|
function format (value, recurseTimes) {
|
568
587
|
// Provide a hook for user-specified inspect functions.
|
@@ -620,6 +639,11 @@
|
|
620
639
|
return stylize(value.toUTCString(), 'date');
|
621
640
|
}
|
622
641
|
|
642
|
+
// Error objects can be shortcutted
|
643
|
+
if (value instanceof Error) {
|
644
|
+
return stylize("["+value.toString()+"]", 'Error');
|
645
|
+
}
|
646
|
+
|
623
647
|
var base, type, braces;
|
624
648
|
// Determine the object type
|
625
649
|
if (isArray(value)) {
|
@@ -740,11 +764,13 @@
|
|
740
764
|
return output;
|
741
765
|
}
|
742
766
|
return format(obj, (typeof depth === 'undefined' ? 2 : depth));
|
743
|
-
}
|
767
|
+
}
|
768
|
+
|
769
|
+
expect.stringify = i;
|
744
770
|
|
745
771
|
function isArray (ar) {
|
746
|
-
return Object.prototype.toString.call(ar)
|
747
|
-
}
|
772
|
+
return Object.prototype.toString.call(ar) === '[object Array]';
|
773
|
+
}
|
748
774
|
|
749
775
|
function isRegExp(re) {
|
750
776
|
var s;
|
@@ -762,12 +788,11 @@
|
|
762
788
|
re.test &&
|
763
789
|
re.exec &&
|
764
790
|
s.match(/^\/.*\/[gim]{0,3}$/);
|
765
|
-
}
|
791
|
+
}
|
766
792
|
|
767
793
|
function isDate(d) {
|
768
|
-
|
769
|
-
|
770
|
-
};
|
794
|
+
return d instanceof Date;
|
795
|
+
}
|
771
796
|
|
772
797
|
function keys (obj) {
|
773
798
|
if (Object.keys) {
|
@@ -797,7 +822,7 @@
|
|
797
822
|
other[i] = mapper.call(that, arr[i], i, arr);
|
798
823
|
|
799
824
|
return other;
|
800
|
-
}
|
825
|
+
}
|
801
826
|
|
802
827
|
function reduce (arr, fun) {
|
803
828
|
if (Array.prototype.reduce) {
|
@@ -838,7 +863,7 @@
|
|
838
863
|
}
|
839
864
|
|
840
865
|
return rv;
|
841
|
-
}
|
866
|
+
}
|
842
867
|
|
843
868
|
/**
|
844
869
|
* Asserts deep equality
|
@@ -847,12 +872,12 @@
|
|
847
872
|
* @api private
|
848
873
|
*/
|
849
874
|
|
850
|
-
expect.eql = function eql
|
875
|
+
expect.eql = function eql(actual, expected) {
|
851
876
|
// 7.1. All identical values are equivalent, as determined by ===.
|
852
877
|
if (actual === expected) {
|
853
878
|
return true;
|
854
879
|
} else if ('undefined' != typeof Buffer
|
855
|
-
|
880
|
+
&& Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
|
856
881
|
if (actual.length != expected.length) return false;
|
857
882
|
|
858
883
|
for (var i = 0; i < actual.length; i++) {
|
@@ -861,16 +886,19 @@
|
|
861
886
|
|
862
887
|
return true;
|
863
888
|
|
864
|
-
|
865
|
-
|
889
|
+
// 7.2. If the expected value is a Date object, the actual value is
|
890
|
+
// equivalent if it is also a Date object that refers to the same time.
|
866
891
|
} else if (actual instanceof Date && expected instanceof Date) {
|
867
892
|
return actual.getTime() === expected.getTime();
|
868
893
|
|
869
|
-
|
870
|
-
|
894
|
+
// 7.3. Other pairs that do not both pass typeof value == "object",
|
895
|
+
// equivalence is determined by ==.
|
871
896
|
} else if (typeof actual != 'object' && typeof expected != 'object') {
|
872
897
|
return actual == expected;
|
873
|
-
|
898
|
+
// If both are regular expression use the special `regExpEquiv` method
|
899
|
+
// to determine equivalence.
|
900
|
+
} else if (isRegExp(actual) && isRegExp(expected)) {
|
901
|
+
return regExpEquiv(actual, expected);
|
874
902
|
// 7.4. For all other Object pairs, including Array objects, equivalence is
|
875
903
|
// determined by having the same number of owned properties (as verified
|
876
904
|
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
@@ -880,7 +908,7 @@
|
|
880
908
|
} else {
|
881
909
|
return objEquiv(actual, expected);
|
882
910
|
}
|
883
|
-
}
|
911
|
+
};
|
884
912
|
|
885
913
|
function isUndefinedOrNull (value) {
|
886
914
|
return value === null || value === undefined;
|
@@ -890,6 +918,11 @@
|
|
890
918
|
return Object.prototype.toString.call(object) == '[object Arguments]';
|
891
919
|
}
|
892
920
|
|
921
|
+
function regExpEquiv (a, b) {
|
922
|
+
return a.source === b.source && a.global === b.global &&
|
923
|
+
a.ignoreCase === b.ignoreCase && a.multiline === b.multiline;
|
924
|
+
}
|
925
|
+
|
893
926
|
function objEquiv (a, b) {
|
894
927
|
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
|
895
928
|
return false;
|
@@ -958,7 +991,7 @@
|
|
958
991
|
f(d.getUTCHours()) + ':' +
|
959
992
|
f(d.getUTCMinutes()) + ':' +
|
960
993
|
f(d.getUTCSeconds()) + 'Z' : null;
|
961
|
-
}
|
994
|
+
}
|
962
995
|
|
963
996
|
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
964
997
|
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
@@ -1248,6 +1281,5 @@
|
|
1248
1281
|
|
1249
1282
|
})(
|
1250
1283
|
this
|
1251
|
-
, 'undefined' != typeof module ? module : {}
|
1252
|
-
, 'undefined' != typeof exports ? exports : {}
|
1284
|
+
, 'undefined' != typeof module ? module : {exports: {}}
|
1253
1285
|
);
|
@@ -24,13 +24,13 @@ Ext.apply window,
|
|
24
24
|
#
|
25
25
|
# wait().then -> doSomething()
|
26
26
|
wait: () ->
|
27
|
-
waitInCycle = (
|
27
|
+
waitInCycle = (resolve) ->
|
28
28
|
i = 0
|
29
29
|
id = setInterval ->
|
30
30
|
i += 1
|
31
31
|
if i >= 100
|
32
32
|
clearInterval(id)
|
33
|
-
|
33
|
+
resolve.call()
|
34
34
|
|
35
35
|
# this way we ensure another 20ms cycle before we issue a callback
|
36
36
|
i = 100 if Netzke.ajaxCount == 0
|
@@ -56,7 +56,6 @@ Ext.apply window,
|
|
56
56
|
# wait(50).then ->
|
57
57
|
# waitAtLeast50ThenResolve()
|
58
58
|
else
|
59
|
-
console.log("1", 1)
|
60
59
|
delay = arguments[0]
|
61
60
|
return new Promise (resolve, reject) ->
|
62
61
|
setInterval ->
|
@@ -1,19 +1,23 @@
|
|
1
|
-
Ext.apply window,
|
1
|
+
Ext.apply window, (->
|
2
|
+
throwIfNotFound = (cmp) ->
|
3
|
+
throw new Error(cmp + " not found") if Ext.isString(cmp)
|
4
|
+
|
2
5
|
expectToSee: (cmp) ->
|
3
|
-
|
6
|
+
throwIfNotFound(cmp)
|
4
7
|
expect(Ext.isObject(cmp) || Ext.isElement(cmp)).to.be.ok()
|
5
8
|
|
6
9
|
expectToNotSee: (el) ->
|
7
10
|
expect(Ext.isString(el)).to.be.ok()
|
8
11
|
|
9
12
|
expectDisabled: (cmp) ->
|
10
|
-
|
13
|
+
throwIfNotFound(cmp)
|
11
14
|
expect(cmp.isDisabled()).to.be(true)
|
12
15
|
|
13
16
|
expectEnabled: (cmp) ->
|
14
|
-
|
17
|
+
throwIfNotFound(cmp)
|
15
18
|
expect(cmp.isDisabled()).to.be(false)
|
16
19
|
|
17
20
|
expectInvisibleBodyOf: (cmp) ->
|
18
|
-
|
21
|
+
throwIfNotFound(cmp)
|
19
22
|
expect(cmp.body.isVisible()).to.be false
|
23
|
+
)()
|