Sha256: 542bec4df422fd7f0b5092fef766af3123441d651d405a3e6c962bab2e9836fe

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

describe "Sugarcube::WebView" do

  describe WKWebView do
    tests UIViewController

    before do
      @view = UIView.alloc.initWithFrame([[1,2],[3,4]])
      controller.view.addSubview(@view)

      @webview = WKWebView.alloc.init
      @view << @webview

      @webview.eval_js('') {|id, error| ;; }    # NOOP
    end

    after do
      @view = @webview = nil
    end

    [["1 + 1", 2.0],
     ["null", nil],
     ["(function(x) { return x * x; })(4)", 16.0]].each do |str, expected|
      it "should eval '#{str}'" do
        @res = ''

        @webview.eval_js(str) do |id, error|
          @res = id
        end

        wait 5.0 do
          @res.should == expected
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sugarcube-4.0.0 spec/ios/wkwebview_spec.rb