eyeballs 0.5.10.1 → 0.5.11
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/CHANGELOG +7 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +18 -9
- data/README.md +25 -21
- data/Rakefile +1 -1
- data/dist/jquery/jquery.ba-bbq.min.js +18 -0
- data/eyeballs.gemspec +4 -4
- data/lib/eyeballs/app_generator.rb +1 -0
- data/spec/app_generator_spec.rb +8 -7
- data/spec/rack_app_detector_spec.rb +1 -1
- data/src/drivers/jquery/modules/o_O.routes.js +0 -1
- data/src/drivers/jquery/modules/o_O.support.js +34 -11
- data/src/modules/o_O.model.js +1 -1
- data/src/o_O.js +5 -1
- data/templates/scaffold_index.html +1 -0
- data/test/unit/test_dom.html +0 -1
- data/test/unit/test_dom_with_callbacks.html +0 -2
- data/test/unit/test_localstorage.html +0 -1
- data/test/unit/test_model.html +12 -8
- data/test/unit/test_model_with_callbacks.html +0 -2
- data/test/unit/test_params.html +71 -0
- data/test/unit/test_rest.html +0 -1
- data/test/unit/test_routing.html +1 -1
- metadata +6 -7
- data/dist/jquery/jquery.ba-hashchange.js +0 -245
- data/test/unit/test_form.html +0 -47
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,7 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
activesupport (3.0.0)
|
5
|
+
archive-tar-minitar (0.5.2)
|
5
6
|
columnize (0.3.1)
|
6
7
|
gemcutter (0.6.1)
|
7
8
|
git (1.2.5)
|
@@ -10,14 +11,21 @@ GEM
|
|
10
11
|
git (>= 1.2.5)
|
11
12
|
rubyforge (>= 2.0.0)
|
12
13
|
json_pure (1.4.6)
|
13
|
-
|
14
|
+
linecache19 (0.5.11)
|
15
|
+
ruby_core_source (>= 0.1.4)
|
14
16
|
rack (1.2.1)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
rake (0.8.7)
|
18
|
+
rspec (1.3.1)
|
19
|
+
ruby-debug-base19 (0.11.24)
|
20
|
+
columnize (>= 0.3.1)
|
21
|
+
linecache19 (>= 0.5.11)
|
22
|
+
ruby_core_source (>= 0.1.4)
|
23
|
+
ruby-debug19 (0.11.6)
|
24
|
+
columnize (>= 0.3.1)
|
25
|
+
linecache19 (>= 0.5.11)
|
26
|
+
ruby-debug-base19 (>= 0.11.19)
|
27
|
+
ruby_core_source (0.1.4)
|
28
|
+
archive-tar-minitar (>= 0.5.2)
|
21
29
|
rubyforge (2.0.4)
|
22
30
|
json_pure (>= 1.1.7)
|
23
31
|
sinatra (1.0)
|
@@ -30,7 +38,8 @@ PLATFORMS
|
|
30
38
|
DEPENDENCIES
|
31
39
|
activesupport
|
32
40
|
jeweler
|
33
|
-
|
34
|
-
|
41
|
+
rake
|
42
|
+
rspec (= 1.3.1)
|
43
|
+
ruby-debug19
|
35
44
|
sinatra
|
36
45
|
thor
|
data/README.md
CHANGED
@@ -45,31 +45,35 @@ At a very minimum, you should choose an adapter. There are a few to choose from:
|
|
45
45
|
- **o\_O.couchdb** - persist records to a local CouchDB instance, for building MVC CouchApps, for example.
|
46
46
|
- **o\_O.rest** - An adapter for persisting models to a backend powered by Rails, or using Rails-style RESTful routing.
|
47
47
|
|
48
|
-
Finally, you need a controller. The first release of eyeballs.js includes a controller as part of the jQuery driver.
|
48
|
+
Finally, you need a controller. The first release of eyeballs.js includes a controller as part of the jQuery driver.
|
49
49
|
|
50
50
|
You can also use a javascript templating language. Mustache.js fits this need quite nicely.
|
51
51
|
|
52
52
|
Wrapping that all up, to use eyeballs.js with the Rails adapter and jQuery:
|
53
53
|
|
54
54
|
<!-- jQuery and livequery -->
|
55
|
-
<script src="
|
56
|
-
<script src="jquery.
|
55
|
+
<script src="vendor/javascripts/jquery.1.4.min.js"></script>
|
56
|
+
<script src="vendor/jquery/jquery.ba-bbq.min.js"></script>
|
57
57
|
|
58
58
|
<!-- Mustache for templating -->
|
59
|
-
<script src="mustache.js"></script>
|
59
|
+
<script src="vendor/mustache/mustache.0.3.0.js"></script>
|
60
60
|
|
61
61
|
<!-- eyeballs.js basic -->
|
62
|
-
<script src="o_O.js"></script>
|
63
|
-
<script src="modules/o_O.model.js"></script>
|
64
|
-
<script src="modules/o_O.validations.js"></script>
|
62
|
+
<script src="vendor/eyeballs/o_O.js"></script>
|
63
|
+
<script src="vendor/eyeballs/modules/o_O.model.js"></script>
|
64
|
+
<script src="vendor/eyeballs/modules/o_O.validations.js"></script>
|
65
65
|
|
66
66
|
<!-- eyeballs.js jquery driver for controller logic -->
|
67
|
-
<script src="drivers/jquery/modules/o_O.controller.js"></script>
|
68
|
-
<script src="drivers/jquery/modules/o_O.support.js"></script>
|
69
|
-
<script src="drivers/jquery/modules/o_O.routes.js"></script>
|
67
|
+
<script src="vendor/eyeballs/drivers/jquery/modules/o_O.controller.js"></script>
|
68
|
+
<script src="vendor/eyeballs/drivers/jquery/modules/o_O.support.js"></script>
|
69
|
+
<script src="vendor/eyeballs/drivers/jquery/modules/o_O.routes.js"></script>
|
70
70
|
|
71
71
|
<!-- REST adapter -->
|
72
|
-
<script src="drivers/jquery/adapters/o_O.rest.js"></script>
|
72
|
+
<script src="vendor/eyeballs/drivers/jquery/adapters/o_O.rest.js"></script>
|
73
|
+
|
74
|
+
<!-- Configuration -->
|
75
|
+
<script src="config/initializer.js"></script>
|
76
|
+
<script src="config/routes.js"></script>
|
73
77
|
|
74
78
|
Badabing, badaboom! You're now ready to start creating some models and controllers.
|
75
79
|
|
@@ -106,7 +110,7 @@ Models
|
|
106
110
|
|
107
111
|
You define a model by passing a name and function to the eyeballs ( o_O ) function (pronounced 'eep eep'). As inspired by Rails, model definitions are capitalised. Note, however, that the new prefix is not used.
|
108
112
|
|
109
|
-
o_O('Post', function(
|
113
|
+
o_O('Post', function(){ })
|
110
114
|
|
111
115
|
You can now initialize an individual post:
|
112
116
|
|
@@ -117,8 +121,8 @@ Not very exciting.
|
|
117
121
|
|
118
122
|
However, if you're familiar with Rails, you'll be familiar with the wonderful syntax for adding validations to your models. eyeballs.js lets you add validations to your models as follows:
|
119
123
|
|
120
|
-
o_O('Post', function(
|
121
|
-
|
124
|
+
o_O('Post', function(){
|
125
|
+
this.validates_presence_of('title')
|
122
126
|
})
|
123
127
|
|
124
128
|
Now, when you initialize a new Post, you can validate it, nice and easy:
|
@@ -133,8 +137,8 @@ and so on, so forth. This will be very familiar to those who use Rails.
|
|
133
137
|
|
134
138
|
You can also add your own validations, again, similar to how Rails does things:
|
135
139
|
|
136
|
-
o_O('Post', function(
|
137
|
-
|
140
|
+
o_O('Post', function(){
|
141
|
+
this.validates(function(post){
|
138
142
|
if(post.title != 'Awesome')
|
139
143
|
{
|
140
144
|
post.errors.push({message: 'Not Awesome Enough'})
|
@@ -161,8 +165,8 @@ When you want to find things:
|
|
161
165
|
|
162
166
|
And if you want to add your own methods:
|
163
167
|
|
164
|
-
o_O('Post', function(
|
165
|
-
|
168
|
+
o_O('Post', function(){
|
169
|
+
this.methods.title_downcased: function(){
|
166
170
|
this.title.toLowerCase();
|
167
171
|
}
|
168
172
|
})
|
@@ -298,9 +302,9 @@ Imagine a simple app for posting reviews. It will comprise a "Review" model, "Re
|
|
298
302
|
|
299
303
|
`models/review.js` looks like this:
|
300
304
|
|
301
|
-
o_O('Review', function(
|
302
|
-
|
303
|
-
|
305
|
+
o_O('Review', function(){
|
306
|
+
this.validates_presence_of('title');
|
307
|
+
this.validates_presence_of('content');
|
304
308
|
});
|
305
309
|
|
306
310
|
This defines the Review model, allowing us to initialize and save Review objects, while ensuring `title` and `content` are included.
|
data/Rakefile
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
|
3
|
+
* http://benalman.com/projects/jquery-bbq-plugin/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
6
|
+
* Dual licensed under the MIT and GPL licenses.
|
7
|
+
* http://benalman.com/about/license/
|
8
|
+
*/
|
9
|
+
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
|
10
|
+
/*
|
11
|
+
* jQuery hashchange event - v1.2 - 2/11/2010
|
12
|
+
* http://benalman.com/projects/jquery-hashchange-plugin/
|
13
|
+
*
|
14
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
15
|
+
* Dual licensed under the MIT and GPL licenses.
|
16
|
+
* http://benalman.com/about/license/
|
17
|
+
*/
|
18
|
+
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);
|
data/eyeballs.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{eyeballs}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Paul Campbell"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-28}
|
13
13
|
s.default_executable = %q{eyeballs}
|
14
14
|
s.email = %q{paul@rslw.com}
|
15
15
|
s.executables = ["eyeballs"]
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"bin/eyeballs",
|
28
28
|
"config.ru",
|
29
29
|
"dist/jquery/jquery-1.4.2.min.js",
|
30
|
-
"dist/jquery/jquery.ba-
|
30
|
+
"dist/jquery/jquery.ba-bbq.min.js",
|
31
31
|
"dist/mustache/mustache.0.3.0.js",
|
32
32
|
"eyeballs.gemspec",
|
33
33
|
"lib/eyeballs.rb",
|
@@ -64,10 +64,10 @@ Gem::Specification.new do |s|
|
|
64
64
|
"test/unit/test_controller.html",
|
65
65
|
"test/unit/test_dom.html",
|
66
66
|
"test/unit/test_dom_with_callbacks.html",
|
67
|
-
"test/unit/test_form.html",
|
68
67
|
"test/unit/test_localstorage.html",
|
69
68
|
"test/unit/test_model.html",
|
70
69
|
"test/unit/test_model_with_callbacks.html",
|
70
|
+
"test/unit/test_params.html",
|
71
71
|
"test/unit/test_rest.html",
|
72
72
|
"test/unit/test_routing.html"
|
73
73
|
]
|
@@ -19,6 +19,7 @@ module Eyeballs
|
|
19
19
|
directory "templates/app_root", new_app_path
|
20
20
|
copy_file 'dist/jquery/jquery-1.4.2.min.js', "#{new_app_path}/vendor/jquery/jquery-1.4.2.min.js"
|
21
21
|
copy_file 'dist/mustache/mustache.0.3.0.js', "#{new_app_path}/vendor/mustache/mustache.0.3.0.js"
|
22
|
+
copy_file 'dist/jquery/jquery.ba-bbq.min.js', "#{new_app_path}/vendor/jquery/jquery.ba-bbq.min.js"
|
22
23
|
directory "src", "#{new_app_path}/vendor/eyeballs/"
|
23
24
|
template "templates/initializer.js", "#{new_app_path}/config/initializer.js"
|
24
25
|
end
|
data/spec/app_generator_spec.rb
CHANGED
@@ -3,11 +3,6 @@ require 'spec_helper'
|
|
3
3
|
describe Eyeballs::AppGenerator do
|
4
4
|
|
5
5
|
describe "generate a simple app" do
|
6
|
-
before(:all) do
|
7
|
-
create_test_root
|
8
|
-
FileUtils.cd(test_root)
|
9
|
-
Eyeballs::AppGenerator.start('test')
|
10
|
-
end
|
11
6
|
let(:app_dir) { file('test', 'app') }
|
12
7
|
let(:model_dir) { file('test', 'app', 'models') }
|
13
8
|
let(:controller_dir) { file('test', 'app', 'controllers') }
|
@@ -19,12 +14,18 @@ describe Eyeballs::AppGenerator do
|
|
19
14
|
let(:mustache_dir) { file('test', 'vendor', 'mustache') }
|
20
15
|
|
21
16
|
let(:jquery_file) { file('test', 'vendor', 'jquery', 'jquery-1.4.2.min.js') }
|
22
|
-
let(:
|
17
|
+
let(:bbq_file) { file('test', 'vendor', 'jquery', 'jquery.ba-bbq.min.js') }
|
23
18
|
let(:mustache_file) { file('test', 'vendor', 'mustache', 'mustache.0.3.0.js') }
|
24
19
|
let(:index_file) { file('test', 'index.html') }
|
25
20
|
let(:initializer_file) { file('test', 'config', 'initializer.js')}
|
26
21
|
let(:routes_file) { file('test', 'config', 'routes.js')}
|
27
22
|
|
23
|
+
before(:all) do
|
24
|
+
create_test_root
|
25
|
+
FileUtils.cd(test_root)
|
26
|
+
Eyeballs::AppGenerator.start(['test'])
|
27
|
+
end
|
28
|
+
|
28
29
|
it "should create the test root" do
|
29
30
|
File.exists?(test_root).should be_true
|
30
31
|
end
|
@@ -43,7 +44,7 @@ describe Eyeballs::AppGenerator do
|
|
43
44
|
|
44
45
|
it "should create the app files" do
|
45
46
|
jquery_file.should exist
|
46
|
-
|
47
|
+
bbq_file.should exist
|
47
48
|
mustache_file.should exist
|
48
49
|
index_file.should exist
|
49
50
|
initializer_file.should exist
|
@@ -6,7 +6,7 @@ describe Eyeballs::AppGenerator do
|
|
6
6
|
create_test_root
|
7
7
|
FileUtils.mkdir(test_root + '/public')
|
8
8
|
FileUtils.cd(test_root)
|
9
|
-
Eyeballs::AppGenerator.start('test')
|
9
|
+
Eyeballs::AppGenerator.start(['test'])
|
10
10
|
end
|
11
11
|
let(:app_dir) { file('public', 'javascripts', 'app') }
|
12
12
|
|
@@ -8,18 +8,33 @@ o_O.find_attributes = function(template, callback){
|
|
8
8
|
return object;
|
9
9
|
}
|
10
10
|
|
11
|
-
o_O.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
o_O.params_from_form = function(form){
|
12
|
+
return $.deparam(form.serialize());
|
13
|
+
}
|
14
|
+
|
15
|
+
o_O.params = function(param, new_value){
|
16
|
+
if(new_value != void(0))
|
17
|
+
{
|
18
|
+
o_O.params.collection[param] = new_value;
|
19
|
+
return new_value;
|
20
|
+
}
|
21
|
+
if(typeof param === 'string')
|
22
|
+
{
|
23
|
+
return o_O.params.collection[param];
|
22
24
|
}
|
25
|
+
return o_O.params.collection;
|
26
|
+
}
|
27
|
+
|
28
|
+
o_O.params.collection = {}
|
29
|
+
|
30
|
+
$(function(){
|
31
|
+
$('body').delegate('form', 'submit', function(){
|
32
|
+
for(param in o_O.params_from_form($(this)))
|
33
|
+
{
|
34
|
+
o_O.params(param, o_O.params_from_form($(this))[param]);
|
35
|
+
}
|
36
|
+
})
|
37
|
+
})
|
23
38
|
|
24
39
|
o_O.render = function(template, data, options){
|
25
40
|
o_O.get_template(template, data, function(data, template){
|
@@ -42,6 +57,14 @@ o_O.render = function(template, data, options){
|
|
42
57
|
{
|
43
58
|
$(options.html).html(rendered);
|
44
59
|
}
|
60
|
+
if(options.before)
|
61
|
+
{
|
62
|
+
$(options.html).before(rendered);
|
63
|
+
}
|
64
|
+
if(options.after)
|
65
|
+
{
|
66
|
+
$(options.html).after(rendered);
|
67
|
+
}
|
45
68
|
}
|
46
69
|
});
|
47
70
|
}
|
data/src/modules/o_O.model.js
CHANGED
data/src/o_O.js
CHANGED
@@ -5,7 +5,11 @@ var o_O = function(){
|
|
5
5
|
|
6
6
|
bind_to = (object_to_bind_to) ? object_to_bind_to : o_O.config.default_bind_to();
|
7
7
|
|
8
|
-
if(
|
8
|
+
if(arguments.length === 1)
|
9
|
+
{
|
10
|
+
return bind_to[arguments[0]]
|
11
|
+
}
|
12
|
+
else if(typeof arguments[1] === 'object')
|
9
13
|
{
|
10
14
|
var controller_name = arguments[0];
|
11
15
|
bind_to[controller_name] = o_O.controller.initialize(controller_name, arguments[1]);
|
@@ -29,6 +29,7 @@
|
|
29
29
|
</div>
|
30
30
|
</body>
|
31
31
|
<script src="<%= prefix %>vendor/jquery/jquery-1.4.2.min.js"></script>
|
32
|
+
<script src="<%= prefix %>vendor/jquery/jquery.ba-bbq.min.js"></script>
|
32
33
|
<script src="<%= prefix %>vendor/mustache/mustache.0.3.0.js"></script>
|
33
34
|
<script src="<%= prefix %>vendor/eyeballs/o_O.js"></script>
|
34
35
|
<script src="<%= prefix %>vendor/eyeballs/modules/o_O.model.js"></script>
|
data/test/unit/test_dom.html
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.livequery.js"></script>
|
7
6
|
<script src="../../src/o_O.js"></script>
|
8
7
|
<script src="../../src/modules/o_O.model.js"></script>
|
9
8
|
<script src="../../src/modules/o_O.validations.js"></script>
|
@@ -3,7 +3,6 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.livequery.js"></script>
|
7
6
|
<script src="../../src/o_O.js"></script>
|
8
7
|
<script src="../../src/modules/o_O.model.js"></script>
|
9
8
|
<script src="../../src/modules/o_O.validations.js"></script>
|
@@ -120,6 +119,5 @@
|
|
120
119
|
<h2 id="qunit-banner"></h2>
|
121
120
|
<h2 id="qunit-userAgent"></h2>
|
122
121
|
<ol id="qunit-tests"></ol>
|
123
|
-
</div>
|
124
122
|
</body>
|
125
123
|
</html>
|
@@ -3,7 +3,6 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.livequery.js"></script>
|
7
6
|
<script src="../../src/o_O.js"></script>
|
8
7
|
<script src="../../src/modules/o_O.model.js"></script>
|
9
8
|
<script src="../../src/modules/o_O.validations.js"></script>
|
data/test/unit/test_model.html
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.livequery.js"></script>
|
7
6
|
<script src="../../src/o_O.js"></script>
|
8
7
|
<script src="../../src/modules/o_O.model.js"></script>
|
9
8
|
<script src="../../src/modules/o_O.validations.js"></script>
|
@@ -17,20 +16,20 @@
|
|
17
16
|
|
18
17
|
o_O.model.adapter = o_O.dom;
|
19
18
|
|
20
|
-
o_O('Review', function(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
o_O('Review', function(){
|
20
|
+
this.validates_presence_of('title');
|
21
|
+
this.validates_presence_of('content');
|
22
|
+
this.validates_length_of('title', {min: 5, max: 15});
|
23
|
+
this.validates(function(review){
|
25
24
|
if(review.score != 99 && review.test === true)
|
26
25
|
{
|
27
26
|
review.errors.push({message: 'Score should be 99'})
|
28
27
|
}
|
29
28
|
})
|
30
|
-
|
29
|
+
this.methods.title_numbered = function(){
|
31
30
|
return '1. ' + this.title;
|
32
31
|
}
|
33
|
-
return
|
32
|
+
return this;
|
34
33
|
});
|
35
34
|
|
36
35
|
var MyApp = {};
|
@@ -44,6 +43,11 @@
|
|
44
43
|
var test_model = MyApp.TestModel.initialize({title: 'Delicious'})
|
45
44
|
equals(test_model.title, 'Delicious', 'should just work as normal')
|
46
45
|
})
|
46
|
+
|
47
|
+
test('functional syntax', 1, function(){
|
48
|
+
var test_model = o_O('Review').initialize({title: 'Delicious'})
|
49
|
+
equals(test_model.title, 'Delicious', 'should just work as normal')
|
50
|
+
})
|
47
51
|
|
48
52
|
test('serialization',1, function(){
|
49
53
|
var myReview = Review.initialize({title: 'Groovy'})
|
@@ -3,7 +3,6 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.livequery.js"></script>
|
7
6
|
<script src="../../src/o_O.js"></script>
|
8
7
|
<script src="../../src/modules/o_O.model.js"></script>
|
9
8
|
<script src="../../src/modules/o_O.validations.js"></script>
|
@@ -146,7 +145,6 @@
|
|
146
145
|
<h2 id="qunit-banner"></h2>
|
147
146
|
<h2 id="qunit-userAgent"></h2>
|
148
147
|
<ol id="qunit-tests"></ol>
|
149
|
-
</div>
|
150
148
|
|
151
149
|
<div data-id="thing"></div>
|
152
150
|
</body>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
+
<script src="../../dist/jquery/jquery.ba-bbq.min.js"></script>
|
7
|
+
<script src="../../src/o_O.js"></script>
|
8
|
+
<script src="../../src/modules/o_O.model.js"></script>
|
9
|
+
<script src="../../src/modules/o_O.validations.js"></script>
|
10
|
+
<script src="../../src/drivers/jquery/adapters/o_O.dom.js"></script>
|
11
|
+
<script src="../../src/drivers/jquery/modules/o_O.controller.js"></script>
|
12
|
+
<script src="../../src/drivers/jquery/modules/o_O.support.js"></script>
|
13
|
+
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
|
14
|
+
<script type="text/javascript" src="qunit.js"></script>
|
15
|
+
|
16
|
+
<script>
|
17
|
+
|
18
|
+
$(document).ready(function(){
|
19
|
+
|
20
|
+
o_O('Review', function(that){
|
21
|
+
that.validates_presence_of('title');
|
22
|
+
that.validates_presence_of('content');
|
23
|
+
return that;
|
24
|
+
});
|
25
|
+
|
26
|
+
o_O('TestController', {
|
27
|
+
create: function(){
|
28
|
+
|
29
|
+
}
|
30
|
+
})
|
31
|
+
|
32
|
+
module("Forms");
|
33
|
+
|
34
|
+
test('getting form attributes', function(){
|
35
|
+
equals(o_O.params_from_form($('form#test-form')).title, 'Biscuit', 'form attributes should come in nicely')
|
36
|
+
equals(o_O.params_from_form($('form#test-form')).selection, "1", 'should work with checkboxes')
|
37
|
+
equals(o_O.params_from_form($('form#test-form')).thing['title'], "Thing's Title", 'should work with checkboxes')
|
38
|
+
});
|
39
|
+
|
40
|
+
test('params should be empty', function(){
|
41
|
+
equals(typeof o_O.params(), 'object')
|
42
|
+
})
|
43
|
+
|
44
|
+
test('setting a param', function(){
|
45
|
+
o_O.params('thing', 'new value')
|
46
|
+
equals(o_O.params('thing'), 'new value')
|
47
|
+
})
|
48
|
+
|
49
|
+
test('submitting a form', function(){
|
50
|
+
$("form#test-form").trigger('submit')
|
51
|
+
equals(o_O.params('title'), 'Biscuit');
|
52
|
+
equals(o_O.params('thing')['title'], "Thing's Title");
|
53
|
+
})
|
54
|
+
|
55
|
+
});
|
56
|
+
</script>
|
57
|
+
|
58
|
+
</head>
|
59
|
+
<body>
|
60
|
+
<h1 id="qunit-header">Form Tests</h1>
|
61
|
+
<h2 id="qunit-banner"></h2>
|
62
|
+
<h2 id="qunit-userAgent"></h2>
|
63
|
+
<ol id="qunit-tests"></ol>
|
64
|
+
<form id="test-form" data-bind="test#create">
|
65
|
+
<input type="text" name="title" type="text" value="Biscuit">
|
66
|
+
<input type="radio" name="selection" value="1" checked>
|
67
|
+
<input type="radio" name="selection" value="-1">
|
68
|
+
<input type="text" name="thing[title]" value="Thing's Title"></input>
|
69
|
+
</form>
|
70
|
+
</body>
|
71
|
+
</html>
|
data/test/unit/test_rest.html
CHANGED
data/test/unit/test_routing.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
5
|
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.ba-
|
6
|
+
<script src="../../dist/jquery/jquery.ba-bbq.js"></script>
|
7
7
|
<script src="../../src/o_O.js"></script>
|
8
8
|
<script src="../../src/modules/o_O.model.js"></script>
|
9
9
|
<script src="../../src/modules/o_O.validations.js"></script>
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eyeballs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.5.10.1
|
9
|
+
- 11
|
10
|
+
version: 0.5.11
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Paul Campbell
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-
|
18
|
+
date: 2010-10-28 00:00:00 +01:00
|
20
19
|
default_executable: eyeballs
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -66,7 +65,7 @@ files:
|
|
66
65
|
- bin/eyeballs
|
67
66
|
- config.ru
|
68
67
|
- dist/jquery/jquery-1.4.2.min.js
|
69
|
-
- dist/jquery/jquery.ba-
|
68
|
+
- dist/jquery/jquery.ba-bbq.min.js
|
70
69
|
- dist/mustache/mustache.0.3.0.js
|
71
70
|
- eyeballs.gemspec
|
72
71
|
- lib/eyeballs.rb
|
@@ -103,10 +102,10 @@ files:
|
|
103
102
|
- test/unit/test_controller.html
|
104
103
|
- test/unit/test_dom.html
|
105
104
|
- test/unit/test_dom_with_callbacks.html
|
106
|
-
- test/unit/test_form.html
|
107
105
|
- test/unit/test_localstorage.html
|
108
106
|
- test/unit/test_model.html
|
109
107
|
- test/unit/test_model_with_callbacks.html
|
108
|
+
- test/unit/test_params.html
|
110
109
|
- test/unit/test_rest.html
|
111
110
|
- test/unit/test_routing.html
|
112
111
|
- spec/app_generator_spec.rb
|
@@ -1,245 +0,0 @@
|
|
1
|
-
|
2
|
-
/*!
|
3
|
-
* jQuery hashchange event - v1.2 - 2/11/2010
|
4
|
-
* http://benalman.com/projects/jquery-hashchange-plugin/
|
5
|
-
*
|
6
|
-
* Copyright (c) 2010 "Cowboy" Ben Alman
|
7
|
-
* Dual licensed under the MIT and GPL licenses.
|
8
|
-
* http://benalman.com/about/license/
|
9
|
-
*/
|
10
|
-
|
11
|
-
// Script: jQuery hashchange event
|
12
|
-
//
|
13
|
-
// *Version: 1.2, Last updated: 2/11/2010*
|
14
|
-
//
|
15
|
-
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
|
16
|
-
// GitHub - http://github.com/cowboy/jquery-hashchange/
|
17
|
-
// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
|
18
|
-
// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (1.1kb)
|
19
|
-
//
|
20
|
-
// About: License
|
21
|
-
//
|
22
|
-
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
23
|
-
// Dual licensed under the MIT and GPL licenses.
|
24
|
-
// http://benalman.com/about/license/
|
25
|
-
//
|
26
|
-
// About: Examples
|
27
|
-
//
|
28
|
-
// This working example, complete with fully commented code, illustrate one way
|
29
|
-
// in which this plugin can be used.
|
30
|
-
//
|
31
|
-
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
|
32
|
-
//
|
33
|
-
// About: Support and Testing
|
34
|
-
//
|
35
|
-
// Information about what version or versions of jQuery this plugin has been
|
36
|
-
// tested with, what browsers it has been tested in, and where the unit tests
|
37
|
-
// reside (so you can test it yourself).
|
38
|
-
//
|
39
|
-
// jQuery Versions - 1.3.2, 1.4.1, 1.4.2pre
|
40
|
-
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4, Chrome, Opera 9.6-10.1.
|
41
|
-
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
|
42
|
-
//
|
43
|
-
// About: Known issues
|
44
|
-
//
|
45
|
-
// While this jQuery hashchange event implementation is quite stable and robust,
|
46
|
-
// there are a few unfortunate browser bugs surrounding expected hashchange
|
47
|
-
// event-based behaviors, independent of any JavaScript window.onhashchange
|
48
|
-
// abstraction. See the following examples for more information:
|
49
|
-
//
|
50
|
-
// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
|
51
|
-
// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
|
52
|
-
// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
|
53
|
-
// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
|
54
|
-
//
|
55
|
-
// About: Release History
|
56
|
-
//
|
57
|
-
// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin
|
58
|
-
// from a page on another domain would cause an error in Safari 4. Also,
|
59
|
-
// IE6/7 Iframe is now inserted after the body (this actually works),
|
60
|
-
// which prevents the page from scrolling when the event is first bound.
|
61
|
-
// Event can also now be bound before DOM ready, but it won't be usable
|
62
|
-
// before then in IE6/7.
|
63
|
-
// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
|
64
|
-
// where browser version is incorrectly reported as 8.0, despite
|
65
|
-
// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
|
66
|
-
// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
|
67
|
-
// window.onhashchange functionality into a separate plugin for users
|
68
|
-
// who want just the basic event & back button support, without all the
|
69
|
-
// extra awesomeness that BBQ provides. This plugin will be included as
|
70
|
-
// part of jQuery BBQ, but also be available separately.
|
71
|
-
|
72
|
-
(function($,window,undefined){
|
73
|
-
'$:nomunge'; // Used by YUI compressor.
|
74
|
-
|
75
|
-
// Method / object references.
|
76
|
-
var fake_onhashchange,
|
77
|
-
jq_event_special = $.event.special,
|
78
|
-
|
79
|
-
// Reused strings.
|
80
|
-
str_location = 'location',
|
81
|
-
str_hashchange = 'hashchange',
|
82
|
-
str_href = 'href',
|
83
|
-
|
84
|
-
// IE6/7 specifically need some special love when it comes to back-button
|
85
|
-
// support, so let's do a little browser sniffing..
|
86
|
-
browser = $.browser,
|
87
|
-
mode = document.documentMode,
|
88
|
-
is_old_ie = browser.msie && ( mode === undefined || mode < 8 ),
|
89
|
-
|
90
|
-
// Does the browser support window.onhashchange? Test for IE version, since
|
91
|
-
// IE8 incorrectly reports this when in "IE7" or "IE8 Compatibility View"!
|
92
|
-
supports_onhashchange = 'on' + str_hashchange in window && !is_old_ie;
|
93
|
-
|
94
|
-
// Get location.hash (or what you'd expect location.hash to be) sans any
|
95
|
-
// leading #. Thanks for making this necessary, Firefox!
|
96
|
-
function get_fragment( url ) {
|
97
|
-
url = url || window[ str_location ][ str_href ];
|
98
|
-
return url.replace( /^[^#]*#?(.*)$/, '$1' );
|
99
|
-
};
|
100
|
-
|
101
|
-
// Property: jQuery.hashchangeDelay
|
102
|
-
//
|
103
|
-
// The numeric interval (in milliseconds) at which the <hashchange event>
|
104
|
-
// polling loop executes. Defaults to 100.
|
105
|
-
|
106
|
-
$[ str_hashchange + 'Delay' ] = 100;
|
107
|
-
|
108
|
-
// Event: hashchange event
|
109
|
-
//
|
110
|
-
// Fired when location.hash changes. In browsers that support it, the native
|
111
|
-
// window.onhashchange event is used (IE8, FF3.6), otherwise a polling loop is
|
112
|
-
// initialized, running every <jQuery.hashchangeDelay> milliseconds to see if
|
113
|
-
// the hash has changed. In IE 6 and 7, a hidden Iframe is created to allow
|
114
|
-
// the back button and hash-based history to work.
|
115
|
-
//
|
116
|
-
// Usage:
|
117
|
-
//
|
118
|
-
// > $(window).bind( 'hashchange', function(e) {
|
119
|
-
// > var hash = location.hash;
|
120
|
-
// > ...
|
121
|
-
// > });
|
122
|
-
//
|
123
|
-
// Additional Notes:
|
124
|
-
//
|
125
|
-
// * The polling loop and Iframe are not created until at least one callback
|
126
|
-
// is actually bound to 'hashchange'.
|
127
|
-
// * If you need the bound callback(s) to execute immediately, in cases where
|
128
|
-
// the page 'state' exists on page load (via bookmark or page refresh, for
|
129
|
-
// example) use $(window).trigger( 'hashchange' );
|
130
|
-
// * The event can be bound before DOM ready, but since it won't be usable
|
131
|
-
// before then in IE6/7 (due to the necessary Iframe), recommended usage is
|
132
|
-
// to bind it inside a $(document).ready() callback.
|
133
|
-
|
134
|
-
jq_event_special[ str_hashchange ] = $.extend( jq_event_special[ str_hashchange ], {
|
135
|
-
|
136
|
-
// Called only when the first 'hashchange' event is bound to window.
|
137
|
-
setup: function() {
|
138
|
-
// If window.onhashchange is supported natively, there's nothing to do..
|
139
|
-
if ( supports_onhashchange ) { return false; }
|
140
|
-
|
141
|
-
// Otherwise, we need to create our own. And we don't want to call this
|
142
|
-
// until the user binds to the event, just in case they never do, since it
|
143
|
-
// will create a polling loop and possibly even a hidden Iframe.
|
144
|
-
$( fake_onhashchange.start );
|
145
|
-
},
|
146
|
-
|
147
|
-
// Called only when the last 'hashchange' event is unbound from window.
|
148
|
-
teardown: function() {
|
149
|
-
// If window.onhashchange is supported natively, there's nothing to do..
|
150
|
-
if ( supports_onhashchange ) { return false; }
|
151
|
-
|
152
|
-
// Otherwise, we need to stop ours (if possible).
|
153
|
-
$( fake_onhashchange.stop );
|
154
|
-
}
|
155
|
-
|
156
|
-
});
|
157
|
-
|
158
|
-
// fake_onhashchange does all the work of triggering the window.onhashchange
|
159
|
-
// event for browsers that don't natively support it, including creating a
|
160
|
-
// polling loop to watch for hash changes and in IE 6/7 creating a hidden
|
161
|
-
// Iframe to enable back and forward.
|
162
|
-
fake_onhashchange = (function(){
|
163
|
-
var self = {},
|
164
|
-
timeout_id,
|
165
|
-
iframe,
|
166
|
-
set_history,
|
167
|
-
get_history;
|
168
|
-
|
169
|
-
// Initialize. In IE 6/7, creates a hidden Iframe for history handling.
|
170
|
-
function init(){
|
171
|
-
// Most browsers don't need special methods here..
|
172
|
-
set_history = get_history = function(val){ return val; };
|
173
|
-
|
174
|
-
// But IE6/7 do!
|
175
|
-
if ( is_old_ie ) {
|
176
|
-
|
177
|
-
// Create hidden Iframe after the end of the body to prevent initial
|
178
|
-
// page load from scrolling unnecessarily.
|
179
|
-
iframe = $('<iframe src="javascript:0"/>').hide().insertAfter( 'body' )[0].contentWindow;
|
180
|
-
|
181
|
-
// Get history by looking at the hidden Iframe's location.hash.
|
182
|
-
get_history = function() {
|
183
|
-
return get_fragment( iframe.document[ str_location ][ str_href ] );
|
184
|
-
};
|
185
|
-
|
186
|
-
// Set a new history item by opening and then closing the Iframe
|
187
|
-
// document, *then* setting its location.hash.
|
188
|
-
set_history = function( hash, history_hash ) {
|
189
|
-
if ( hash !== history_hash ) {
|
190
|
-
var doc = iframe.document;
|
191
|
-
doc.open().close();
|
192
|
-
doc[ str_location ].hash = '#' + hash;
|
193
|
-
}
|
194
|
-
};
|
195
|
-
|
196
|
-
// Set initial history.
|
197
|
-
set_history( get_fragment() );
|
198
|
-
}
|
199
|
-
};
|
200
|
-
|
201
|
-
// Start the polling loop.
|
202
|
-
self.start = function() {
|
203
|
-
// Polling loop is already running!
|
204
|
-
if ( timeout_id ) { return; }
|
205
|
-
|
206
|
-
// Remember the initial hash so it doesn't get triggered immediately.
|
207
|
-
var last_hash = get_fragment();
|
208
|
-
|
209
|
-
// Initialize if not yet initialized.
|
210
|
-
set_history || init();
|
211
|
-
|
212
|
-
// This polling loop checks every $.hashchangeDelay milliseconds to see if
|
213
|
-
// location.hash has changed, and triggers the 'hashchange' event on
|
214
|
-
// window when necessary.
|
215
|
-
(function loopy(){
|
216
|
-
var hash = get_fragment(),
|
217
|
-
history_hash = get_history( last_hash );
|
218
|
-
|
219
|
-
if ( hash !== last_hash ) {
|
220
|
-
set_history( last_hash = hash, history_hash );
|
221
|
-
|
222
|
-
$(window).trigger( str_hashchange );
|
223
|
-
|
224
|
-
} else if ( history_hash !== last_hash ) {
|
225
|
-
window[ str_location ][ str_href ] = window[ str_location ][ str_href ].replace( /#.*/, '' ) + '#' + history_hash;
|
226
|
-
}
|
227
|
-
|
228
|
-
timeout_id = setTimeout( loopy, $[ str_hashchange + 'Delay' ] );
|
229
|
-
})();
|
230
|
-
};
|
231
|
-
|
232
|
-
// Stop the polling loop, but only if an IE6/7 Iframe wasn't created. In
|
233
|
-
// that case, even if there are no longer any bound event handlers, the
|
234
|
-
// polling loop is still necessary for back/next to work at all!
|
235
|
-
self.stop = function() {
|
236
|
-
if ( !iframe ) {
|
237
|
-
timeout_id && clearTimeout( timeout_id );
|
238
|
-
timeout_id = 0;
|
239
|
-
}
|
240
|
-
};
|
241
|
-
|
242
|
-
return self;
|
243
|
-
})();
|
244
|
-
|
245
|
-
})(jQuery,this);
|
data/test/unit/test_form.html
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<script src="../../dist/jquery/jquery-1.4.2.min.js"></script>
|
6
|
-
<script src="../../dist/jquery/jquery.livequery.js"></script>
|
7
|
-
<script src="../../src/o_O.js"></script>
|
8
|
-
<script src="../../src/modules/o_O.model.js"></script>
|
9
|
-
<script src="../../src/modules/o_O.validations.js"></script>
|
10
|
-
<script src="../../src/drivers/jquery/adapters/o_O.dom.js"></script>
|
11
|
-
<script src="../../src/drivers/jquery/modules/o_O.controller.js"></script>
|
12
|
-
<script src="../../src/drivers/jquery/modules/o_O.support.js"></script>
|
13
|
-
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
|
14
|
-
<script type="text/javascript" src="qunit.js"></script>
|
15
|
-
|
16
|
-
<script>
|
17
|
-
var Review = o_O(function(that){
|
18
|
-
that.validates_presence_of('title');
|
19
|
-
that.validates_presence_of('content');
|
20
|
-
return that;
|
21
|
-
});
|
22
|
-
|
23
|
-
$(document).ready(function(){
|
24
|
-
|
25
|
-
module("Forms");
|
26
|
-
|
27
|
-
test('getting form attributes', 2, function(){
|
28
|
-
equals(o_O.params($('form#test-form')).title, 'Biscuit', 'form attributes should come in nicely')
|
29
|
-
equals(o_O.params($('form#test-form')).selection, "1", 'should work with checkboxes')
|
30
|
-
});
|
31
|
-
|
32
|
-
});
|
33
|
-
</script>
|
34
|
-
|
35
|
-
</head>
|
36
|
-
<body>
|
37
|
-
<h1 id="qunit-header">Form Tests</h1>
|
38
|
-
<h2 id="qunit-banner"></h2>
|
39
|
-
<h2 id="qunit-userAgent"></h2>
|
40
|
-
<ol id="qunit-tests"></ol>
|
41
|
-
<form id="test-form">
|
42
|
-
<input type="title" data-attribute="title" type="text" value="Biscuit">
|
43
|
-
<input type="radio" data-attribute="selection" value="1" checked>
|
44
|
-
<input type="radio" data-attribute="selection" value="-1">
|
45
|
-
</form>
|
46
|
-
</body>
|
47
|
-
</html>
|