netzke-core 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/CHANGELOG.md +572 -0
- data/LICENSE +7 -1
- data/README.md +345 -29
- data/Rakefile +3 -3
- data/app/controllers/netzke_controller.rb +37 -48
- data/config/ci/before-travis.sh +3 -4
- data/javascripts/base.js +86 -150
- data/javascripts/ext.js +180 -210
- data/javascripts/{core_extensions.js → js_extensions.js} +0 -0
- data/lib/netzke-core.rb +16 -6
- data/lib/netzke/base.rb +84 -107
- data/lib/netzke/core.rb +7 -41
- data/lib/netzke/core/action_config.rb +37 -0
- data/lib/netzke/core/actions.rb +123 -0
- data/lib/netzke/core/client_class.rb +252 -0
- data/lib/netzke/core/component_config.rb +12 -0
- data/lib/netzke/core/composition.rb +274 -0
- data/lib/netzke/core/config_to_dsl_delegator.rb +69 -0
- data/lib/netzke/core/configuration.rb +63 -0
- data/lib/netzke/core/css_config.rb +51 -0
- data/lib/netzke/core/dynamic_assets.rb +19 -49
- data/lib/netzke/{embedding.rb → core/embedding.rb} +4 -6
- data/lib/netzke/core/endpoint_response.rb +15 -0
- data/lib/netzke/core/javascript.rb +111 -0
- data/lib/netzke/core/panel.rb +11 -0
- data/lib/netzke/{plugins.rb → core/plugins.rb} +10 -5
- data/lib/netzke/core/railz.rb +4 -0
- data/lib/netzke/{railz → core/railz}/action_view_ext.rb +22 -18
- data/lib/netzke/core/railz/action_view_ext/ext.rb +49 -0
- data/lib/netzke/core/railz/controller_extensions.rb +17 -0
- data/lib/netzke/core/railz/engine.rb +16 -0
- data/lib/netzke/core/railz/routes.rb +10 -0
- data/lib/netzke/core/ruby_ext.rb +5 -0
- data/lib/netzke/core/ruby_ext/array.rb +23 -0
- data/lib/netzke/core/ruby_ext/hash.rb +47 -0
- data/lib/netzke/{core_ext → core/ruby_ext}/string.rb +2 -7
- data/lib/netzke/core/ruby_ext/symbol.rb +13 -0
- data/lib/netzke/{core_ext → core/ruby_ext}/time_with_zone.rb +0 -0
- data/lib/netzke/core/services.rb +130 -0
- data/lib/netzke/core/session.rb +15 -19
- data/lib/netzke/core/state.rb +40 -0
- data/lib/netzke/core/stylesheets.rb +48 -0
- data/lib/netzke/core/version.rb +2 -2
- data/lib/netzke/plugin.rb +8 -11
- data/netzke-core.gemspec +69 -59
- data/test/core_test_app/Gemfile +2 -20
- data/test/core_test_app/Gemfile.lock +65 -74
- data/test/core_test_app/app/components/card_component_loader.rb +4 -4
- data/test/core_test_app/app/components/component_loader.rb +40 -120
- data/test/core_test_app/app/components/component_loader/javascripts/component_loader.js +49 -0
- data/test/core_test_app/app/components/component_with_actions.rb +61 -47
- data/test/core_test_app/app/components/component_with_custom_css.rb +8 -5
- data/test/core_test_app/app/components/component_with_js_mixin.rb +11 -5
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_one.js +1 -1
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_two.js +1 -1
- data/test/core_test_app/app/components/component_with_js_mixin/javascripts/method_set_one.js +1 -1
- data/test/core_test_app/app/components/component_with_nested_through.rb +2 -2
- data/test/core_test_app/app/components/component_with_prebuilt_toolbar_control.rb +12 -0
- data/test/core_test_app/app/components/component_with_prebuilt_toolbar_control/javascripts/component_with_prebuilt_toolbar_control.js +12 -0
- data/test/core_test_app/app/components/component_with_required_js.rb +24 -0
- data/test/core_test_app/app/components/configurable_on_class_level.rb +8 -0
- data/test/core_test_app/app/components/dsl_delegated_properties.rb +4 -0
- data/test/core_test_app/app/components/dsl_delegated_properties_base.rb +5 -0
- data/test/core_test_app/app/components/dynamic_tab_panel/javascripts/dynamic_tab_panel.js +2 -2
- data/test/core_test_app/app/components/ext_direct/composite.rb +32 -33
- data/test/core_test_app/app/components/ext_direct/details.rb +2 -4
- data/test/core_test_app/app/components/ext_direct/selector.rb +20 -22
- data/test/core_test_app/app/components/ext_direct/statistics.rb +2 -4
- data/test/core_test_app/app/components/extended_component_with_actions.rb +7 -3
- data/test/core_test_app/app/components/extended_component_with_js_mixin.rb +7 -4
- data/test/core_test_app/app/components/extended_component_with_js_mixin/javascripts/some_method_set.js +1 -1
- data/test/core_test_app/app/components/extended_server_caller.rb +20 -14
- data/test/core_test_app/app/components/hello_world.rb +23 -0
- data/test/core_test_app/app/components/hello_world/javascripts/hello_world.js +12 -0
- data/test/core_test_app/app/components/included.js +2 -2
- data/test/core_test_app/app/components/kinda_complex_component.rb +1 -3
- data/test/core_test_app/app/components/kinda_complex_component/basic_stuff.rb +15 -17
- data/test/core_test_app/app/components/kinda_complex_component/extra_stuff.rb +4 -5
- data/test/core_test_app/app/components/loader_of_component_with_custom_css.rb +14 -5
- data/test/core_test_app/app/components/localized_panel.rb +23 -25
- data/test/core_test_app/app/components/multipane_component_loader.rb +19 -20
- data/test/core_test_app/app/components/nested_component.rb +4 -5
- data/test/core_test_app/app/components/panel_with_plugin.rb +8 -3
- data/test/core_test_app/app/components/panel_with_tools.rb +15 -14
- data/test/core_test_app/app/components/plugin_with_components.rb +20 -12
- data/test/core_test_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +5 -2
- data/test/core_test_app/app/components/scoped_components/extended_scoped_component.rb +5 -2
- data/test/core_test_app/app/components/scoped_components/some_scoped_component.rb +5 -2
- data/test/core_test_app/app/components/server_caller.rb +39 -17
- data/test/core_test_app/app/components/server_caller/javascripts/server_caller.js +42 -0
- data/test/core_test_app/app/components/server_counter.rb +18 -82
- data/test/core_test_app/app/components/server_counter/javascripts/server_counter.js +53 -0
- data/test/core_test_app/app/components/simple_authentication_component.rb +46 -0
- data/test/core_test_app/app/components/simple_component.rb +8 -3
- data/test/core_test_app/app/components/simple_composite.rb +12 -0
- data/test/core_test_app/app/components/simple_form_with_file_upload.rb +49 -0
- data/test/core_test_app/app/components/simple_panel.rb +2 -2
- data/test/core_test_app/app/components/simple_tab_panel.rb +24 -3
- data/test/core_test_app/app/components/simple_window.rb +4 -2
- data/test/core_test_app/app/components/some_composite.rb +77 -48
- data/test/core_test_app/app/components/some_plugin.rb +31 -30
- data/test/core_test_app/app/components/stateful_component.rb +46 -0
- data/test/core_test_app/app/components/stateful_component_with_shared_state.rb +11 -0
- data/test/core_test_app/app/components/window_with_simple_component.rb +14 -0
- data/test/core_test_app/app/views/layouts/application.html.erb +1 -1
- data/test/core_test_app/app/views/simple_rails/multiple_nested.html.erb +7 -19
- data/test/core_test_app/app/views/simple_rails/panel.html.erb +1 -0
- data/test/core_test_app/config/database.yml.travis +3 -5
- data/test/core_test_app/config/environments/production.rb +1 -1
- data/test/core_test_app/config/initializers/netzke.rb +3 -1
- data/test/core_test_app/config/locales/en.yml +9 -4
- data/test/core_test_app/config/locales/es.yml +4 -2
- data/test/core_test_app/config/routes.rb +2 -8
- data/test/core_test_app/db/schema.rb +3 -11
- data/test/core_test_app/features/actions_and_tools.feature +1 -0
- data/test/core_test_app/features/client-server.feature +7 -0
- data/test/core_test_app/features/component_loader.feature +13 -13
- data/test/core_test_app/features/composition.feature +14 -0
- data/test/core_test_app/features/config_to_dsl_delegation.feature +10 -0
- data/test/core_test_app/features/file_inclusion.feature +1 -1
- data/test/core_test_app/features/i18n.feature +4 -4
- data/test/core_test_app/features/js_include.feature +1 -1
- data/test/core_test_app/features/persistence.feature +21 -5
- data/test/core_test_app/features/step_definitions/generic_steps.rb +14 -0
- data/test/core_test_app/features/support/paths.rb +0 -3
- data/test/core_test_app/public/images/icons/accept.png +0 -0
- data/test/core_test_app/public/images/icons/anchor.png +0 -0
- data/test/core_test_app/public/images/icons/tick.png +0 -0
- data/test/core_test_app/spec/action_config_spec.rb +15 -0
- data/test/core_test_app/spec/{component/actions_spec.rb → actions_spec.rb} +38 -36
- data/test/core_test_app/spec/base_spec.rb +35 -0
- data/test/core_test_app/spec/client_class_spec.rb +17 -0
- data/test/core_test_app/spec/component +0 -0
- data/test/core_test_app/spec/composition_spec.rb +118 -0
- data/test/core_test_app/spec/core_ext_spec.rb +3 -14
- data/test/core_test_app/spec/endpoint_response_spec.rb +17 -0
- data/test/core_test_app/spec/javascript_spec.rb +33 -0
- data/test/core_test_app/spec/js_class_config_scope.rb +37 -0
- data/test/core_test_app/spec/panel_spec.rb +11 -0
- data/test/core_test_app/spec/services_spec.rb +16 -0
- data/test/core_test_app/spec/state_spec.rb +20 -0
- data/test/unit/core_ext_test.rb +0 -53
- data/test/unit/netzke_core_test.rb +11 -11
- metadata +76 -62
- data/CHANGELOG.rdoc +0 -325
- data/javascripts/touch.js +0 -58
- data/lib/netzke/actions.rb +0 -107
- data/lib/netzke/composition.rb +0 -224
- data/lib/netzke/config_to_dsl_delegator.rb +0 -43
- data/lib/netzke/configuration.rb +0 -195
- data/lib/netzke/core/masquerading.rb +0 -34
- data/lib/netzke/core_ext.rb +0 -6
- data/lib/netzke/core_ext/array.rb +0 -30
- data/lib/netzke/core_ext/hash.rb +0 -86
- data/lib/netzke/core_ext/symbol.rb +0 -21
- data/lib/netzke/ext_component.rb +0 -25
- data/lib/netzke/inheritance.rb +0 -31
- data/lib/netzke/javascript.rb +0 -382
- data/lib/netzke/javascript/scopes.rb +0 -39
- data/lib/netzke/railz.rb +0 -4
- data/lib/netzke/railz/action_view_ext/ext.rb +0 -64
- data/lib/netzke/railz/action_view_ext/touch.rb +0 -52
- data/lib/netzke/railz/controller_extensions.rb +0 -33
- data/lib/netzke/railz/engine.rb +0 -48
- data/lib/netzke/railz/routes.rb +0 -7
- data/lib/netzke/services.rb +0 -101
- data/lib/netzke/session.rb +0 -54
- data/lib/netzke/state.rb +0 -91
- data/lib/netzke/stylesheets.rb +0 -65
- data/test/core_test_app/app/components/component_with_included_js.rb +0 -16
- data/test/core_test_app/app/components/component_with_session_persistence.rb +0 -35
- data/test/core_test_app/app/components/deprecated/server_caller.rb +0 -20
- data/test/core_test_app/app/components/dynamic_tab_panel.rb +0 -19
- data/test/core_test_app/app/components/hello_world_component.rb +0 -31
- data/test/core_test_app/app/components/touch/hello_world_component.rb +0 -25
- data/test/core_test_app/app/components/touch/server_caller.rb +0 -28
- data/test/core_test_app/app/components/touch/simple_carousel.rb +0 -17
- data/test/core_test_app/app/controllers/touch_controller.rb +0 -6
- data/test/core_test_app/app/helpers/touch_helper.rb +0 -2
- data/test/core_test_app/app/views/layouts/touch.html.erb +0 -13
- data/test/core_test_app/db/migrate/20110110132720_create_netzke_component_states.rb +0 -20
- data/test/core_test_app/features/step_definitions/touch_steps.rb +0 -3
- data/test/core_test_app/features/touch.feature +0 -10
- data/test/core_test_app/gemfiles/rails3_1.gemfile +0 -16
- data/test/core_test_app/gemfiles/rails3_2.gemfile +0 -16
- data/test/core_test_app/spec/component/base_spec.rb +0 -36
- data/test/core_test_app/spec/component/component_spec.rb +0 -20
- data/test/core_test_app/spec/component/composition_spec.rb +0 -132
- data/test/core_test_app/spec/component/configuration_spec.rb +0 -61
- data/test/core_test_app/spec/component/javascript_spec.rb +0 -16
- data/test/core_test_app/spec/component/state_spec.rb +0 -18
@@ -0,0 +1,11 @@
|
|
1
|
+
# This component shares state with StatefulComponent by setting +persistence_key+ to that component's js_id (which is used as persestence_key by default)
|
2
|
+
class StatefulComponentWithSharedState < Netzke::Base
|
3
|
+
def configure(c)
|
4
|
+
super
|
5
|
+
c.persistence = true
|
6
|
+
c.persistence_key = :stateful_component
|
7
|
+
|
8
|
+
# title will be gotten from component's state
|
9
|
+
c.title = state[:title] || "Default Title"
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class WindowWithSimpleComponent < SimpleWindow
|
2
|
+
js_configure do |c|
|
3
|
+
c.layout = :fit
|
4
|
+
end
|
5
|
+
|
6
|
+
def configure(c)
|
7
|
+
c.items = [:simple_component]
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
component :simple_component do |c|
|
12
|
+
c.title = "Simple Component Inside Window"
|
13
|
+
end
|
14
|
+
end
|
@@ -1,23 +1,11 @@
|
|
1
1
|
<%= netzke :tab_panel_one, {
|
2
|
-
:
|
3
|
-
:
|
4
|
-
:
|
5
|
-
:class_name => "ServerCaller",
|
6
|
-
:title => "Server Caller One"
|
7
|
-
},{
|
8
|
-
:class_name => "ServerCaller",
|
9
|
-
:title => "Server Caller Two"
|
10
|
-
}]
|
2
|
+
height: 200,
|
3
|
+
class_name: "SimpleTabPanel",
|
4
|
+
items: [:server_caller, :extended_server_caller]
|
11
5
|
} %>
|
12
6
|
|
13
7
|
<%= netzke :tab_panel_two, {
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
|
18
|
-
:title => "Server Caller One"
|
19
|
-
},{
|
20
|
-
:class_name => "ExtendedServerCaller",
|
21
|
-
:title => "Server Caller Two"
|
22
|
-
}]
|
23
|
-
} %>
|
8
|
+
height: 200,
|
9
|
+
class_name: "SimpleTabPanel",
|
10
|
+
items: [:extended_server_caller, :server_caller]
|
11
|
+
} %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= netzke :panel, class_name: "Netzke::Core::Panel" %>
|
@@ -2,12 +2,10 @@
|
|
2
2
|
# re-generated from your development database when you run "rake".
|
3
3
|
# Do not set this db to the same as development or production.
|
4
4
|
test: &test
|
5
|
-
adapter:
|
6
|
-
|
7
|
-
reconnect: false
|
8
|
-
database: nct_test
|
5
|
+
adapter: sqlite3
|
6
|
+
database: db/test.sqlite3
|
9
7
|
pool: 5
|
10
|
-
|
8
|
+
timeout: 5000
|
11
9
|
|
12
10
|
cucumber:
|
13
11
|
<<: *test
|
@@ -29,7 +29,7 @@ RailsApp::Application.configure do
|
|
29
29
|
|
30
30
|
# Disable Rails's static asset server
|
31
31
|
# In production, Apache or nginx will already do this
|
32
|
-
config.serve_static_assets = false
|
32
|
+
# config.serve_static_assets = false
|
33
33
|
|
34
34
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
35
|
# config.action_controller.asset_host = "http://assets.example.com"
|
@@ -4,15 +4,20 @@
|
|
4
4
|
en:
|
5
5
|
server_caller:
|
6
6
|
actions:
|
7
|
-
bug_server:
|
7
|
+
bug_server:
|
8
|
+
text: Call server
|
9
|
+
tooltip: This bugs server
|
10
|
+
icon: tick
|
8
11
|
extended_server_caller:
|
9
12
|
actions:
|
10
|
-
bug_server:
|
11
|
-
|
13
|
+
bug_server:
|
14
|
+
text: Call server extensively
|
15
|
+
tooltip: This bugs server in its own way
|
12
16
|
localized_panel:
|
13
17
|
title: Localized Panel
|
14
18
|
property_one: First property
|
15
19
|
property_two: Second property
|
16
20
|
action_two: Second action
|
17
21
|
actions:
|
18
|
-
action_one:
|
22
|
+
action_one:
|
23
|
+
text: First action
|
@@ -1,4 +1,6 @@
|
|
1
1
|
RailsApp::Application.routes.draw do
|
2
|
+
netzke "/some/path/netzke" # the path is optional
|
3
|
+
|
2
4
|
# The priority is based upon order of creation:
|
3
5
|
# first created -> highest priority.
|
4
6
|
|
@@ -61,13 +63,5 @@ RailsApp::Application.routes.draw do
|
|
61
63
|
# Components configured in Rails views
|
62
64
|
match 'simple_rails/:action' => 'simple_rails', :as => 'simple_rails_views'
|
63
65
|
|
64
|
-
# Touch components
|
65
|
-
match 'components/touch/:component' => 'touch#index', :as => "touch_components"
|
66
|
-
|
67
|
-
# Non-Netzke Ext components
|
68
|
-
match 'ext/:component' => 'components#ext', :as => "ext"
|
69
|
-
|
70
66
|
match ':controller(/:action(/:id(.:format)))'
|
71
|
-
|
72
|
-
netzke
|
73
67
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
# This file is auto-generated from the current state of the database. Instead
|
2
3
|
# of editing this file, please use the migrations feature of Active Record to
|
3
4
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -17,21 +18,12 @@ ActiveRecord::Schema.define(:version => 20110110132720) do
|
|
17
18
|
t.integer "user_id"
|
18
19
|
t.integer "role_id"
|
19
20
|
t.text "value"
|
20
|
-
t.datetime "created_at"
|
21
|
-
t.datetime "updated_at"
|
21
|
+
t.datetime "created_at", :null => false
|
22
|
+
t.datetime "updated_at", :null => false
|
22
23
|
end
|
23
24
|
|
24
25
|
add_index "netzke_component_states", ["component"], :name => "index_netzke_component_states_on_component"
|
25
26
|
add_index "netzke_component_states", ["role_id"], :name => "index_netzke_component_states_on_role_id"
|
26
27
|
add_index "netzke_component_states", ["user_id"], :name => "index_netzke_component_states_on_user_id"
|
27
28
|
|
28
|
-
create_table "netzke_preferences", :force => true do |t|
|
29
|
-
t.string "key"
|
30
|
-
t.text "value"
|
31
|
-
t.integer "user_id"
|
32
|
-
t.integer "role_id"
|
33
|
-
t.datetime "created_at"
|
34
|
-
t.datetime "updated_at"
|
35
|
-
end
|
36
|
-
|
37
29
|
end
|
@@ -6,6 +6,7 @@ Feature: Actions
|
|
6
6
|
@javascript
|
7
7
|
Scenario: Pressing button should result in corresponding actions
|
8
8
|
When I go to the ComponentWithActions test page
|
9
|
+
Then I should not see "Excluded action"
|
9
10
|
Then I should see "Disabled action"
|
10
11
|
And button "Disabled action" should be disabled
|
11
12
|
|
@@ -9,4 +9,11 @@ Scenario: Ask server to set our title
|
|
9
9
|
Then I should see "Server Caller"
|
10
10
|
|
11
11
|
When I press "Call server"
|
12
|
+
And I wait for response from server
|
12
13
|
Then I should see "All quiet here on the server"
|
14
|
+
|
15
|
+
@selenium
|
16
|
+
Scenario: Calling an endpoint with callback and scope
|
17
|
+
Given I am on the ServerCaller test page
|
18
|
+
When I press "Call with generic callback and scope"
|
19
|
+
Then I should see "Fancy title set!"
|
@@ -19,18 +19,6 @@ Feature: Component loader
|
|
19
19
|
When I press "Load with feedback"
|
20
20
|
Then I should see "Callback invoked!"
|
21
21
|
|
22
|
-
@selenium
|
23
|
-
Scenario: Component loader should invoke a generic endpoint callback
|
24
|
-
Given I am on the ComponentLoader test page
|
25
|
-
When I press "Load with generic callback"
|
26
|
-
Then I should see "Generic callback invoked!"
|
27
|
-
|
28
|
-
@selenium
|
29
|
-
Scenario: Component loader should invoke a generic endpoint callback
|
30
|
-
Given I am on the ComponentLoader test page
|
31
|
-
When I press "Load with generic callback and scope"
|
32
|
-
Then I should see "Fancy title set!"
|
33
|
-
|
34
22
|
@selenium
|
35
23
|
Scenario: Component loader should load a window component with another component in it
|
36
24
|
Given I am on the ComponentLoader test page
|
@@ -45,8 +33,20 @@ Feature: Component loader
|
|
45
33
|
Then I should see "Simple Component with changed HTML"
|
46
34
|
|
47
35
|
@javascript
|
48
|
-
Scenario: Component loader should report that it can't load a component
|
36
|
+
Scenario: Component loader should report that it can't load a component and stay adequate
|
49
37
|
Given I am on the ComponentLoader test page
|
50
38
|
When I press "Non-existing component"
|
51
39
|
Then I should see "Couldn't load component 'non_existing_component'"
|
52
40
|
And I should not see "Loading"
|
41
|
+
|
42
|
+
@javascript
|
43
|
+
Scenario: Component loader not be able to load a component marked as excluded
|
44
|
+
Given I am on the ComponentLoader test page
|
45
|
+
When I press "Inaccessible"
|
46
|
+
Then I should see "Couldn't load component 'inaccessible'"
|
47
|
+
|
48
|
+
@javascript
|
49
|
+
Scenario: Loading component's config
|
50
|
+
Given I am on the ComponentLoader test page
|
51
|
+
When I press "Config only"
|
52
|
+
Then I should see "SimpleComponent (overridden)"
|
@@ -29,3 +29,17 @@ Feature: Composition
|
|
29
29
|
When I press "Update east south from server"
|
30
30
|
And I wait for response from server
|
31
31
|
Then I should see "Here's an update for south panel in east panel"
|
32
|
+
|
33
|
+
@javascript
|
34
|
+
Scenario: Instantiation of pre-loaded Netzke components
|
35
|
+
Given I am on the SomeComposite test page
|
36
|
+
When I press "Show hidden window"
|
37
|
+
And I wait for response from server
|
38
|
+
Then I should see "Hidden window gone visible!"
|
39
|
+
|
40
|
+
@javascript
|
41
|
+
Scenario: Excluding components for the layout
|
42
|
+
When I go to the SimpleTabPanel test page
|
43
|
+
Then tab panel should have tab with title "Server Caller"
|
44
|
+
And tab panel should have tab with title "Extended Server Caller"
|
45
|
+
But tab panel should not have tab with title "Hello World component"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Config to dsl delegation
|
2
|
+
In order to value
|
3
|
+
As a role
|
4
|
+
I want feature
|
5
|
+
|
6
|
+
@javascript
|
7
|
+
Scenario: A base components delegates its configuration options to DSL
|
8
|
+
When I go to the DslDelegatedProperties test page
|
9
|
+
Then I should see "Title set via DSL"
|
10
|
+
And I should see "HTML set via DSL"
|
@@ -5,6 +5,6 @@ Feature: File inclusion
|
|
5
5
|
|
6
6
|
@javascript
|
7
7
|
Scenario: A component with external JS file included
|
8
|
-
Given I am on the
|
8
|
+
Given I am on the ComponentWithRequiredJs test page
|
9
9
|
When I press "Print message"
|
10
10
|
Then I should see "Some message shown in the body"
|
@@ -17,8 +17,9 @@ Scenario: LocalizedPanel should be available in 2 languages
|
|
17
17
|
And I should see "Primera acción"
|
18
18
|
And I should see "Segunda acción"
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
# Ext.LoadMask.prototype.msg is not translated in Ext 4.1.1
|
21
|
+
# When I press "Tercera acción"
|
22
|
+
# Then I should see "Cargando..."
|
22
23
|
|
23
24
|
When I go to the "es" version of the ExtendedLocalizedPanel page
|
24
25
|
Then I should see "Panel Localizada"
|
@@ -26,10 +27,9 @@ Scenario: LocalizedPanel should be available in 2 languages
|
|
26
27
|
And I should see "Action one"
|
27
28
|
And I should see "Segunda acción"
|
28
29
|
|
30
|
+
# Making sure that the locale is restored to "en" in the end
|
29
31
|
When I go to the "en" version of the ExtendedLocalizedPanel page
|
30
32
|
Then I should see "Localized Panel"
|
31
33
|
And I should see "First property, Second property"
|
32
34
|
And I should see "Action one"
|
33
35
|
And I should see "Second action"
|
34
|
-
|
35
|
-
# NOTE: make sure that the locale is restored to "en" in the end!
|
@@ -17,4 +17,4 @@ Feature: JsMixins
|
|
17
17
|
Scenario: ExtendedComponentWithJsMixin should behave, too
|
18
18
|
Given I am on the ExtendedComponentWithJsMixin test page
|
19
19
|
When I press "Action three"
|
20
|
-
Then I should see "
|
20
|
+
Then I should see "Modified action Three triggered!"
|
@@ -5,14 +5,30 @@ Feature: Persistence
|
|
5
5
|
|
6
6
|
@javascript
|
7
7
|
Scenario: The component with persistence should be able to store and retrieve a persistence setting
|
8
|
-
When I go to the
|
8
|
+
When I go to the StatefulComponent test page
|
9
9
|
Then I should see "Default Title"
|
10
10
|
And I should see "Default HTML"
|
11
|
-
But I should not see "Title From
|
11
|
+
But I should not see "Title From State"
|
12
12
|
And I should not see "HTML from session"
|
13
13
|
|
14
|
-
When I press "
|
14
|
+
When I press "Set session and state"
|
15
15
|
And I wait for response from server
|
16
|
-
And I go to the
|
17
|
-
Then I should see "Title From
|
16
|
+
And I go to the StatefulComponent test page
|
17
|
+
Then I should see "Title From State"
|
18
18
|
And I should see "HTML from session"
|
19
|
+
|
20
|
+
When I press "Reset session and state"
|
21
|
+
And I wait for response from server
|
22
|
+
And I go to the StatefulComponent test page
|
23
|
+
Then I should see "Default Title"
|
24
|
+
And I should see "Default HTML"
|
25
|
+
But I should not see "Title From State"
|
26
|
+
And I should not see "HTML from session"
|
27
|
+
|
28
|
+
@javascript
|
29
|
+
Scenario: Sharing persistence key
|
30
|
+
When I go to the StatefulComponent test page
|
31
|
+
And I press "Set session and state"
|
32
|
+
And I wait for response from server
|
33
|
+
And I go to the StatefulComponentWithSharedState test page
|
34
|
+
Then I should see "Title From State"
|
@@ -41,6 +41,20 @@ When /^I press tool "([^"]*)"$/ do |tool|
|
|
41
41
|
find("##{id} img").click
|
42
42
|
end
|
43
43
|
|
44
|
+
Then /^tab panel should have tab with title "(.*?)"$/ do |arg1|
|
45
|
+
page.driver.browser.execute_script(<<-JS).should == true
|
46
|
+
var tabPanel = Ext.ComponentQuery.query('tabpanel')[0];
|
47
|
+
return !!tabPanel.down('[title="#{arg1}"]');
|
48
|
+
JS
|
49
|
+
end
|
50
|
+
|
51
|
+
Then /^tab panel should not have tab with title "(.*?)"$/ do |arg1|
|
52
|
+
page.driver.browser.execute_script(<<-JS).should == true
|
53
|
+
var tabPanel = Ext.ComponentQuery.query('tabpanel')[0];
|
54
|
+
return !tabPanel.down('[title="#{arg1}"]');
|
55
|
+
JS
|
56
|
+
end
|
57
|
+
|
44
58
|
When /^I wait for response from server$/ do
|
45
59
|
page.wait_until{ page.driver.browser.execute_script("return !Netzke.ajaxIsLoading()") }
|
46
60
|
end
|
@@ -23,9 +23,6 @@ module NavigationHelpers
|
|
23
23
|
when /the (.*) test page/
|
24
24
|
components_path(:component => $1)
|
25
25
|
|
26
|
-
when /the (.*) page for touch/
|
27
|
-
touch_components_path(:component => $1)
|
28
|
-
|
29
26
|
when /the "(.+)" version of the (.*) page/
|
30
27
|
components_path(:component => $2, :locale => $1)
|
31
28
|
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Netzke::Core
|
4
|
+
describe ActionConfig do
|
5
|
+
it "should preserve localized attributes from superclass if those are not overridden" do
|
6
|
+
sc = ServerCaller.new
|
7
|
+
esc = ExtendedServerCaller.new
|
8
|
+
sc.actions[:bug_server].text.should == "Call server"
|
9
|
+
esc.actions[:bug_server].text.should == "Call server extensively"
|
10
|
+
|
11
|
+
sc.actions[:bug_server].tooltip.should == "This bugs server"
|
12
|
+
esc.actions[:bug_server].tooltip.should == "This bugs server in its own way"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,25 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require 'netzke-core'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
|
-
module Netzke
|
3
|
+
module Netzke::Core
|
5
4
|
describe Actions do
|
6
|
-
|
7
|
-
# ExtendedComponentWithActions.new.actions[:another_action][:disabled].should == true
|
8
|
-
# end
|
9
|
-
|
10
|
-
class SomeComponent < Base
|
5
|
+
class SomeComponent < Netzke::Base
|
11
6
|
action :action_one
|
12
7
|
action :action_two
|
13
|
-
action :action_three do
|
14
|
-
|
8
|
+
action :action_three do |a|
|
9
|
+
a.text = "Action three"
|
15
10
|
end
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
{
|
21
|
-
:tbar => [:action_three.action]
|
22
|
-
}
|
12
|
+
def configure(c)
|
13
|
+
super
|
14
|
+
c.tbar = [:action_one, :action_two, :action_three]
|
23
15
|
end
|
24
16
|
|
25
17
|
def actions
|
@@ -28,40 +20,50 @@ module Netzke
|
|
28
20
|
})
|
29
21
|
end
|
30
22
|
|
31
|
-
action :action_five
|
23
|
+
action :action_five do |a|
|
24
|
+
a.text = "Action 5"
|
25
|
+
end
|
32
26
|
end
|
33
27
|
|
34
28
|
class ExtendedComponent < SomeComponent
|
35
|
-
js_property :bbar, [:action_one.action, :action_two.action, :action_three.action, :action_four.action, :action_five.action]
|
36
|
-
js_property :tbar, [:action_one.action, :action_two.action, :action_three.action, :action_four.action, :action_five.action]
|
37
29
|
end
|
38
30
|
|
39
31
|
class AnotherExtendedComponent < ExtendedComponent
|
40
|
-
action :action_one
|
41
|
-
|
32
|
+
action :action_one do |a|
|
33
|
+
a.text = "Action 1"
|
34
|
+
end
|
42
35
|
|
43
|
-
|
44
|
-
|
36
|
+
action :action_five do |a|
|
37
|
+
a.text = "Action Five"
|
45
38
|
end
|
46
39
|
|
47
|
-
action :
|
48
|
-
|
40
|
+
action :action_two do |c|
|
41
|
+
super(c)
|
42
|
+
c.disabled = true
|
43
|
+
c.text = c.text + ", extended"
|
44
|
+
end
|
45
|
+
|
46
|
+
action :action_three do |a|
|
47
|
+
a.text = "Action 3"
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
52
51
|
class YetAnotherExtendedComponent < AnotherExtendedComponent
|
53
|
-
action :action_two
|
52
|
+
action :action_two do |c|
|
53
|
+
super(c)
|
54
|
+
c.disabled = false
|
55
|
+
end
|
54
56
|
end
|
55
57
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
it "should auto collect actions from both js_methods and config" do
|
59
|
+
component = SomeComponent.new
|
60
|
+
component.actions.keys.size.should == 5
|
61
|
+
component.actions[:action_one][:text].should == "Action one"
|
62
|
+
component.actions[:action_two][:text].should == "Action two"
|
63
|
+
component.actions[:action_three][:text].should == "Action three"
|
64
|
+
component.actions[:action_four][:text].should == "Action 4"
|
65
|
+
component.actions[:action_five][:text].should == "Action 5"
|
66
|
+
end
|
65
67
|
|
66
68
|
it "should not override previous actions when reconfiguring bars in child class" do
|
67
69
|
component = ExtendedComponent.new
|
@@ -91,4 +93,4 @@ module Netzke
|
|
91
93
|
end
|
92
94
|
|
93
95
|
end
|
94
|
-
end
|
96
|
+
end
|