extjs-mvc 0.4.0.b → 0.4.0.d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +6 -9
- data/VERSION +1 -1
- data/bin/extjs-mvc +19 -0
- data/lib/extjs-mvc.rb +13 -67
- data/lib/{js → vendor}/App.js +0 -0
- data/lib/{js → vendor}/MVC.js +0 -0
- data/lib/{js → vendor}/Presenter.js +0 -0
- data/lib/{js → vendor}/README.rdoc +0 -0
- data/lib/{js → vendor}/controller/Controller.js +0 -0
- data/lib/{js → vendor}/controller/CrudController.js +0 -0
- data/lib/{js → vendor}/lib/Array.js +0 -0
- data/lib/{js → vendor}/lib/Booter.js +4 -3
- data/lib/{js → vendor}/lib/ClassManager.js +0 -0
- data/lib/{js → vendor}/lib/ControllerClassManager.js +0 -0
- data/lib/{js → vendor}/lib/Dependencies.js +0 -0
- data/lib/{js → vendor}/lib/DispatchMatcher.js +0 -0
- data/lib/{js → vendor}/lib/Dispatcher.js +0 -0
- data/lib/{js → vendor}/lib/Environment.js +0 -0
- data/lib/{js → vendor}/lib/Inflector.js +17 -0
- data/lib/{js → vendor}/lib/ModelClassManager.js +0 -0
- data/lib/{js → vendor}/lib/Route.js +0 -0
- data/lib/{js → vendor}/lib/Router.js +0 -0
- data/lib/{js → vendor}/lib/String.js +0 -0
- data/lib/{js → vendor}/lib/ViewClassManager.js +0 -0
- data/lib/{js → vendor}/lib/notes.txt +0 -0
- data/lib/{js → vendor}/model/AdapterManager.js +0 -0
- data/lib/{js → vendor}/model/Association.js +0 -0
- data/lib/{js → vendor}/model/Base.js +0 -0
- data/lib/{js → vendor}/model/BelongsToAssociation.js +0 -0
- data/lib/{js → vendor}/model/Cache.js +0 -0
- data/lib/{js → vendor}/model/HasManyAssociation.js +0 -0
- data/lib/{js → vendor}/model/Model.js +0 -0
- data/lib/{js → vendor}/model/UrlBuilder.js +0 -0
- data/lib/{js → vendor}/model/adapters/AbstractAdapter.js +0 -0
- data/lib/{js → vendor}/model/adapters/MemoryAdapter.js +0 -0
- data/lib/{js → vendor}/model/adapters/RESTAdapter.js +0 -0
- data/lib/{js → vendor}/model/adapters/RESTJSONAdapter.js +0 -0
- data/lib/{js → vendor}/model/adapters/notes.txt +0 -0
- data/lib/{js → vendor}/model/associations/Association.js +0 -0
- data/lib/{js → vendor}/model/associations/notes.txt +0 -0
- data/lib/{js → vendor}/model/validations/Errors.js +0 -0
- data/lib/{js → vendor}/model/validations/Plugin.js +0 -0
- data/lib/{js → vendor}/model/validations/Validations.js +0 -0
- data/lib/{js → vendor}/notes/Charts.graffle +0 -0
- data/lib/{js → vendor}/overrides/Ext.Component.js +0 -0
- data/lib/{js → vendor}/overrides/Ext.extend.js +0 -0
- data/lib/{js → vendor}/spec/Array.spec.js +0 -0
- data/lib/{js → vendor}/spec/ExtMVC.spec.js +0 -0
- data/lib/{js → vendor}/spec/Model.spec.js +0 -0
- data/lib/{js → vendor}/spec/OS.spec.js +0 -0
- data/lib/{js → vendor}/spec/Router.spec.js +0 -0
- data/lib/{js → vendor}/spec/SpecHelper.js +0 -0
- data/lib/{js → vendor}/spec/String.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/AbstractAdapter.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/Associations.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/Cache.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/RESTAdapter.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/ValidationErrors.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/Validations.spec.js +0 -0
- data/lib/{js → vendor}/spec/model/ValidationsPlugin.spec.js +0 -0
- data/lib/{js → vendor}/spec/suite.html +0 -0
- data/lib/{js → vendor}/specs-old/JSSpec.css +0 -0
- data/lib/{js → vendor}/specs-old/JSSpec.js +0 -0
- data/lib/{js → vendor}/specs-old/all.html +0 -0
- data/lib/{js → vendor}/specs-old/base.js +0 -0
- data/lib/{js → vendor}/specs-old/controller.js +0 -0
- data/lib/{js → vendor}/specs-old/diff_match_patch.js +0 -0
- data/lib/{js → vendor}/specs-old/model.js +0 -0
- data/lib/{js → vendor}/specs-old/route.js +0 -0
- data/lib/{js → vendor}/specs-old/router.js +0 -0
- data/lib/{js → vendor}/specs-old/string.js +0 -0
- data/lib/{js → vendor}/testrunner/JSpecFormatter.js +0 -0
- data/lib/{js → vendor}/testrunner/TestClient.js +0 -0
- data/lib/{js → vendor}/testrunner/TestGrid.js +0 -0
- data/lib/{js → vendor}/testrunner/TestRunner.js +0 -0
- data/lib/{js → vendor}/testrunner/TestViewport.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/EXAMPLE.html +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/LICENSE +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/README.markdown +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/jquery-1.2.3.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/jquery.fn.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/jquery.print.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.assets.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.behaviors.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.builder.js +0 -0
- data/lib/{js → vendor}/vendor/screw-unit/lib/screw.css +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.events.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.matchers.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/lib/screw.server.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/behaviors_spec.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/matchers_spec.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/print_spec.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/spec_helper.js +0 -0
- data/lib/{extjs-mvc/generators/templates/app → vendor}/vendor/screw-unit/spec/suite.html +0 -0
- data/lib/{js → vendor}/view/FormWindow.js +0 -0
- data/lib/{js → vendor}/view/HasManyEditorGridPanel.js +0 -0
- data/lib/{js → vendor}/view/scaffold/Edit.js +0 -0
- data/lib/{js → vendor}/view/scaffold/Index.js +0 -0
- data/lib/{js → vendor}/view/scaffold/New.js +0 -0
- data/lib/{js → vendor}/view/scaffold/ScaffoldFormPanel.js +0 -0
- data/lib/{js/build → vendor.yml} +7 -1
- metadata +110 -203
- data/bin/xmvc +0 -13
- data/lib/extjs-mvc/README +0 -20
- data/lib/extjs-mvc/builder.rb +0 -83
- data/lib/extjs-mvc/builders/all_builder.rb +0 -15
- data/lib/extjs-mvc/builders/app_builder.rb +0 -36
- data/lib/extjs-mvc/builders/base.rb +0 -138
- data/lib/extjs-mvc/builders/css_builder.rb +0 -36
- data/lib/extjs-mvc/builders/docs_builder.rb +0 -20
- data/lib/extjs-mvc/builders/mvc_builder.rb +0 -33
- data/lib/extjs-mvc/builders/plugin_builder.rb +0 -53
- data/lib/extjs-mvc/cli.rb +0 -52
- data/lib/extjs-mvc/generator.rb +0 -79
- data/lib/extjs-mvc/generators/app.rb +0 -57
- data/lib/extjs-mvc/generators/base.rb +0 -53
- data/lib/extjs-mvc/generators/controller.rb +0 -41
- data/lib/extjs-mvc/generators/model.rb +0 -41
- data/lib/extjs-mvc/generators/scaffold.rb +0 -17
- data/lib/extjs-mvc/generators/templates/Controller.js +0 -17
- data/lib/extjs-mvc/generators/templates/Model.js +0 -9
- data/lib/extjs-mvc/generators/templates/ModelSpec.js +0 -12
- data/lib/extjs-mvc/generators/templates/View.js +0 -16
- data/lib/extjs-mvc/generators/templates/_Action.js +0 -7
- data/lib/extjs-mvc/generators/templates/app/README.rdoc +0 -152
- data/lib/extjs-mvc/generators/templates/app/app/App.js +0 -64
- data/lib/extjs-mvc/generators/templates/app/app/controllers/ApplicationController.js +0 -10
- data/lib/extjs-mvc/generators/templates/app/app/controllers/HomeController.js +0 -10
- data/lib/extjs-mvc/generators/templates/app/app/views/home/Index.js +0 -17
- data/lib/extjs-mvc/generators/templates/app/app/views/layout/Menu.js +0 -23
- data/lib/extjs-mvc/generators/templates/app/config/application.js +0 -1
- data/lib/extjs-mvc/generators/templates/app/config/boot.js +0 -67
- data/lib/extjs-mvc/generators/templates/app/config/build.xml +0 -77
- data/lib/extjs-mvc/generators/templates/app/config/database.js +0 -4
- data/lib/extjs-mvc/generators/templates/app/config/environment.json +0 -58
- data/lib/extjs-mvc/generators/templates/app/config/environments/development.json +0 -1
- data/lib/extjs-mvc/generators/templates/app/config/environments/production.json +0 -4
- data/lib/extjs-mvc/generators/templates/app/config/routes.js +0 -27
- data/lib/extjs-mvc/generators/templates/app/config/settings.yml +0 -3
- data/lib/extjs-mvc/generators/templates/app/public/index.html +0 -19
- data/lib/extjs-mvc/generators/templates/app/public/stylesheets/ext-mvc-all.css +0 -49
- data/lib/extjs-mvc/generators/templates/app/spec/SpecHelper.js +0 -0
- data/lib/extjs-mvc/generators/templates/app/spec/index.html +0 -66
- data/lib/extjs-mvc/generators/templates/app/vendor/screw-unit/lib/screw.css +0 -90
- data/lib/extjs-mvc/generators/templates/scaffold/ScaffoldController.js +0 -18
- data/lib/extjs-mvc/generators/view.rb +0 -29
- data/lib/extjs-mvc/plugin.rb +0 -105
- data/lib/extjs-mvc/scripts.rb +0 -15
- data/lib/extjs-mvc/settings.rb +0 -75
- data/lib/extjs-mvc/setup.rb +0 -5
- data/lib/extjs-mvc/stats.rb +0 -241
- data/lib/extjs-mvc/test.rb +0 -11
- data/lib/extjs-mvc/testserver.ru +0 -95
- data/lib/extjs-mvc/ui.rb +0 -58
- data/lib/extjs-mvc/update.rb +0 -73
- data/lib/js/vendor/screw-unit/EXAMPLE.html +0 -68
- data/lib/js/vendor/screw-unit/LICENSE +0 -22
- data/lib/js/vendor/screw-unit/README.markdown +0 -307
- data/lib/js/vendor/screw-unit/lib/jquery-1.2.3.js +0 -3408
- data/lib/js/vendor/screw-unit/lib/jquery.fn.js +0 -29
- data/lib/js/vendor/screw-unit/lib/jquery.print.js +0 -108
- data/lib/js/vendor/screw-unit/lib/screw.assets.js +0 -36
- data/lib/js/vendor/screw-unit/lib/screw.behaviors.js +0 -91
- data/lib/js/vendor/screw-unit/lib/screw.builder.js +0 -80
- data/lib/js/vendor/screw-unit/lib/screw.events.js +0 -42
- data/lib/js/vendor/screw-unit/lib/screw.matchers.js +0 -145
- data/lib/js/vendor/screw-unit/lib/screw.server.js +0 -21
- data/lib/js/vendor/screw-unit/spec/behaviors_spec.js +0 -178
- data/lib/js/vendor/screw-unit/spec/matchers_spec.js +0 -237
- data/lib/js/vendor/screw-unit/spec/print_spec.js +0 -119
- data/lib/js/vendor/screw-unit/spec/spec_helper.js +0 -0
- data/lib/js/vendor/screw-unit/spec/suite.html +0 -18
@@ -1,178 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
var global_before_invoked = false, global_after_invoked = false;
|
3
|
-
before(function() { global_before_invoked = true });
|
4
|
-
after(function() { global_after_invoked = true });
|
5
|
-
|
6
|
-
describe('Behaviors', function() {
|
7
|
-
describe('#run', function() {
|
8
|
-
describe("a simple [describe]", function() {
|
9
|
-
it("invokes the global [before] before an [it]", function() {
|
10
|
-
expect(global_before_invoked).to(equal, true);
|
11
|
-
global_before_invoked = false;
|
12
|
-
});
|
13
|
-
|
14
|
-
it("invokes the global [before] before each [it]", function() {
|
15
|
-
expect(global_before_invoked).to(equal, true);
|
16
|
-
global_after_invoked = false;
|
17
|
-
});
|
18
|
-
|
19
|
-
it("invokes the global [after] after an [it]", function() {
|
20
|
-
expect(global_after_invoked).to(equal, true);
|
21
|
-
});
|
22
|
-
});
|
23
|
-
|
24
|
-
describe("a [describe] with a [before] and [after] block", function() {
|
25
|
-
var before_invoked = false, after_invoked = false;
|
26
|
-
before(function() { before_invoked = true });
|
27
|
-
after(function() { after_invoked = true });
|
28
|
-
|
29
|
-
describe('[after] blocks', function() {
|
30
|
-
it("does not invoke the [after] until after the first [it]", function() {
|
31
|
-
expect(after_invoked).to(equal, false);
|
32
|
-
});
|
33
|
-
|
34
|
-
it("invokes the [after] after the first [it]", function() {
|
35
|
-
expect(after_invoked).to(equal, true);
|
36
|
-
after_invoked = false;
|
37
|
-
});
|
38
|
-
|
39
|
-
it("invokes the [after] after each [it]", function() {
|
40
|
-
expect(after_invoked).to(equal, true);
|
41
|
-
});
|
42
|
-
});
|
43
|
-
|
44
|
-
describe('[before] blocks', function() {
|
45
|
-
it("invokes the [before] before an it", function() {
|
46
|
-
expect(before_invoked).to(equal, true);
|
47
|
-
before_invoked = false;
|
48
|
-
});
|
49
|
-
|
50
|
-
it("invokes the [before] before each it", function() {
|
51
|
-
expect(before_invoked).to(equal, true);
|
52
|
-
});
|
53
|
-
});
|
54
|
-
});
|
55
|
-
|
56
|
-
describe("A [describe] with two [before] and two [after] blocks", function() {
|
57
|
-
var before_invocations = [], after_invocations = [];
|
58
|
-
before(function() { before_invocations.push('before 1') });
|
59
|
-
before(function() { before_invocations.push('before 2') });
|
60
|
-
|
61
|
-
after(function() { after_invocations.push('after 1') });
|
62
|
-
after(function() { after_invocations.push('after 2') });
|
63
|
-
|
64
|
-
it("invokes the [before]s in lexical order before each [it]", function() {
|
65
|
-
expect(before_invocations).to(equal, ['before 1', 'before 2']);
|
66
|
-
});
|
67
|
-
|
68
|
-
it("invokes the [afters]s in lexical order after each [it]", function() {
|
69
|
-
expect(after_invocations).to(equal, ['after 1', 'after 2']);
|
70
|
-
});
|
71
|
-
});
|
72
|
-
|
73
|
-
describe("A describe with a nested describe", function() {
|
74
|
-
var before_invocations = [], after_invocations = [];
|
75
|
-
before(function() {
|
76
|
-
before_invocations = [];
|
77
|
-
before_invocations.push("outermost before");
|
78
|
-
});
|
79
|
-
|
80
|
-
after(function() {
|
81
|
-
after_invocations = [];
|
82
|
-
after_invocations.push("outermost after");
|
83
|
-
});
|
84
|
-
|
85
|
-
it("outside a nested [describe], does not invoke any of the nested's [before]s", function() {
|
86
|
-
expect(before_invocations).to(equal, ["outermost before"]);
|
87
|
-
});
|
88
|
-
|
89
|
-
it("outside a nested [describe], does not invoke any of the nested's [after]s", function() {
|
90
|
-
expect(after_invocations).to(equal, ["outermost after"]);
|
91
|
-
});
|
92
|
-
|
93
|
-
describe("a nested [describe]", function() {
|
94
|
-
before(function() {
|
95
|
-
before_invocations.push("inner before");
|
96
|
-
});
|
97
|
-
|
98
|
-
after(function() {
|
99
|
-
after_invocations.push("inner after");
|
100
|
-
});
|
101
|
-
|
102
|
-
it("runs [before]s in the parent [describe] before each [it]", function() {
|
103
|
-
expect(before_invocations).to(equal, ["outermost before", "inner before"]);
|
104
|
-
});
|
105
|
-
|
106
|
-
it("runs [after]s in the parent [describe] after each [it]", function() {
|
107
|
-
expect(after_invocations).to(equal, ["outermost after", "inner after"]);
|
108
|
-
});
|
109
|
-
|
110
|
-
describe("a doubly nested [describe]", function() {
|
111
|
-
before(function() {
|
112
|
-
before_invocations.push('innermost before');
|
113
|
-
});
|
114
|
-
|
115
|
-
after(function() {
|
116
|
-
after_invocations.push('innermost after');
|
117
|
-
});
|
118
|
-
|
119
|
-
describe('[before] blocks', function() {
|
120
|
-
it("runs [before]s in all ancestors before an [it]", function() {
|
121
|
-
expect(before_invocations).to(equal, ["outermost before", "inner before", "innermost before"]);
|
122
|
-
});
|
123
|
-
|
124
|
-
it("runs [before]s in all ancestors before each [it]", function() {
|
125
|
-
expect(before_invocations).to(equal, ["outermost before", "inner before", "innermost before"]);
|
126
|
-
});
|
127
|
-
});
|
128
|
-
|
129
|
-
describe('[after] blocks', function() {
|
130
|
-
it("runs [after]s in all ancestors after an [it]", function() {
|
131
|
-
expect(after_invocations).to(equal, ["outermost after", "inner after", "innermost after"]);
|
132
|
-
});
|
133
|
-
|
134
|
-
it("runs [after]s in all ancestors after each [it]", function() {
|
135
|
-
expect(after_invocations).to(equal, ["outermost after", "inner after", "innermost after"]);
|
136
|
-
});
|
137
|
-
});
|
138
|
-
});
|
139
|
-
});
|
140
|
-
});
|
141
|
-
|
142
|
-
describe("A describe block with exceptions", function() {
|
143
|
-
var after_invoked = false;
|
144
|
-
after(function() {
|
145
|
-
after_invoked = true;
|
146
|
-
});
|
147
|
-
|
148
|
-
describe("an exception in a test", function() {
|
149
|
-
it("fails because it throws an exception", function() {
|
150
|
-
throw('an exception');
|
151
|
-
});
|
152
|
-
|
153
|
-
it("invokes [after]s even if the previous [it] raised an exception", function() {
|
154
|
-
expect(after_invoked).to(equal, true);
|
155
|
-
});
|
156
|
-
});
|
157
|
-
});
|
158
|
-
});
|
159
|
-
|
160
|
-
describe("#selector", function() {
|
161
|
-
describe('a [describe]', function() {
|
162
|
-
it('manufactures a CSS selector that uniquely locates the [describe]', function() {
|
163
|
-
$('.describe').each(function() {
|
164
|
-
expect($($(this).fn('selector')).get(0)).to(equal, $(this).get(0))
|
165
|
-
});
|
166
|
-
});
|
167
|
-
});
|
168
|
-
|
169
|
-
describe('an [it]', function() {
|
170
|
-
it('manufactures a CSS selector that uniquely locates the [it]', function() {
|
171
|
-
$('.it').each(function() {
|
172
|
-
expect($($(this).fn('selector')).get(0)).to(equal, $(this).get(0))
|
173
|
-
});
|
174
|
-
});
|
175
|
-
});
|
176
|
-
});
|
177
|
-
});
|
178
|
-
});
|
@@ -1,237 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("Matchers", function() {
|
3
|
-
describe('#equal', function() {
|
4
|
-
it("invokes the provided matcher on a call to expect", function() {
|
5
|
-
expect(true).to(equal, true);
|
6
|
-
expect(true).to_not(equal, false);
|
7
|
-
});
|
8
|
-
|
9
|
-
describe('when given an object', function() {
|
10
|
-
it("matches Objects with the same keys and values", function() {
|
11
|
-
expect({a: 'b', c: 'd'}).to(equal, {a: 'b', c: 'd'});
|
12
|
-
expect({a: 'b', c: 'd', e: 'f'}).to_not(equal, {a: 'b', c: 'd', e: 'G'});
|
13
|
-
});
|
14
|
-
|
15
|
-
});
|
16
|
-
|
17
|
-
describe('when given an array', function() {
|
18
|
-
it("matches Arrays with the same elements", function() {
|
19
|
-
expect([1, 2, 4]).to(equal, [1, 2, 4]);
|
20
|
-
expect([1, 2, 3]).to_not(equal, [3, 2, 1]);
|
21
|
-
});
|
22
|
-
|
23
|
-
it("recursively applies equality to complex elements", function() {
|
24
|
-
expect([{a: 'b'}, {c: 'd'}]).to(equal, [{a: 'b'}, {c: 'd'}]);
|
25
|
-
expect([{a: 'b'}, {c: 'd'}]).to_not(equal, [{a: 'b'}, {c: 'E'}]);
|
26
|
-
});
|
27
|
-
});
|
28
|
-
|
29
|
-
describe(".failure_message", function() {
|
30
|
-
it('prints "expected [expected] to (not) be equal [actual]"', function() {
|
31
|
-
var message = null;
|
32
|
-
try { expect(1).to(equal, 2) } catch(e) { message = e }
|
33
|
-
expect(message).to(equal, 'expected 1 to equal 2');
|
34
|
-
|
35
|
-
try { expect(1).to_not(equal, 1) } catch(e) { message = e }
|
36
|
-
expect(message).to(equal, 'expected 1 to not equal 1');
|
37
|
-
});
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
describe('#match', function() {
|
42
|
-
describe('when given a regular expression', function() {
|
43
|
-
it("matches Strings produced by the grammar", function() {
|
44
|
-
expect("The wheels of the bus").to(match, /bus/);
|
45
|
-
expect("The wheels of the bus").to_not(match, /boat/);
|
46
|
-
});
|
47
|
-
});
|
48
|
-
|
49
|
-
describe('when given a string', function() {
|
50
|
-
it("matches [expected]s containing [actual]s", function() {
|
51
|
-
expect("The wheels of the bus").to(match, "wheels");
|
52
|
-
expect("The wheels of the bus").to_not(match, "oars");
|
53
|
-
});
|
54
|
-
});
|
55
|
-
|
56
|
-
describe('when given an integer', function() {
|
57
|
-
it("matches [expected]s containing [actual]s", function() {
|
58
|
-
expect("1 time").to(match, 1);
|
59
|
-
expect("2 times").to_not(match, 3);
|
60
|
-
});
|
61
|
-
});
|
62
|
-
|
63
|
-
describe(".failure_message", function() {
|
64
|
-
it('prints "expected [actual] to (not) match [expected]', function() {
|
65
|
-
var message = null;
|
66
|
-
try { expect("hello").to(match, "schmello") } catch(e) { message = e }
|
67
|
-
expect(message).to(equal, 'expected "hello" to match "schmello"');
|
68
|
-
|
69
|
-
try { expect("hello").to_not(match, "ello") } catch(e) { message = e }
|
70
|
-
expect(message).to(equal, 'expected "hello" to not match "ello"');
|
71
|
-
});
|
72
|
-
});
|
73
|
-
});
|
74
|
-
|
75
|
-
describe('#be_empty', function() {
|
76
|
-
it("matches Arrays with no elements", function() {
|
77
|
-
expect([]).to(be_empty);
|
78
|
-
expect([1]).to_not(be_empty);
|
79
|
-
});
|
80
|
-
|
81
|
-
describe(".failure_message", function() {
|
82
|
-
it("prints 'expected [actual] to (not) be empty", function() {
|
83
|
-
var message = null;
|
84
|
-
try { expect([1]).to(be_empty) } catch(e) { message = e }
|
85
|
-
expect(message).to(equal, 'expected [ 1 ] to be empty');
|
86
|
-
|
87
|
-
try { expect([]).to_not(be_empty) } catch(e) { message = e }
|
88
|
-
expect(message).to(equal, 'expected [] to not be empty');
|
89
|
-
});
|
90
|
-
});
|
91
|
-
});
|
92
|
-
|
93
|
-
describe('#have_length', function() {
|
94
|
-
it("matches Arrays of the expected length", function() {
|
95
|
-
expect([]).to(have_length, 0);
|
96
|
-
expect([1]).to(have_length, 1);
|
97
|
-
expect([1, 2, 3]).to_not(have_length, 4);
|
98
|
-
});
|
99
|
-
|
100
|
-
describe(".failure_message", function() {
|
101
|
-
it("prints 'expected [actual] to (not) have length [expected]", function() {
|
102
|
-
var message = null;
|
103
|
-
try { expect([1, 2]).to(have_length, 4) } catch(e) { message = e }
|
104
|
-
expect(message).to(equal, 'expected [ 1, 2 ] to have length 4');
|
105
|
-
|
106
|
-
try { expect([1]).to_not(have_length, 1) } catch(e) { message = e }
|
107
|
-
expect(message).to(equal, 'expected [ 1 ] to not have length 1');
|
108
|
-
});
|
109
|
-
});
|
110
|
-
});
|
111
|
-
|
112
|
-
describe('#be_null', function() {
|
113
|
-
it("matches null", function() {
|
114
|
-
expect(null).to(be_null);
|
115
|
-
expect(1).to_not(be_null);
|
116
|
-
});
|
117
|
-
|
118
|
-
describe(".failure_message", function() {
|
119
|
-
it("prints 'expected [actual] to (not) be null", function() {
|
120
|
-
var message = null;
|
121
|
-
try { expect(1).to(be_null) } catch(e) { message = e }
|
122
|
-
expect(message).to(equal, 'expected 1 to be null');
|
123
|
-
|
124
|
-
try { expect(null).to_not(be_null) } catch(e) { message = e }
|
125
|
-
expect(message).to(equal, 'expected null to not be null');
|
126
|
-
});
|
127
|
-
});
|
128
|
-
});
|
129
|
-
|
130
|
-
describe('#be_undefined', function() {
|
131
|
-
it("matches undefined", function() {
|
132
|
-
expect(undefined).to(be_undefined);
|
133
|
-
expect(1).to_not(be_undefined);
|
134
|
-
});
|
135
|
-
|
136
|
-
describe(".failure_message", function() {
|
137
|
-
it("prints 'expected [actual] to (not) be undefined", function() {
|
138
|
-
var message = undefined;
|
139
|
-
try { expect(1).to(be_undefined) } catch(e) { message = e }
|
140
|
-
expect(message).to(equal, 'expected 1 to be undefined');
|
141
|
-
|
142
|
-
try { expect(undefined).to_not(be_undefined) } catch(e) { message = e }
|
143
|
-
expect(message).to(equal, 'expected undefined to not be undefined');
|
144
|
-
});
|
145
|
-
});
|
146
|
-
});
|
147
|
-
|
148
|
-
describe('#be_true', function() {
|
149
|
-
it("matches values that are considered true conditions", function() {
|
150
|
-
expect(true).to(be_true);
|
151
|
-
expect(1).to(be_true);
|
152
|
-
expect(false).to_not(be_true);
|
153
|
-
expect(undefined).to_not(be_true);
|
154
|
-
expect(null).to_not(be_true);
|
155
|
-
});
|
156
|
-
|
157
|
-
describe(".failure_message", function() {
|
158
|
-
it("prints 'expected [actual] to (not) be true", function() {
|
159
|
-
var message = true;
|
160
|
-
try { expect(false).to(be_true) } catch(e) { message = e }
|
161
|
-
expect(message).to(equal, 'expected false to be true');
|
162
|
-
|
163
|
-
try { expect(true).to_not(be_true) } catch(e) { message = e }
|
164
|
-
expect(message).to(equal, 'expected true to not be true');
|
165
|
-
});
|
166
|
-
});
|
167
|
-
});
|
168
|
-
|
169
|
-
describe('#be_false', function() {
|
170
|
-
it("matches values that are considered false conditions", function() {
|
171
|
-
expect(false).to(be_false);
|
172
|
-
expect(undefined).to(be_false);
|
173
|
-
expect(null).to(be_false);
|
174
|
-
expect(true).to_not(be_false);
|
175
|
-
expect(1).to_not(be_false);
|
176
|
-
});
|
177
|
-
|
178
|
-
describe(".failure_message", function() {
|
179
|
-
it("prints 'expected [actual] to (not) be false", function() {
|
180
|
-
var message = false;
|
181
|
-
try { expect(true).to(be_false) } catch(e) { message = e }
|
182
|
-
expect(message).to(equal, 'expected true to be false');
|
183
|
-
|
184
|
-
try { expect(false).to_not(be_false) } catch(e) { message = e }
|
185
|
-
expect(message).to(equal, 'expected false to not be false');
|
186
|
-
});
|
187
|
-
});
|
188
|
-
});
|
189
|
-
|
190
|
-
describe('#match_selector', function() {
|
191
|
-
var elt;
|
192
|
-
before(function() {
|
193
|
-
elt = $("<div class='foo'></div>");
|
194
|
-
});
|
195
|
-
|
196
|
-
it("matches a jQuery element against the expected selector", function() {
|
197
|
-
expect(elt).to(match_selector, 'div.foo');
|
198
|
-
expect(elt).to_not(match_selector, 'div.bar');
|
199
|
-
});
|
200
|
-
|
201
|
-
describe(".failure_message", function() {
|
202
|
-
it("prints 'expected [actual] to (not) match selector [expected]", function() {
|
203
|
-
var message = false;
|
204
|
-
try { expect(elt).to(match_selector, 'div.bar') } catch(e) { message = e }
|
205
|
-
expect(message).to(equal, 'expected $([ <div class="foo"> ]) to match selector div.bar');
|
206
|
-
|
207
|
-
try { expect(elt).to_not(match_selector, 'div.foo') } catch(e) { message = e }
|
208
|
-
expect(message).to(equal, 'expected $([ <div class="foo"> ]) to not match selector div.foo');
|
209
|
-
});
|
210
|
-
});
|
211
|
-
});
|
212
|
-
|
213
|
-
describe('#contain_selector', function() {
|
214
|
-
var elt;
|
215
|
-
before(function() {
|
216
|
-
elt = $("<div><div class='foo'></div></div>");
|
217
|
-
});
|
218
|
-
|
219
|
-
it("matches a jQuery element against the expected selector", function() {
|
220
|
-
expect(elt).to(contain_selector, 'div.foo');
|
221
|
-
expect(elt).to_not(contain_selector, 'div.bar');
|
222
|
-
});
|
223
|
-
|
224
|
-
describe(".failure_message", function() {
|
225
|
-
it("prints 'expected [actual] to (not) match selector [expected]", function() {
|
226
|
-
var message = false;
|
227
|
-
try { expect(elt).to(contain_selector, 'div.bar') } catch(e) { message = e }
|
228
|
-
expect(message).to(equal, 'expected $([ <div> ]) to contain selector div.bar');
|
229
|
-
|
230
|
-
try { expect(elt).to_not(contain_selector, 'div.foo') } catch(e) { message = e }
|
231
|
-
expect(message).to(equal, 'expected $([ <div> ]) to not contain selector div.foo');
|
232
|
-
});
|
233
|
-
});
|
234
|
-
});
|
235
|
-
|
236
|
-
});
|
237
|
-
});
|
@@ -1,119 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("Print", function() {
|
3
|
-
describe('when given undefined', function() {
|
4
|
-
it("returns 'undefined'", function() {
|
5
|
-
expect($.print(undefined)).to(equal, 'undefined');
|
6
|
-
});
|
7
|
-
});
|
8
|
-
|
9
|
-
describe('when given null', function() {
|
10
|
-
it("returns 'null'", function() {
|
11
|
-
expect($.print(null)).to(equal, 'null');
|
12
|
-
});
|
13
|
-
});
|
14
|
-
|
15
|
-
describe('when given a number', function() {
|
16
|
-
it("returns the string representation of the number", function() {
|
17
|
-
expect($.print(1)).to(equal, '1');
|
18
|
-
expect($.print(1.01)).to(equal, '1.01');
|
19
|
-
expect($.print(-1)).to(equal, '-1');
|
20
|
-
});
|
21
|
-
});
|
22
|
-
|
23
|
-
describe('when given a boolean', function() {
|
24
|
-
it("returns the string representation of the boolean", function() {
|
25
|
-
expect($.print(true)).to(equal, 'true');
|
26
|
-
expect($.print(false)).to(equal, 'false');
|
27
|
-
});
|
28
|
-
});
|
29
|
-
|
30
|
-
describe('when given a string', function() {
|
31
|
-
it("returns the string, quoted", function() {
|
32
|
-
expect($.print('asdf')).to(equal, '"asdf"');
|
33
|
-
});
|
34
|
-
|
35
|
-
describe('when the string is longer than the [max_string] option', function() {
|
36
|
-
it("returns the string, truncated", function() {
|
37
|
-
expect($.print('asdf', { max_string: 3 })).to(equal, '"asd..."');
|
38
|
-
});
|
39
|
-
});
|
40
|
-
|
41
|
-
describe('when the strings has quotes or escaped characters', function() {
|
42
|
-
it("returns the string, with quotes and escaped characters escaped", function() {
|
43
|
-
expect($.print('as"df')).to(equal, '"as\\"df"');
|
44
|
-
expect($.print('as\tdf')).to(equal, '"as\\tdf"');
|
45
|
-
});
|
46
|
-
});
|
47
|
-
});
|
48
|
-
|
49
|
-
describe('when given a function', function() {
|
50
|
-
it("returns the function's signature", function() {
|
51
|
-
expect($.print(function() {})).to(equal, 'function ()');
|
52
|
-
expect($.print(function foo() {})).to(equal, 'function foo()');
|
53
|
-
expect($.print(function foo(bar) {})).to(equal, 'function foo(bar)');
|
54
|
-
});
|
55
|
-
});
|
56
|
-
|
57
|
-
describe('when given an element', function() {
|
58
|
-
it("returns the string representation of the element", function() {
|
59
|
-
expect($.print($('<div>').get(0))).to(equal, '<div>');
|
60
|
-
expect($.print($('<div foo="bar">').get(0))).to(equal, '<div>');
|
61
|
-
});
|
62
|
-
});
|
63
|
-
|
64
|
-
describe('when given an array', function() {
|
65
|
-
it("returns the printed elements, comma separated, encircled by square brackets", function() {
|
66
|
-
expect($.print([])).to(equal, '[]');
|
67
|
-
expect($.print([1])).to(equal, '[ 1 ]');
|
68
|
-
expect($.print([1, 2, 3])).to(equal, '[ 1, 2, 3 ]');
|
69
|
-
});
|
70
|
-
|
71
|
-
describe('when the array is longer than the [max_array] option', function() {
|
72
|
-
it("returns the printed array, truncated", function() {
|
73
|
-
expect($.print([1, 2, 3, 4], { max_array: 2 })).to(equal, '[ 1, 2, 2 more... ]');
|
74
|
-
});
|
75
|
-
});
|
76
|
-
|
77
|
-
describe('when the array has arrays as its elements', function() {
|
78
|
-
it("returns the recursively printed array", function() {
|
79
|
-
expect($.print([[]])).to(equal, '[ [] ]');
|
80
|
-
expect($.print([ [1, 2, 3], 4 ])).to(equal, '[ [ 1, 2, 3 ], 4 ]');
|
81
|
-
});
|
82
|
-
});
|
83
|
-
|
84
|
-
describe('when the array has objects as its elements', function() {
|
85
|
-
it("returns recursively printed array", function() {
|
86
|
-
expect($.print([{}])).to(equal, '[ {} ]');
|
87
|
-
expect($.print([ { foo: 'bar' }, 'baz' ])).to(equal, '[ { foo: "bar" }, "baz" ]');
|
88
|
-
});
|
89
|
-
});
|
90
|
-
});
|
91
|
-
|
92
|
-
describe('when given a jQuery', function() {
|
93
|
-
it("returns the printed array of elements engirthed in '$()' ", function() {
|
94
|
-
expect($.print($('<div>'))).to(equal, '$([ <div> ])');
|
95
|
-
});
|
96
|
-
});
|
97
|
-
|
98
|
-
describe('when given an object', function() {
|
99
|
-
it("returns the keys and values of the object, enraptured with curly braces", function() {
|
100
|
-
expect($.print({})).to(equal, '{}');
|
101
|
-
expect($.print({ foo: 1, bar: 2 })).to(equal, '{ foo: 1, bar: 2 }');
|
102
|
-
});
|
103
|
-
|
104
|
-
describe('when the values of the object are non-primitive', function() {
|
105
|
-
it("recursively prints the keys and values", function() {
|
106
|
-
expect($.print({ foo: [1, 2] })).to(equal, '{ foo: [ 1, 2 ] }');
|
107
|
-
});
|
108
|
-
|
109
|
-
describe('when the object has circular references', function() {
|
110
|
-
it("returns elipses for circularities", function() {
|
111
|
-
var circular = {};
|
112
|
-
circular[0] = circular;
|
113
|
-
expect($.print(circular)).to(equal, '{ 0: { 0: ... } }');
|
114
|
-
});
|
115
|
-
});
|
116
|
-
});
|
117
|
-
});
|
118
|
-
});
|
119
|
-
});
|
File without changes
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<script src="../lib/jquery-1.2.3.js"></script>
|
4
|
-
<script src="../lib/jquery.fn.js"></script>
|
5
|
-
<script src="../lib/jquery.print.js"></script>
|
6
|
-
<script src="../lib/screw.builder.js"></script>
|
7
|
-
<script src="../lib/screw.matchers.js"></script>
|
8
|
-
<script src="../lib/screw.events.js"></script>
|
9
|
-
<script src="../lib/screw.behaviors.js"></script>
|
10
|
-
<script src="spec_helper.js"></script>
|
11
|
-
<script src="behaviors_spec.js"></script>
|
12
|
-
<script src="matchers_spec.js"></script>
|
13
|
-
<script src="print_spec.js"></script>
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../lib/screw.css">
|
16
|
-
</head>
|
17
|
-
<body></body>
|
18
|
-
</html>
|