opal-jquery 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10a59c85f98bfc9492071646b6bfb475fa901bc9
4
- data.tar.gz: 482d3c0bdc6c64a56e785909f111af4c2ff2abf9
3
+ metadata.gz: 15f89460a5383c4cac26b038d21b86d96543a44a
4
+ data.tar.gz: bffe7c3427abcdd767fbf8db2ae69b8ee4c54e6b
5
5
  SHA512:
6
- metadata.gz: 4532a13456f025938b72ca671bd9bba3921f47fc78992e74172763f0559e254a418bbd5f261024b30fbf6222600ed54a724a34d5b114d8290350df4a47b71634
7
- data.tar.gz: 8608e4673b228258dec7a972fc3257f9be3cb6dc5af1f190b76c7811eef3fbe200757b11b2dd38a9ca23e3012d4bdfdea4000fee8ddc9921cfcfb7b169c59da4
6
+ metadata.gz: 5220c73d6ef31b04c166e38e37ca8f0a2481768fa018550abf9fe48864e513679cff67d95126eb2179a432507c82dd2974f4ca67c9aecaabef15d0659e6e4003
7
+ data.tar.gz: 383b2fe50f6f72ee987310fc4835c41271d740d3be1e4f907f083af1b3aa686a8011891c442826586b4df2e683cba833090399f84029f3c7c1edc6b5d2705a02
data/Rakefile CHANGED
@@ -2,12 +2,12 @@ require 'bundler'
2
2
  Bundler.require
3
3
  Bundler::GemHelper.install_tasks
4
4
 
5
- require 'opal/spec/rake_task'
6
- Opal::Spec::RakeTask.new(:default) do |s|
5
+ require 'opal/rspec/rake_task'
6
+ Opal::RSpec::RakeTask.new(:default) do |s|
7
7
  s.index_path = 'spec/jquery/index.html'
8
8
  end
9
9
 
10
- Opal::Spec::RakeTask.new(:zepto) do |s|
10
+ Opal::RSpec::RakeTask.new(:zepto) do |s|
11
11
  s.index_path = 'spec/zepto/index.html'
12
12
  end
13
13
 
data/config.ru CHANGED
@@ -2,7 +2,7 @@ require 'bundler'
2
2
  Bundler.require
3
3
 
