ninjs 0.14.1 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -2
- data/.travis.yml +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +13 -11
- data/README.md +108 -93
- data/Rakefile +17 -7
- data/VERSION +1 -1
- data/bin/ninjs +24 -22
- data/lib/ninjs/command.rb +32 -21
- data/lib/ninjs/configuration.rb +35 -53
- data/lib/ninjs/generator.rb +6 -6
- data/lib/ninjs/notification.rb +5 -5
- data/lib/ninjs/project.rb +31 -25
- data/ninjs.gemspec +18 -142
- data/repository/ninjs/core/application.js +13 -24
- data/repository/ninjs/core/dom.js +87 -68
- data/repository/ninjs/core/existence.js +44 -105
- data/repository/ninjs/core/extend.js +11 -32
- data/repository/ninjs/core/module.js +53 -107
- data/repository/ninjs/core/nin.js +5 -7
- data/repository/ninjs/tests/extension.test.js +0 -10
- data/repository/ninjs/tests/index.html +19 -20
- data/repository/ninjs/tests/module.test.js +52 -56
- data/repository/ninjs/utilities/array.js +8 -8
- data/repository/ninjs/utilities/cookie.js +59 -0
- data/repository/ninjs/utilities/css.js +7 -7
- data/repository/ninjs/utilities/number.js +2 -2
- data/repository/ninjs/utilities/string.js +26 -26
- data/spec/cli_spec.rb +90 -88
- data/spec/command_spec.rb +104 -137
- data/spec/configuration_spec.rb +23 -37
- data/spec/fixtures/_global.module.js +9 -0
- data/spec/fixtures/compressed.myapp.js +23 -44
- data/spec/fixtures/foo.elements.js +1 -1
- data/spec/fixtures/foo.js +5 -5
- data/spec/fixtures/foo.model.js +1 -1
- data/spec/fixtures/foo.module.js +3 -3
- data/spec/fixtures/hello.elements.js +1 -1
- data/spec/fixtures/hello.js +5 -5
- data/spec/fixtures/hello.model.js +1 -1
- data/spec/fixtures/hello.module.js +3 -3
- data/spec/fixtures/myapp.initial.js +198 -329
- data/spec/fixtures/myapp.js +285 -357
- data/spec/fixtures/mymodule.alias.module.js +2 -2
- data/spec/fixtures/mymodule.dependencies.module.js +2 -2
- data/spec/fixtures/mymodule.elements.js +1 -1
- data/spec/fixtures/mymodule.model.js +1 -1
- data/spec/fixtures/mymodule.module.js +2 -2
- data/spec/fixtures/mymodule.module_alias.module.js +10 -0
- data/spec/fixtures/new.ninjs.conf +2 -0
- data/spec/fixtures/nin.js +198 -329
- data/spec/fixtures/ninjs.conf +2 -0
- data/spec/fixtures/updated.ninjs.conf +8 -0
- data/spec/generator_spec.rb +37 -26
- data/spec/ninjs_spec.rb +6 -6
- data/spec/project_spec.rb +229 -221
- data/spec/spec_helper.rb +3 -1
- data/spec/testspec_spec.rb +7 -0
- metadata +28 -145
- data/repository/json2.js +0 -482
- data/repository/modernizr/1.5.js +0 -28
- data/repository/modernizr/latest.js +0 -1
- data/repository/ninjs/docs/Data/ClassHierarchy.nd +0 -0
- data/repository/ninjs/docs/Data/ConfigFileInfo.nd +0 -0
- data/repository/ninjs/docs/Data/FileInfo.nd +0 -16
- data/repository/ninjs/docs/Data/ImageFileInfo.nd +0 -0
- data/repository/ninjs/docs/Data/ImageReferenceTable.nd +0 -0
- data/repository/ninjs/docs/Data/IndexInfo.nd +0 -0
- data/repository/ninjs/docs/Data/PreviousMenuState.nd +0 -0
- data/repository/ninjs/docs/Data/PreviousSettings.nd +0 -0
- data/repository/ninjs/docs/Data/SymbolTable.nd +0 -0
- data/repository/ninjs/docs/Languages.txt +0 -113
- data/repository/ninjs/docs/Menu.txt +0 -63
- data/repository/ninjs/docs/Topics.txt +0 -81
- data/repository/ninjs/docs/files/core/application-js.html +0 -44
- data/repository/ninjs/docs/files/core/existence-js.html +0 -60
- data/repository/ninjs/docs/files/core/extend-js.html +0 -55
- data/repository/ninjs/docs/files/core/module-js.html +0 -80
- data/repository/ninjs/docs/files/core/nin-js.html +0 -38
- data/repository/ninjs/docs/index.html +0 -1
- data/repository/ninjs/docs/index/Classes.html +0 -33
- data/repository/ninjs/docs/index/Files.html +0 -45
- data/repository/ninjs/docs/index/Functions.html +0 -65
- data/repository/ninjs/docs/index/General.html +0 -85
- data/repository/ninjs/docs/index/Variables.html +0 -45
- data/repository/ninjs/docs/javascript/main.js +0 -841
- data/repository/ninjs/docs/javascript/prettify.js +0 -1526
- data/repository/ninjs/docs/javascript/searchdata.js +0 -152
- data/repository/ninjs/docs/search/ClassesN.html +0 -20
- data/repository/ninjs/docs/search/FilesA.html +0 -20
- data/repository/ninjs/docs/search/FilesE.html +0 -20
- data/repository/ninjs/docs/search/FilesM.html +0 -20
- data/repository/ninjs/docs/search/FilesN.html +0 -20
- data/repository/ninjs/docs/search/FunctionsA.html +0 -20
- data/repository/ninjs/docs/search/FunctionsC.html +0 -20
- data/repository/ninjs/docs/search/FunctionsE.html +0 -20
- data/repository/ninjs/docs/search/FunctionsI.html +0 -20
- data/repository/ninjs/docs/search/FunctionsM.html +0 -20
- data/repository/ninjs/docs/search/FunctionsR.html +0 -20
- data/repository/ninjs/docs/search/FunctionsS.html +0 -20
- data/repository/ninjs/docs/search/FunctionsSymbols.html +0 -20
- data/repository/ninjs/docs/search/FunctionsU.html +0 -20
- data/repository/ninjs/docs/search/GeneralA.html +0 -20
- data/repository/ninjs/docs/search/GeneralC.html +0 -20
- data/repository/ninjs/docs/search/GeneralD.html +0 -20
- data/repository/ninjs/docs/search/GeneralE.html +0 -20
- data/repository/ninjs/docs/search/GeneralF.html +0 -20
- data/repository/ninjs/docs/search/GeneralI.html +0 -20
- data/repository/ninjs/docs/search/GeneralM.html +0 -20
- data/repository/ninjs/docs/search/GeneralN.html +0 -20
- data/repository/ninjs/docs/search/GeneralR.html +0 -20
- data/repository/ninjs/docs/search/GeneralS.html +0 -20
- data/repository/ninjs/docs/search/GeneralSymbols.html +0 -20
- data/repository/ninjs/docs/search/GeneralT.html +0 -20
- data/repository/ninjs/docs/search/GeneralU.html +0 -20
- data/repository/ninjs/docs/search/GeneralV.html +0 -20
- data/repository/ninjs/docs/search/NoResults.html +0 -15
- data/repository/ninjs/docs/search/VariablesD.html +0 -20
- data/repository/ninjs/docs/search/VariablesN.html +0 -20
- data/repository/ninjs/docs/search/VariablesR.html +0 -20
- data/repository/ninjs/docs/search/VariablesT.html +0 -20
- data/repository/ninjs/docs/styles/main.css +0 -828
- data/repository/nullconsole.js +0 -7
- data/repository/qunit/assets/css/qunit.css +0 -196
- data/repository/qunit/qunit.js +0 -1374
- data/repository/selectivizr/1.0.js +0 -5
- data/repository/selectivizr/latest.js +0 -1
- data/repository/syntaxhighlighter/all.js +0 -11
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCore.css +0 -226
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDefault.css +0 -328
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreDjango.css +0 -331
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEclipse.css +0 -339
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreEmacs.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMDUltra.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreMidnight.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shCoreRDark.css +0 -324
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDefault.css +0 -117
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeDjango.css +0 -120
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEclipse.css +0 -128
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeEmacs.css +0 -113
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMDUltra.css +0 -113
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeMidnight.css +0 -113
- data/repository/syntaxhighlighter/assets/css/syntaxhighlighter/shThemeRDark.css +0 -113
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCore.scss +0 -216
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDefault.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreDjango.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEclipse.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreEmacs.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreFadeToGrey.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMDUltra.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreMidnight.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shCoreRDark.scss +0 -2
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDefault.scss +0 -7
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeDjango.scss +0 -36
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEclipse.scss +0 -48
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeEmacs.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeFadeToGrey.scss +0 -36
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMDUltra.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeMidnight.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_shThemeRDark.scss +0 -32
- data/repository/syntaxhighlighter/assets/scss/syntaxhighlighter/_theme_template.scss +0 -120
- data/repository/syntaxhighlighter/shAutoloader.js +0 -17
- data/repository/syntaxhighlighter/shBrushAS3.js +0 -59
- data/repository/syntaxhighlighter/shBrushAppleScript.js +0 -75
- data/repository/syntaxhighlighter/shBrushBash.js +0 -59
- data/repository/syntaxhighlighter/shBrushCSharp.js +0 -65
- data/repository/syntaxhighlighter/shBrushColdFusion.js +0 -100
- data/repository/syntaxhighlighter/shBrushCpp.js +0 -97
- data/repository/syntaxhighlighter/shBrushCss.js +0 -91
- data/repository/syntaxhighlighter/shBrushDelphi.js +0 -55
- data/repository/syntaxhighlighter/shBrushDiff.js +0 -41
- data/repository/syntaxhighlighter/shBrushErlang.js +0 -52
- data/repository/syntaxhighlighter/shBrushGroovy.js +0 -67
- data/repository/syntaxhighlighter/shBrushJScript.js +0 -52
- data/repository/syntaxhighlighter/shBrushJava.js +0 -57
- data/repository/syntaxhighlighter/shBrushJavaFX.js +0 -58
- data/repository/syntaxhighlighter/shBrushPerl.js +0 -72
- data/repository/syntaxhighlighter/shBrushPhp.js +0 -88
- data/repository/syntaxhighlighter/shBrushPlain.js +0 -33
- data/repository/syntaxhighlighter/shBrushPowerShell.js +0 -74
- data/repository/syntaxhighlighter/shBrushPython.js +0 -64
- data/repository/syntaxhighlighter/shBrushRuby.js +0 -55
- data/repository/syntaxhighlighter/shBrushSass.js +0 -94
- data/repository/syntaxhighlighter/shBrushScala.js +0 -51
- data/repository/syntaxhighlighter/shBrushSql.js +0 -66
- data/repository/syntaxhighlighter/shBrushVb.js +0 -56
- data/repository/syntaxhighlighter/shBrushXml.js +0 -69
- data/repository/syntaxhighlighter/shCore.js +0 -17
- data/repository/syntaxhighlighter/shLegacy.js +0 -17
@@ -1,121 +1,60 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
}
|
6
|
-
|
7
|
-
if (!is_defined(window.is_undefined)) {
|
8
|
-
window.is_undefined = function(suspect) {
|
9
|
-
return (suspect === undefined) ? true : false;
|
10
|
-
};
|
11
|
-
}
|
1
|
+
is_defined = function(suspect) {
|
2
|
+
return ((suspect === undefined) || (suspect === null)) ? false : true;
|
3
|
+
};
|
12
4
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
throw new SyntaxError("is_typeof(Type, suspect): type is undefined");
|
17
|
-
}
|
18
|
-
if (is_undefined(suspect)) {
|
19
|
-
throw new SyntaxError("is_typeof(Type, suspect): suspect is undefined");
|
20
|
-
}
|
5
|
+
is_undefined = function(suspect) {
|
6
|
+
return (suspect === undefined) ? true : false;
|
7
|
+
};
|
21
8
|
|
22
|
-
|
23
|
-
|
9
|
+
is_typeof = function(type, suspect) {
|
10
|
+
if (is_undefined(type)) {
|
11
|
+
throw new SyntaxError("is_typeof(Type, suspect): type is undefined");
|
24
12
|
}
|
25
|
-
|
26
|
-
|
27
|
-
window.is_numeric = function(suspect) {
|
28
|
-
if(is_typeof(Number, suspect)) {
|
29
|
-
return true;
|
30
|
-
}
|
31
|
-
else {
|
32
|
-
var pattern = /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i;
|
33
|
-
return pattern.test(suspect);
|
34
|
-
}
|
35
|
-
};
|
13
|
+
if (is_undefined(suspect)) {
|
14
|
+
throw new SyntaxError("is_typeof(Type, suspect): suspect is undefined");
|
36
15
|
}
|
37
16
|
|
38
|
-
|
39
|
-
|
40
|
-
return is_typeof(String, suspect);
|
41
|
-
};
|
42
|
-
}
|
17
|
+
return (suspect.constructor == type) ? true : false;
|
18
|
+
};
|
43
19
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
};
|
20
|
+
is_numeric = function(suspect) {
|
21
|
+
if(is_typeof(Number, suspect)) {
|
22
|
+
return true;
|
48
23
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
return is_typeof(Number, suspect);
|
53
|
-
};
|
24
|
+
else {
|
25
|
+
var pattern = /^-?\d+(?:\.\d*)?(?:e[+\-]?\d+)?$/i;
|
26
|
+
return pattern.test(suspect);
|
54
27
|
}
|
28
|
+
};
|
55
29
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
};
|
60
|
-
}
|
30
|
+
is_string = function(suspect) {
|
31
|
+
return is_typeof(String, suspect);
|
32
|
+
};
|
61
33
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
};
|
66
|
-
}
|
34
|
+
is_array = function(suspect) {
|
35
|
+
return is_typeof(Array, suspect);
|
36
|
+
};
|
67
37
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
};
|
72
|
-
}
|
38
|
+
is_number = function(suspect) {
|
39
|
+
return is_typeof(Number, suspect);
|
40
|
+
};
|
73
41
|
|
42
|
+
is_date = function(suspect) {
|
43
|
+
return is_typeof(Date, suspect);
|
44
|
+
};
|
74
45
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
};
|
79
|
-
}
|
80
|
-
|
81
|
-
if (is_undefined(window.is_not_empty)) {
|
82
|
-
window.is_not_empty = function(suspect) {
|
83
|
-
return suspect.length >= 1;
|
84
|
-
};
|
85
|
-
}
|
86
|
-
|
87
|
-
if (is_undefined(Function.prototype['method'])) {
|
88
|
-
Function.prototype.method = function(name, func) {
|
89
|
-
if (is_undefined(name)) {
|
90
|
-
throw new SyntaxError("Object.method(name, func): name is undefined");
|
91
|
-
}
|
46
|
+
is_bool = function(suspect) {
|
47
|
+
return is_typeof(Boolean, suspect);
|
48
|
+
};
|
92
49
|
|
93
|
-
|
94
|
-
|
95
|
-
|
50
|
+
is_regex = function(suspect) {
|
51
|
+
return is_typeof(RegExp, suspect);
|
52
|
+
};
|
96
53
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
}
|
101
|
-
};
|
102
|
-
}
|
103
|
-
|
104
|
-
if (is_undefined(window.unless)) {
|
105
|
-
window.unless = function(expression, callback, fallback) {
|
106
|
-
if (is_undefined(expression)) {
|
107
|
-
throw new SyntaxError("unless(expression, callback[, fallback]): expression is undefined");
|
108
|
-
}
|
54
|
+
is_empty = function(suspect) {
|
55
|
+
return suspect.length === 0;
|
56
|
+
};
|
109
57
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
if (!expression) {
|
115
|
-
callback.call(this);
|
116
|
-
}
|
117
|
-
else if (is_defined(fallback)) {
|
118
|
-
fallback.call(this);
|
119
|
-
}
|
120
|
-
};
|
121
|
-
}
|
58
|
+
is_not_empty = function(suspect) {
|
59
|
+
return suspect.length >= 1;
|
60
|
+
};
|
@@ -1,35 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
throw new SyntaxError("Object.method(name, func): name is undefined");
|
5
|
-
}
|
6
|
-
|
7
|
-
if (is_undefined(func)) {
|
8
|
-
throw new SyntaxError("Object.method(name, func): func is undefined");
|
9
|
-
}
|
10
|
-
|
11
|
-
if (is_undefined(this.prototype[name])) {
|
12
|
-
this.prototype[name] = func;
|
13
|
-
return this;
|
14
|
-
}
|
15
|
-
};
|
1
|
+
unless = function(expression, callback, fallback) {
|
2
|
+
if (is_undefined(callback)) {
|
3
|
+
throw new SyntaxError("unless(expression, callback[, fallback]): callback is undefined");
|
16
4
|
}
|
17
5
|
|
18
|
-
if (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
throw new SyntaxError("unless(expression, callback[, fallback]): callback is undefined");
|
26
|
-
}
|
27
|
-
|
28
|
-
if (!expression) {
|
29
|
-
callback.call(this);
|
30
|
-
}
|
31
|
-
else if (is_defined(fallback)) {
|
32
|
-
fallback.call(this);
|
33
|
-
}
|
34
|
-
};
|
6
|
+
if (!!!expression) {
|
7
|
+
callback.call(this);
|
8
|
+
}
|
9
|
+
else {
|
10
|
+
if (is_defined(fallback)) {
|
11
|
+
fallback.call(this);
|
12
|
+
}
|
35
13
|
}
|
14
|
+
};
|
@@ -1,120 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
this.run_tests = false;
|
7
|
-
this.tests = [];
|
8
|
-
};
|
1
|
+
NinjsModule = function(name) {
|
2
|
+
this.dom = new NinjsDOM(this);
|
3
|
+
this.data = {};
|
4
|
+
this.name = name;
|
5
|
+
};
|
9
6
|
|
10
|
-
|
7
|
+
NinjsModule.prototype.actions = function() {};
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
});
|
17
|
-
});
|
18
|
-
|
19
|
-
NinjsModule.method('execute', function() {
|
20
|
-
if (this.run_tests) {
|
21
|
-
this._run_tests();
|
22
|
-
}
|
23
|
-
|
24
|
-
this.actions();
|
9
|
+
NinjsModule.prototype.run = function() {
|
10
|
+
var mod = this;
|
11
|
+
this.dom.ready(function() {
|
12
|
+
mod.execute();
|
25
13
|
});
|
14
|
+
};
|
26
15
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
throw new SyntaxError("NinjsModule.elements(elements): elements is undefined");
|
31
|
-
}
|
32
|
-
else if (is_string(elements)) {
|
33
|
-
throw new SyntaxError("NinjsModule.elements(name): name is undefined");
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
if (is_string(elements)) {
|
38
|
-
var name = elements;
|
39
|
-
return this.dom.cached_selectors[name];
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
var dom = this.dom;
|
43
|
-
dom.ready(function() {
|
44
|
-
for(var key in elements) {
|
45
|
-
if (elements.hasOwnProperty(key)) {
|
46
|
-
dom.cached_selectors[key] = elements[key];
|
47
|
-
}
|
48
|
-
}
|
49
|
-
});
|
50
|
-
}
|
51
|
-
});
|
16
|
+
NinjsModule.prototype.execute = function() {
|
17
|
+
this.actions();
|
18
|
+
};
|
52
19
|
|
53
|
-
|
54
|
-
|
55
|
-
|
20
|
+
NinjsModule.prototype.elements = function(elements) {
|
21
|
+
if (is_undefined(elements)) {
|
22
|
+
if (is_typeof(Object, elements)) {
|
23
|
+
throw new SyntaxError("NinjsModule.elements(elements): elements is undefined");
|
56
24
|
}
|
57
|
-
|
58
|
-
|
59
|
-
throw new SyntaxError('NinjsModule.set_data(key, value): value is undefined');
|
25
|
+
else if (is_string(elements)) {
|
26
|
+
throw new SyntaxError("NinjsModule.elements(name): name is undefined");
|
60
27
|
}
|
28
|
+
}
|
61
29
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
30
|
+
if (is_string(elements)) {
|
31
|
+
var name = elements;
|
32
|
+
return this.dom.cached_selectors[name];
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
var dom = this.dom;
|
36
|
+
dom.ready(function() {
|
37
|
+
for(var key in elements) {
|
38
|
+
if (elements.hasOwnProperty(key)) {
|
39
|
+
dom.cached_selectors[key] = elements[key];
|
40
|
+
}
|
69
41
|
}
|
70
|
-
}
|
71
|
-
|
72
|
-
|
73
|
-
});
|
42
|
+
});
|
43
|
+
}
|
44
|
+
};
|
74
45
|
|
75
|
-
|
76
|
-
|
77
|
-
|
46
|
+
NinjsModule.prototype.set_data = function(key, value) {
|
47
|
+
if (is_undefined(key)) {
|
48
|
+
throw new SyntaxError('NinjsModule.set_data(key, value): key is undefined');
|
49
|
+
}
|
78
50
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
test_template.push('<h1 id="qunit-header">' + this.name + ' module tests</h1>');
|
83
|
-
test_template.push('<h2 id="qunit-banner"></h2>');
|
84
|
-
test_template.push('<h2 id="qunit-userAgent"></h2>');
|
85
|
-
test_template.push('<ol id="qunit-tests"></ol>');
|
86
|
-
test_template.push('</div>');
|
51
|
+
if (is_typeof(String, key) && is_undefined(value)) {
|
52
|
+
throw new SyntaxError('NinjsModule.set_data(key, value): value is undefined');
|
53
|
+
}
|
87
54
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
55
|
+
if (is_typeof(String, key)) {
|
56
|
+
this.data[key] = value;
|
57
|
+
}
|
58
|
+
else if (is_typeof(Object, key)) {
|
59
|
+
var data = key;
|
60
|
+
for(var property in data) {
|
61
|
+
this.data[property] = data[property];
|
62
|
+
}
|
63
|
+
}
|
93
64
|
|
94
|
-
|
95
|
-
|
96
|
-
var test_results_dialog = $('.test-results');
|
97
|
-
var height = $(window).height() - 200;
|
98
|
-
var width = $(window).width() - 300;
|
99
|
-
try {
|
100
|
-
test_results_dialog.dialog({
|
101
|
-
width: width,
|
102
|
-
height: height,
|
103
|
-
autoOpen: false,
|
104
|
-
buttons: {
|
105
|
-
"Thanks buddy": function() {
|
106
|
-
test_results_dialog.dialog('close');
|
107
|
-
}
|
108
|
-
}
|
109
|
-
});
|
110
|
-
var failed = $('.failed');
|
111
|
-
console.log(failed.html());
|
112
|
-
test_results_dialog.dialog('open');
|
113
|
-
}
|
114
|
-
catch(error) {
|
115
|
-
alert("Test harness requires jQueryUI");
|
116
|
-
}
|
117
|
-
});
|
118
|
-
});
|
119
|
-
});
|
120
|
-
|
65
|
+
return this;
|
66
|
+
};
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
//= require "application"
|
7
|
-
})();
|
1
|
+
//= require "existence"
|
2
|
+
//= require "extend"
|
3
|
+
//= require "dom"
|
4
|
+
//= require "module"
|
5
|
+
//= require "application"
|
@@ -1,15 +1,5 @@
|
|
1
1
|
var spec = new QSpec("Extensions");
|
2
2
|
|
3
|
-
spec.should("add 'method' to the Function prototype", function() {
|
4
|
-
ok(is_defined(Function.prototype.method), "Object.prototype.method is defined");
|
5
|
-
|
6
|
-
String.method('test_method', function() {
|
7
|
-
return 'This is a test';
|
8
|
-
});
|
9
|
-
|
10
|
-
equals('Hello'.test_method(), 'This is a test', 'can create a prototype method with method');
|
11
|
-
});
|
12
|
-
|
13
3
|
spec.should("test a condition with unless", function() {
|
14
4
|
var is_true = false;
|
15
5
|
|
@@ -1,27 +1,26 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<head>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<script src="qspec.js"></script>
|
3
|
+
<title>All Ninjs tests</title>
|
4
|
+
|
5
|
+
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen"/>
|
6
|
+
|
7
|
+
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
|
8
|
+
<script src="http://code.jquery.com/qunit/qunit-git.js"></script>
|
9
|
+
<script src="qspec.js"></script>
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
<script src="../lib/nin.js"></script>
|
12
|
+
<script src="../lib/utilities.js"></script>
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
<script src="existence.test.js"></script>
|
15
|
+
<script src="extension.test.js"></script>
|
16
|
+
<script src="application.test.js"></script>
|
17
|
+
<script src="module.test.js"></script>
|
18
|
+
<script src="string.utilities.test.js"></script>
|
19
|
+
<script src="array.utilities.test.js"></script>
|
21
20
|
</head>
|
22
21
|
<body>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
<h1 id="qunit-header">Ninjs tests</h1>
|
23
|
+
<h2 id="qunit-banner"></h2>
|
24
|
+
<h2 id="qunit-userAgent"></h2>
|
25
|
+
<ol id="qunit-tests"></ol>
|
27
26
|
</body>
|