Sha256: efbdcc994ab73a4e02e0865eb5ebee304f14a7bf179122f8e0fba30defa10902
Contents?: true
Size: 1.41 KB
Versions: 7
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' describe Browser::DOM::Document do describe '#title' do it 'should get the document title' do expect($document.title).to be_a(String) end end describe '#title=' do it 'should set the document title' do old = $document.title $document.title = 'lol' expect($document.title).to eq('lol') $document.title = old end end describe "#[]" do html <<-HTML <div id="lol"></div> HTML it "should get element by id" do expect($document["lol"]).to eq(`document.getElementById('lol')`) end it "should get element by css" do expect($document["#lol"]).to eq(`document.getElementById('lol')`) end it "should get element by xpath" do expect($document["//*[@id='lol']"]).to eq(`document.getElementById('lol')`) end it "should return nil if it can't find anything" do expect($document["doo-dah"]).to be_nil end end describe "#ready" do it "calls the block when the document is ready" do promise = Browser::Promise.new $document.ready do expect(true).to be_truthy promise.resolve end promise.for_rspec end end describe "#ready?" do it "is true inside a #ready block" do promise = Browser::Promise.new $document.ready do expect($document.ready?).to be_truthy promise.resolve end promise.for_rspec end end end
Version data entries
7 entries across 7 versions & 2 rubygems