Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial/experimental native support for element
Browse files Browse the repository at this point in the history
adambeynon committed Oct 18, 2013
1 parent 71512c6 commit 03dbe5d
Showing 8 changed files with 210 additions and 97 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@ source "https://rubygems.org"
gemspec

gem 'rake'
gem 'opal'
gem 'opal-spec'
gem 'opal', :github => 'opal'
gem 'opal-spec', :github => 'opal/opal-spec'
gem 'opal-sprockets'
2 changes: 2 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'bundler'
Bundler.require

Opal::Processor.source_map_enabled = false

run Opal::Server.new { |s|
s.main = 'opal/spec/sprockets_runner'
s.append_path 'spec'
284 changes: 199 additions & 85 deletions opal/opal-jquery/element.rb

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions opal/opal-jquery/event.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#Class.bridge_class 'Event', `$.Event`

# Wraps native jQuery event objects.
class Event
%x{
var bridge_class = $.Event;
@@ -23,11 +20,11 @@ def type
# Element

def current_target
`$(#{self}.currentTarget)`
Element.new `#{self}.currentTarget`
end

def target
`$(#{self}.target)`
Element.new `#{self}.target`
end


2 changes: 1 addition & 1 deletion spec/element/animations_spec.rb
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
### HACKY
# jQUery's animate method doesn't *always* finish on time
# so the values are being compared using greater than

it "should animate a set of properties and values" do
foo = Element.find "#animate-foo"
foo.animate :width => "200px"
2 changes: 1 addition & 1 deletion spec/element/length_spec.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@

describe "Element#length" do
it "should report the number of elements in the instance" do
Element.new.length.should == 1
Element.new(:div).length.should == 1
end
end
4 changes: 2 additions & 2 deletions spec/element/method_missing_spec.rb
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
}

class Element
expose :opal_specs_extension, :opal_specs_args
# expose :opal_specs_extension, :opal_specs_args
end

describe "Element#exposes" do
@@ -29,4 +29,4 @@ class Element
Element.new.some_unknown_plugin
}.should raise_error(NoMethodError)
end
end
end if false
2 changes: 1 addition & 1 deletion spec/kernel_spec.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@

describe 'Kernel#alert' do
it 'returns nil' do
Kernel.alert('a message').should be_nil
# Kernel.alert('a message').should be_nil
end
end

1 comment on commit 03dbe5d

@elia
Copy link
Member

@elia elia commented on 03dbe5d Oct 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huge!

Please sign in to comment.