Sha256: 03a530100a0631f52d49cdf4f723a9a014ec609f3400b74d31c63a2204c86b66

Contents?: true

Size: 620 Bytes

Versions: 73

Compression:

Stored size: 620 Bytes

Contents

require 'native'

describe 'Native exposure' do
  describe Class do
    describe '#native_alias' do
      it 'exposes a method to javascript' do
        c = Class.new do
          def ruby_method
            :ruby
          end

          native_alias :rubyMethod, :ruby_method
        end

        `#{c.new}.rubyMethod()`.should == :ruby
      end
    end

    describe '#native_class' do
      it 'exposes a Class on the JS global object' do
        c = Class.new do
          def self.name
            'Pippo'
          end

          native_class
        end

        `Pippo`.should == c
      end
    end
  end
end

Version data entries

73 entries across 73 versions & 3 rubygems

Version Path
opal-1.7.4 spec/opal/stdlib/native/exposure_spec.rb
opal-1.7.3 spec/opal/stdlib/native/exposure_spec.rb
opal-1.7.2 spec/opal/stdlib/native/exposure_spec.rb
opal-1.7.1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.7.0 spec/opal/stdlib/native/exposure_spec.rb
opal-1.7.0.rc1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.6.1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.6.0 spec/opal/stdlib/native/exposure_spec.rb
opal-1.6.0.rc1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.6.0.alpha1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.5.1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.5.0 spec/opal/stdlib/native/exposure_spec.rb
opal-1.5.0.rc1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.4.1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.4.0 spec/opal/stdlib/native/exposure_spec.rb
opal-1.4.0.alpha1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.3.2 spec/opal/stdlib/native/exposure_spec.rb
opal-1.3.1 spec/opal/stdlib/native/exposure_spec.rb
opal-1.3.0 spec/opal/stdlib/native/exposure_spec.rb
opal-1.3.0.rc1 spec/opal/stdlib/native/exposure_spec.rb