Sha256: 4787bb87f9edb0e1f4b39260e253a531d6ca87d65a6c3a4059aebecea2461a1e

Contents?: true

Size: 576 Bytes

Versions: 27

Compression:

Stored size: 576 Bytes

Contents

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

27 entries across 27 versions & 1 rubygems

Version Path
opal-1.3.0.alpha1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.2.0 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.2.0.beta1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.1.1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.1.1.rc1 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.1.0 spec/opal/stdlib/native/alias_native_spec.rb
opal-1.1.0.rc1 spec/opal/stdlib/native/alias_native_spec.rb