Sha256: c2ca8cd39a037093cdc91d8a107a553b43a59702514465237209f356d5739caf

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'

describe Browser::DOM::MutationObserver do
  html <<-HTML
    <div id="mutate">
      <span></span>
    </div>
  HTML

  async 'notifies additions' do
    obs = Browser::DOM::MutationObserver.new {|mutations|
      run_async {
        mutations.first.added.first.name.should == 'DIV'
      }

      obs.disconnect
    }

    obs.observe $document[:mutate]

    $document[:mutate].add_child $document.create_element('div')
  end

  async 'notifies removals' do
    obs = Browser::DOM::MutationObserver.new {|mutations|
      run_async {
        mutations.first.removed.first.name.should == 'SPAN'
      }

      obs.disconnect
    }

    obs.observe $document[:mutate]

    $document[:mutate].first_element_child.remove
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-browser-0.1.0.beta1 spec/dom/mutation_observer_spec.rb