Sha256: 063c60863dcc858399cda298ffcf0ec270bd6e69fdcfaf0c98a511c961c2bb76

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Document do
  subject { Document }

  describe "ready?" do
    it "accepts a block" do
      Document.ready? { }
    end
  end
  
  describe "ready" do
    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

2 entries across 2 versions & 1 rubygems

Version Path
opal-jquery-0.4.2 spec/document_spec.rb
opal-jquery-0.4.1 spec/document_spec.rb