volt 0.7.23 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -1
- data/CHANGELOG.md +22 -0
- data/Gemfile +8 -0
- data/Guardfile +2 -2
- data/Readme.md +139 -136
- data/VERSION +1 -1
- data/app/volt/assets/js/setImmediate.js +175 -0
- data/app/volt/tasks/live_query/data_store.rb +0 -2
- data/app/volt/tasks/live_query/live_query.rb +4 -4
- data/docs/GETTING_STARTED.md +24 -3
- data/docs/WHY.md +1 -22
- data/lib/volt.rb +20 -1
- data/lib/volt/console.rb +20 -0
- data/lib/volt/controllers/model_controller.rb +25 -11
- data/lib/volt/extra_core/object.rb +2 -14
- data/lib/volt/extra_core/string.rb +4 -0
- data/lib/volt/models.rb +0 -1
- data/lib/volt/models/array_model.rb +8 -16
- data/lib/volt/models/cursor.rb +1 -1
- data/lib/volt/models/model.rb +40 -60
- data/lib/volt/models/model_hash_behaviour.rb +10 -24
- data/lib/volt/models/model_helpers.rb +2 -2
- data/lib/volt/models/model_state.rb +1 -1
- data/lib/volt/models/model_wrapper.rb +4 -4
- data/lib/volt/models/persistors/array_store.rb +44 -28
- data/lib/volt/models/persistors/base.rb +1 -1
- data/lib/volt/models/persistors/model_store.rb +1 -1
- data/lib/volt/models/persistors/params.rb +5 -1
- data/lib/volt/models/persistors/query/query_listener.rb +2 -0
- data/lib/volt/models/persistors/store.rb +3 -2
- data/lib/volt/models/persistors/store_state.rb +7 -2
- data/lib/volt/models/url.rb +35 -29
- data/lib/volt/models/validations.rb +7 -17
- data/lib/volt/page/bindings/attribute_binding.rb +57 -39
- data/lib/volt/page/bindings/base_binding.rb +0 -14
- data/lib/volt/page/bindings/content_binding.rb +15 -18
- data/lib/volt/page/bindings/each_binding.rb +67 -34
- data/lib/volt/page/bindings/if_binding.rb +15 -12
- data/lib/volt/page/bindings/template_binding.rb +77 -59
- data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +19 -4
- data/lib/volt/page/channel.rb +22 -38
- data/lib/volt/page/channel_stub.rb +3 -6
- data/lib/volt/page/page.rb +24 -26
- data/lib/volt/page/string_template_renderer.rb +46 -0
- data/lib/volt/page/sub_context.rb +7 -1
- data/lib/volt/page/targets/binding_document/component_node.rb +11 -9
- data/lib/volt/page/tasks.rb +3 -2
- data/lib/volt/page/url_tracker.rb +4 -3
- data/lib/volt/reactive/computation.rb +131 -0
- data/lib/volt/reactive/dependency.rb +71 -0
- data/lib/volt/reactive/eventable.rb +82 -0
- data/lib/volt/reactive/hash_dependency.rb +36 -0
- data/lib/volt/{controllers → reactive}/reactive_accessors.rb +8 -11
- data/lib/volt/reactive/reactive_array.rb +100 -193
- data/lib/volt/reactive/reactive_hash.rb +49 -0
- data/lib/volt/server/html_parser/attribute_scope.rb +24 -4
- data/lib/volt/server/html_parser/if_view_scope.rb +15 -15
- data/lib/volt/server/html_parser/view_scope.rb +31 -1
- data/spec/apps/kitchen_sink/Gemfile +4 -8
- data/spec/apps/kitchen_sink/app/main/config/dependencies.rb +8 -0
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +8 -1
- data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +8 -0
- data/spec/apps/kitchen_sink/app/main/views/main/bindings.html +73 -0
- data/spec/apps/kitchen_sink/app/main/views/main/index.html +6 -1
- data/spec/apps/kitchen_sink/app/main/views/main/main.html +26 -6
- data/spec/apps/kitchen_sink/app/main/views/main/store.html +6 -0
- data/spec/controllers/reactive_accessors_spec.rb +13 -15
- data/spec/integration/bindings_spec.rb +159 -0
- data/spec/integration/templates_spec.rb +15 -0
- data/spec/models/model_spec.rb +130 -228
- data/spec/reactive/computation_spec.rb +63 -0
- data/spec/reactive/dependency_spec.rb +5 -0
- data/spec/reactive/eventable_spec.rb +48 -0
- data/spec/reactive/reactive_array_spec.rb +97 -0
- data/spec/router/routes_spec.rb +26 -27
- data/spec/server/html_parser/view_parser_spec.rb +3 -21
- data/spec/server/rack/asset_files_spec.rb +1 -1
- data/templates/project/app/main/views/main/main.html +2 -2
- metadata +29 -41
- data/lib/volt/extra_core/time.rb +0 -16
- data/lib/volt/page/draw_cycle.rb +0 -31
- data/lib/volt/page/memory_test.rb +0 -26
- data/lib/volt/page/reactive_template.rb +0 -32
- data/lib/volt/reactive/array_extensions.rb +0 -12
- data/lib/volt/reactive/destructive_methods.rb +0 -19
- data/lib/volt/reactive/event_chain.rb +0 -125
- data/lib/volt/reactive/events.rb +0 -216
- data/lib/volt/reactive/object_tracking.rb +0 -14
- data/lib/volt/reactive/reactive_block.rb +0 -88
- data/lib/volt/reactive/reactive_generator.rb +0 -44
- data/lib/volt/reactive/reactive_tags.rb +0 -71
- data/lib/volt/reactive/reactive_value.rb +0 -427
- data/lib/volt/reactive/string_extensions.rb +0 -31
- data/spec/integration/test_integration_spec.rb +0 -14
- data/spec/models/event_chain_spec.rb +0 -150
- data/spec/models/model_buffers_spec.rb +0 -9
- data/spec/models/old_model_spec.rb +0 -67
- data/spec/models/reactive_array_spec.rb +0 -364
- data/spec/models/reactive_block_spec.rb +0 -13
- data/spec/models/reactive_call_times_spec.rb +0 -28
- data/spec/models/reactive_generator_spec.rb +0 -58
- data/spec/models/reactive_tags_spec.rb +0 -35
- data/spec/models/reactive_value_spec.rb +0 -370
- data/spec/models/store_spec.rb +0 -16
- data/spec/models/string_extensions_spec.rb +0 -57
data/spec/models/store_spec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# require 'volt/models'
|
2
|
-
#
|
3
|
-
# describe Store do
|
4
|
-
# # it "should stay as store classes when used" do
|
5
|
-
# # a = Store.new
|
6
|
-
# # expect(a._test.class).to eq(Store)
|
7
|
-
# #
|
8
|
-
# # expect(a._test._cool.class).to eq(Store)
|
9
|
-
# #
|
10
|
-
# # a._items << {_name: 'Test'}
|
11
|
-
# #
|
12
|
-
# # expect(a._items.class).to eq(StoreArray)
|
13
|
-
# # expect(a._items[0].class).to eq(Store)
|
14
|
-
# # expect(a._items[0]._name.class).to eq(String)
|
15
|
-
# # end
|
16
|
-
# end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'volt/models'
|
2
|
-
|
3
|
-
describe ReactiveValue do
|
4
|
-
it "should concat reactive strings" do
|
5
|
-
a = ReactiveValue.new('cool')
|
6
|
-
b = ReactiveValue.new('beans')
|
7
|
-
|
8
|
-
c = a + b
|
9
|
-
expect(c.cur).to eq('coolbeans')
|
10
|
-
expect(c.reactive?).to eq(true)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should concat reactive and non-reactive" do
|
14
|
-
a = ReactiveValue.new('cool')
|
15
|
-
b = 'beans'
|
16
|
-
|
17
|
-
c = a + b
|
18
|
-
expect(c.cur).to eq('coolbeans')
|
19
|
-
expect(c.reactive?).to eq(true)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should concat non-reactive and reactive" do
|
23
|
-
a = 'cool'
|
24
|
-
b = ReactiveValue.new('beans')
|
25
|
-
|
26
|
-
c = a + b
|
27
|
-
expect(c.cur).to eq('coolbeans')
|
28
|
-
expect(c.reactive?).to eq(true)
|
29
|
-
end
|
30
|
-
|
31
|
-
if RUBY_PLATFORM != 'opal'
|
32
|
-
it "should append reactive to reactive" do
|
33
|
-
a = ReactiveValue.new('cool')
|
34
|
-
b = ReactiveValue.new('beans')
|
35
|
-
|
36
|
-
a << b
|
37
|
-
expect(a.cur).to eq('coolbeans')
|
38
|
-
expect(a.reactive?).to eq(true)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should raise an exception when appending non-reactive and reactive" do
|
43
|
-
a = 'cool'
|
44
|
-
b = ReactiveValue.new('beans')
|
45
|
-
|
46
|
-
exception_count = 0
|
47
|
-
begin
|
48
|
-
a << b
|
49
|
-
rescue => e
|
50
|
-
expect(e.message[/Cannot append a reactive/].cur.true?).to eq(true)
|
51
|
-
exception_count += 1
|
52
|
-
end
|
53
|
-
|
54
|
-
expect(exception_count).to eq(1)
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|