Sha256: c2991af3cf258e99424501b3875987ef264b7b1fe8392d49d8cac6649b91ea37

Contents?: true

Size: 1.15 KB

Versions: 7

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

RSpec.describe 'Document' do
  subject { Document }

  describe "ready?" do
    it "accepts a block" do
      Document.ready? {
        puts `$.fn.jquery`
      }
    end

    it "accepts a block" do
      Document.ready? { }
    end
  end

  describe "ready" do
    p self.ancestors
    async "resolves when document is ready" do
      Document.ready.then do
        async { Document.ready.resolved?.should be_truthy }
      end
    end
  end

  describe "title" do
    it "gets the document title" do
      Document.title.should be_kind_of(String)
    end
  end

  describe "title=" do
    it "sets the document title" do
      old = Document.title
      Document.title = "foo"
      Document.title.should eq("foo")
      Document.title = old
    end
  end

  describe "head" do
    it "returns the head element as an Element instance" do
      expect(subject.head).to be_kind_of(Element)
      expect(subject.head.tag_name).to eq('head')
    end
  end

  describe "body" do
    it "returns the body element as an Element instance" do
      expect(subject.body).to be_kind_of(Element)
      expect(subject.body.tag_name).to eq('body')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-jquery-0.5.2 spec-opal/document_spec.rb
opal-jquery-0.5.1 spec-opal/document_spec.rb
opal-jquery-0.5.0 spec-opal/document_spec.rb
opal-jquery-0.4.6 spec-opal/document_spec.rb
opal-jquery-0.4.5 spec-opal/document_spec.rb
opal-jquery-0.4.4 spec-opal/document_spec.rb
opal-jquery-0.4.3 spec-opal/document_spec.rb