modjs-architecture 0.3.3 → 0.3.5
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/Gemfile +3 -3
- data/VERSION +1 -1
- data/lib/modjs-architecture.rb +1 -1
- data/modjs-architecture.gemspec +10 -32
- data/spec/templates_spec.rb +24 -12
- metadata +14 -36
- data/spec/tmp/application/myapp.js +0 -322
- data/spec/tmp/application/test.js +0 -1
- data/spec/tmp/application/test.module.js +0 -1
- data/spec/tmp/foo-elements.js +0 -11
- data/spec/tmp/foo.js +0 -9
- data/spec/tmp/foo_all.js +0 -13
- data/spec/tmp/foo_elements.js +0 -11
- data/spec/tmp/foo_model.js +0 -11
- data/spec/tmp/lib/mod.js +0 -320
- data/spec/tmp/modules/test.module.js +0 -1
- data/spec/tmp/myapp.architecture +0 -8
- data/spec/tmp/myapp.blueprint +0 -8
- data/spec/tmp/spec/application_spec.js +0 -23
- data/spec/tmp/spec/dom_spec.js +0 -49
- data/spec/tmp/spec/existence_spec.js +0 -143
- data/spec/tmp/spec/jasmine/MIT.LICENSE +0 -20
- data/spec/tmp/spec/jasmine/index.html +0 -50
- data/spec/tmp/spec/jasmine/jasmine-html.js +0 -190
- data/spec/tmp/spec/jasmine/jasmine.css +0 -166
- data/spec/tmp/spec/jasmine/jasmine.js +0 -2476
- data/spec/tmp/spec/jasmine/jasmine_favicon.png +0 -0
- data/spec/tmp/spec/module_spec.js +0 -76
Binary file
|
@@ -1,76 +0,0 @@
|
|
1
|
-
describe("Mod.Module", function() {
|
2
|
-
var module;
|
3
|
-
|
4
|
-
beforeEach(function() {
|
5
|
-
module = new Mod.Module('foo');
|
6
|
-
});
|
7
|
-
|
8
|
-
it("should require a name", function() {
|
9
|
-
expect(function() {
|
10
|
-
var x = new Mod.Module;
|
11
|
-
}).toThrow("Mod.Module(name): name is undefined");
|
12
|
-
});
|
13
|
-
|
14
|
-
it("should have a dom attribute", function() {
|
15
|
-
expect(module.dom.constructor).toEqual(Mod.DOM);
|
16
|
-
});
|
17
|
-
|
18
|
-
it("should have a name attribute", function() {
|
19
|
-
expect(module.name).toEqual('foo');
|
20
|
-
});
|
21
|
-
|
22
|
-
it("should have a data attribute", function() {
|
23
|
-
expect(module.data).toEqual({});
|
24
|
-
});
|
25
|
-
|
26
|
-
it("should add data with set_data", function() {
|
27
|
-
module.set_data({
|
28
|
-
one: 'one',
|
29
|
-
two: 'two'
|
30
|
-
});
|
31
|
-
module.set_data('three', 'three');
|
32
|
-
expect(module.data.one).toEqual('one');
|
33
|
-
expect(module.data.two).toEqual('two');
|
34
|
-
expect(module.data.three).toEqual('three');
|
35
|
-
});
|
36
|
-
|
37
|
-
it("should have an actions method", function() {
|
38
|
-
expect(module.actions).toBeTruthy();
|
39
|
-
});
|
40
|
-
|
41
|
-
it("should have an execute method to call the actions", function() {
|
42
|
-
module.actions = function() {
|
43
|
-
this.set_data('actions_did_run', true);
|
44
|
-
};
|
45
|
-
module.execute();
|
46
|
-
expect(module.data.actions_did_run).toBeTruthy();
|
47
|
-
});
|
48
|
-
|
49
|
-
it("should have an elements method to cache DOM elements", function() {
|
50
|
-
module.elements({
|
51
|
-
body: document.getElementsByTagName('body')[0],
|
52
|
-
jasmine_content: document.getElementById('jasmine_content')
|
53
|
-
});
|
54
|
-
expect(module.elements('body')).toEqual(document.getElementsByTagName('body')[0]);
|
55
|
-
expect(module.elements('jasmine_content')).toEqual(document.getElementById('jasmine_content'));
|
56
|
-
});
|
57
|
-
|
58
|
-
it("should get all the elements", function() {
|
59
|
-
module.elements({
|
60
|
-
body: document.getElementsByTagName('body')[0],
|
61
|
-
jasmine_content: document.getElementById('jasmine_content')
|
62
|
-
});
|
63
|
-
expect(module.elements()).toEqual({
|
64
|
-
body: document.getElementsByTagName('body')[0],
|
65
|
-
jasmine_content: document.getElementById('jasmine_content')
|
66
|
-
});
|
67
|
-
});
|
68
|
-
|
69
|
-
it("should run the execute method when the dom is ready", function() {
|
70
|
-
module.actions = function() {
|
71
|
-
this.set_data('actions_did_run', true);
|
72
|
-
expect(module.data.actions_did_run).toBeTruthy();
|
73
|
-
};
|
74
|
-
module.run();
|
75
|
-
});
|
76
|
-
});
|