Sha256: dce09b15a9ec389f4629bbd166f2347168cec491b9807aaf71aba3275162e995
Contents?: true
Size: 1.32 KB
Versions: 7
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' describe Browser::NativeCachedWrapper do it 'deduplicates DOM objects' do expect($document.at_css("body").hash).to eq($document.body.hash) expect($document.body.hash).not_to eq($document.body.dup.hash) # Should dup/clone have different semantics? expect($document.body.hash).not_to eq($document.head.hash) end it 'accurately intercepts the last new call' do class Demo include Browser::NativeCachedWrapper def self.new(arg1, arg2) super(`{arg1: #{arg1}, arg2: #{arg2}}`) end def data [:data, `#@native.arg1`, `#@native.arg2`] end end class SuperDemo < Demo def self.new(arg1, arg2, arg3) super("superdemo", "#{arg1} - #{arg2} - #{arg3}") end end expect(Demo.new("a", "b").data).to eq([:data, "a", "b"]) expect(SuperDemo.new("1", "2", "3").data).to eq([:data, "superdemo", "1 - 2 - 3"]) end html <<-HTML <iframe id='ifr' src='about:blank' sandbox=''></iframe> HTML it 'supports restricted objects' do # Window won't be restricted expect($window.restricted?).to eq(false) # Iframe itself won't be restricted expect($document['ifr'].restricted?).to eq(false) # But its content_window will be (due to CORS) expect($document['ifr'].content_window.restricted?).to eq(true) end end
Version data entries
7 entries across 7 versions & 2 rubygems