hyper-vis 1.0.0.lap28 → 1.0.0.lap29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyperloop/vis/network/mixin.rb +2 -2
- data/lib/hyperloop/vis/version.rb +1 -1
- data/spec/vis_network_component_spec.rb +53 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51ebf1dd7cffeef29a5c842de5ad6d3be75d1f1b18bdd512303b725ed8b4abe3
|
4
|
+
data.tar.gz: 3a056f946d0425fa0f157dcfb540ca650cd6cfeb70c583908aeca3a082ee4077
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8614266c5254f555bd5cce838fb0c86fdfb23b9ef51c6efd4be3543e28e9e94707e346fbf2a0de804d8d6e33231e2fda2dff2cd0c1ca50a1f9f095f37992d60f
|
7
|
+
data.tar.gz: 8515cb2ee34ba375822451fdb57331bb77c3a9add6b1043ace4c48fab89856876038522c3d5555fef10585bc676eb9752949e36154aacfab7beee61bd498a19b
|
@@ -41,7 +41,7 @@ module Hyperloop
|
|
41
41
|
|
42
42
|
after_mount do
|
43
43
|
if @_dom_node && @_vis_render_block
|
44
|
-
|
44
|
+
instance_exec(@_dom_node, @_data, @_options, &@_vis_render_block)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -56,7 +56,7 @@ module Hyperloop
|
|
56
56
|
changed = true
|
57
57
|
end
|
58
58
|
if changed && @_dom_node && @_vis_render_block
|
59
|
-
|
59
|
+
instance_exec(@_dom_node, @_data, @_options, &@_vis_render_block)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -50,18 +50,68 @@ describe 'Hyperloop::Vis::Component', js: true do
|
|
50
50
|
render_with_dom_node do |dom_node, data, options|
|
51
51
|
@@passed_data = data
|
52
52
|
@@passed_options = options
|
53
|
-
net = Vis::Network.new(dom_node, data)
|
53
|
+
net = Vis::Network.new(dom_node, data, options)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
class OuterComponent < Hyperloop::Component
|
57
57
|
render do
|
58
58
|
data = Vis::DataSet.new([{id: 1, name: 'foo'}, {id: 2, name: 'bar'}, {id: 3, name: 'pub'}])
|
59
|
-
|
59
|
+
options = {
|
60
|
+
:auto_resize => true,
|
61
|
+
:locale => 'en',
|
62
|
+
:nodes => {
|
63
|
+
:scaling => {
|
64
|
+
:min => 16,
|
65
|
+
:max => 32
|
66
|
+
},
|
67
|
+
:shadow => true
|
68
|
+
},
|
69
|
+
:edges => {
|
70
|
+
:color => "#ff0000",
|
71
|
+
:smooth => false,
|
72
|
+
:shadow => true
|
73
|
+
}
|
74
|
+
}
|
75
|
+
DIV { VisComponent(vis_data: {nodes: data}, options: options)}
|
60
76
|
end
|
61
77
|
end
|
62
78
|
end
|
63
79
|
expect(page.body).to include('<canvas')
|
64
80
|
expect_evaluate_ruby('VisComponent.passed_data.has_key?(:nodes)').to eq(true)
|
65
|
-
expect_evaluate_ruby('VisComponent.passed_options.has_key?(:
|
81
|
+
expect_evaluate_ruby('VisComponent.passed_options.has_key?(:auto_resize)').to eq(true)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'can call a event_handler callback from render_with_dom_node' do
|
85
|
+
mount 'OuterComponent' do
|
86
|
+
class VisComponent < Hyperloop::Vis::Network::Component
|
87
|
+
|
88
|
+
def self.received_calls
|
89
|
+
@@recc ||= []
|
90
|
+
@@recc
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_handler_method(arg)
|
94
|
+
@@recc ||= []
|
95
|
+
@@recc << arg
|
96
|
+
end
|
97
|
+
|
98
|
+
render_with_dom_node do |dom_node, data|
|
99
|
+
net = Vis::Network.new(dom_node, data)
|
100
|
+
net.on(:resize) do |coords|
|
101
|
+
test_handler_method(coords)
|
102
|
+
end
|
103
|
+
net.set_size(100, 100)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
class OuterComponent < Hyperloop::Component
|
108
|
+
render do
|
109
|
+
data = Vis::DataSet.new([{id: 1, name: 'foo'}, {id: 2, name: 'bar'}, {id: 3, name: 'pub'}])
|
110
|
+
DIV { VisComponent(vis_data: {nodes: data})}
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
expect(page.body).to include('<canvas')
|
115
|
+
expect_evaluate_ruby('VisComponent.received_calls.size').to eq(1)
|
66
116
|
end
|
67
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-vis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.lap29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|