4
4
  run Opal::Server.new { |s|
5
- s.main = 'opal/spec/sprockets_runner'
5
+ s.main = 'opal/rspec/sprockets_runner'
6
6
  s.append_path 'spec'
7
7
  s.debug = false
8
8
  s.index_path = 'spec/jquery/index.html'
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module JQuery
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -16,5 +16,5 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ['lib']
17
17
 
18
18
  s.add_runtime_dependency 'opal', '~> 0.5.0'
19
- s.add_development_dependency 'opal-spec', '~> 0.3.0'
19
+ s.add_development_dependency 'opal-rspec'
20
20
  end
@@ -1,22 +1,18 @@
1
- class Element
2
- %x{
3
- var root = $opal.global, dom_class;
1
+ %x{
2
+ var root = $opal.global, dom_class;
4
3
 
5
- if (root.jQuery) {
6
- dom_class = jQuery
7
- }
8
- else if (root.Zepto) {
9
- dom_class = Zepto.zepto.Z;
10
- }
11
- else {
12
- throw new Error("jQuery must be included before opal-jquery");
13
- }
14
-
15
- self._proto = dom_class.prototype, def = self._proto;
16
- dom_class.prototype._klass = self;
4
+ if (root.jQuery) {
5
+ dom_class = jQuery
6
+ }
7
+ else if (root.Zepto) {
8
+ dom_class = Zepto.zepto.Z;
9
+ }
10
+ else {
11
+ throw new Error("jQuery must be included before opal-jquery");
17
12
  }
13
+ }
18
14
 
19
- include Kernel
15
+ class Element < `dom_class`
20
16
  include Enumerable
21
17
 
22
18
  def self.find(selector)
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'native'
2
3
 
3
4
  class HTTP
4
5
  attr_reader :body, :error_message, :method, :status_code, :url, :xhr
@@ -9,33 +9,37 @@ describe "Element animation methods" do
9
9
  ### HACKY
10
10
  # jQUery's animate method doesn't *always* finish on time
11
11
  # so the values are being compared using greater than
12
-
12
+
13
13
  it "should animate a set of properties and values" do
14
14
  foo = Element.find "#animate-foo"
15
15
  foo.animate :width => "200px"
16
16
 
17
17
  set_timeout 400 do
18
- (foo.css("width").to_f > 199).should be_true
18
+ (foo.css("width").to_f > 199).should eq(true)
19
19
  end
20
20
  end
21
21
 
22
- it "should allow you to set a speed in the params" do
22
+ async "should allow you to set a speed in the params" do
23
23
  foo = Element.find "#animate-foo"
24
24
  foo.animate :width => "200px", :speed => 100
25
25
 
26
26
  set_timeout 105 do
27
- (foo.css("width").to_f > 199).should be_true
27
+ run_async {
28
+ (foo.css("width").to_f > 199).should eq(true)
29
+ }
28
30
  end
29
31
  end
30
32
 
31
- it "should accept a block as a callback" do
33
+ async "should accept a block as a callback" do
32
34
  foo = Element.find "#animate-foo"
33
- foo.animate :width => "200px" do
35
+ foo.animate :width => "200px", :speed => 100 do
34
36
  foo.add_class "finished"
35
37
  end
36
38
 
37
39
  set_timeout 405 do
38
- foo.class_name.should equal("finished")
40
+ run_async {
41
+ foo.class_name.should eq("finished")
42
+ }
39
43
  end
40
44
  end
41
45
  end
@@ -72,14 +72,14 @@ describe Element do
72
72
  describe "#add_class" do
73
73
  it "should add the given class name to the element" do
74
74
  foo = Element.find '#foo'
75
- foo.has_class?('lemons').should be_false
75
+ foo.has_class?('lemons').should eq(false)
76
76
  foo.add_class 'lemons'
77
- foo.has_class?('lemons').should be_true
77
+ foo.has_class?('lemons').should eq(true)
78
78
  end
79
79
 
80
80
  it "should not duplicate class names on an element" do
81
81
  bar = Element.find '#bar'
82
- bar.has_class?('apples').should be_true
82
+ bar.has_class?('apples').should eq(true)
83
83
  bar.add_class 'apples'
84
84
  bar.class_name.should == 'apples'
85
85
  end
@@ -93,9 +93,9 @@ describe Element do
93
93
 
94
94
  describe '#has_class?' do
95
95
  it "should return true if the element has the given class" do
96
- Element.find('#has-foo').has_class?("apples").should be_true
97
- Element.find('#has-foo').has_class?("oranges").should be_false
98
- Element.find('#has-bar').has_class?("lemons").should be_true
96
+ Element.find('#has-foo').has_class?("apples").should eq(true)
97
+ Element.find('#has-foo').has_class?("oranges").should eq(false)
98
+ Element.find('#has-bar').has_class?("lemons").should eq(true)
99
99
  end
100
100
  end
101
101
 
@@ -152,16 +152,16 @@ describe Element do
152
152
  describe '#toggle_class' do
153
153
  it 'adds the given class name to the element if not already present' do
154
154
  foo = Element.find('#foo')
155
- foo.has_class?('oranges').should be_false
155
+ foo.has_class?('oranges').should eq(false)
156
156
  foo.toggle_class 'oranges'
157
- foo.has_class?('oranges').should be_true
157
+ foo.has_class?('oranges').should eq(true)
158
158
  end
159
159
 
160
160
  it 'removes the class if the element already has it' do
161
161
  bar = Element.find('#bar')
162
- bar.has_class?('apples').should be_true
162
+ bar.has_class?('apples').should eq(true)
163
163
  bar.toggle_class 'apples'
164
- bar.has_class?('apples').should be_false
164
+ bar.has_class?('apples').should eq(false)
165
165
  end
166
166
  end
167
167
 
@@ -25,8 +25,8 @@ describe "Element#exposes" do
25
25
  end
26
26
 
27
27
  it "only forwards calls when a native method exists" do
28
- lambda {
28
+ expect {
29
29
  Element.new.some_unknown_plugin
30
- }.should raise_error(NoMethodError)
30
+ }.to raise_error(Exception)
31
31
  end
32
32
  end
@@ -13,7 +13,7 @@ describe HTTP do
13
13
  async 'can add a success callback after the request is sent' do
14
14
  http = HTTP.get('spec/fixtures/simple.txt')
15
15
  http.callback do |response|
16
- run_async { response.ok?.should be_true }
16
+ run_async { response.should be_ok }
17
17
  end
18
18
  end
19
19
  end
@@ -22,7 +22,7 @@ describe HTTP do
22
22
  async 'can add a failure callback after the request is sent' do
23
23
  http = HTTP.get('spec/fixtures/bad_url.txt')
24
24
  http.errback do |response|
25
- run_async { response.ok?.should be_false }
25
+ run_async { response.should_not be_ok }
26
26
  end
27
27
  end
28
28
  end
@@ -38,13 +38,13 @@ describe HTTP do
38
38
  describe '#ok?' do
39
39
  async 'returns true when the request was a sucess' do
40
40
  HTTP.get('spec/fixtures/simple.txt') do |response|
41
- run_async { response.ok?.should be_true }
41
+ run_async { response.should be_ok }
42
42
  end
43
43
  end
44
44
 
45
45
  async 'returns false when the request failed' do
46
46
  HTTP.get('spec/fixtures/non_existant.txt') do |response|
47
- run_async { response.ok?.should be_false }
47
+ run_async { response.should_not be_ok }
48
48
  end
49
49
  end
50
50
  end
@@ -1,4 +1,4 @@
1
- require 'opal-spec'
1
+ require 'opal-rspec'
2
2
  require 'opal-jquery'
3
3
 
4
4
  module JqueryHelpers
@@ -30,6 +30,6 @@ module JqueryHelpers
30
30
  end
31
31
  end
32
32
 
33
- class OpalSpec::Example
34
- extend JqueryHelpers
33
+ RSpec.configure do |config|
34
+ config.extend JqueryHelpers
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-jquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-03 00:00:00.000000000 Z
11
+ date: 2013-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: opal-spec
28
+ name: opal-rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: '0'
41
41
  description: Opal DOM library for jquery
42
42
  email: adam.beynon@gmail.com
43
43
  executables: []