Sha256: d6add57c0087cc096de084837ff816ea7ba50648fba3ebd880e5caee289d900f

Contents?: true

Size: 605 Bytes

Versions: 6

Compression:

Stored size: 605 Bytes

Contents

# backtick_javascript: true

require 'native'

describe "Native.alias_native" do
  it "refers to an attribute on @native" do
    Class.new {
      include Native::Wrapper

      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::Wrapper

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

  it "defaults old to new" do
    Class.new {
      include Native::Wrapper

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.8.2 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.8.1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.8.0 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.8.0.beta1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.8.0.alpha1 spec/opal/stdlib/native/alias_native_spec.rb