Skip to content

Commit

Permalink
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion corelib/native.rb
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ def alias_native(new, old)
end
end

def self.included?(klass)
def self.included(klass)
klass.instance_eval {
extend Helpers
}
18 changes: 18 additions & 0 deletions spec/opal/native/alias_native_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe "Native::Base.alias_native" do
it "refers to an attribute on @native" do
Class.new {
include Native::Base

alias_native :a, :a
}.new(`{ a: 2 }`).a.should == 2
end

it "refers to an attribute on @native and calls it if it's a function" do
Class.new {
include Native::Base

alias_native :a, :a
}.new(`{ a: function() { return 42; } }`).a.should == 42
end

end

0 comments on commit 905d7ab

Please sign in to comment.