Sha256: b68cbba026a7d1aa3b9d4f5f89a14696787cb678646606b33e3b41a14b325e8f

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe 'Hyperloop::Vis::Component', js: true do

  it 'creates a component by using the mixin and renders it' do
    mount 'OuterComponent' do
      class VisComponent
        include Hyperloop::Vis::Mixin

        render_with_dom_node do |dom_node, data|
          net = Vis::Network.new(dom_node, data)
        end
      end
      class OuterComponent < Hyperloop::Component
        render do
          data = Vis::DataSet.new([{id: 1, name: 'foo'}, {id: 2, name: 'bar'}, {id: 3, name: 'pub'}])
          DIV { VisComponent(data: data)}
        end
      end
    end
    expect(page.body).to include('<canvas')
  end

  it 'creates a component by inheriting and renders it' do
    mount 'OuterComponent' do
      class VisComponent < Hyperloop::Vis::Component
        render_with_dom_node do |dom_node, data|
          net = Vis::Network.new(dom_node, data)
        end
      end
      class OuterComponent < Hyperloop::Component
        render do
          data = Vis::DataSet.new([{id: 1, name: 'foo'}, {id: 2, name: 'bar'}, {id: 3, name: 'pub'}])
          DIV { VisComponent(data: data)}
        end
      end
    end
    expect(page.body).to include('<canvas')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-vis-1.0.0.lap25 spec/vis_component_spec.rb
hyper-vis-1.0.0.lap24 spec/vis_component_spec.rb