netzke-core 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. data/CHANGELOG.md +16 -1
  2. data/Gemfile +12 -0
  3. data/README.md +22 -15
  4. data/Rakefile +19 -38
  5. data/app/controllers/netzke_controller.rb +1 -79
  6. data/javascripts/ext.js +17 -13
  7. data/lib/netzke/base.rb +6 -2
  8. data/lib/netzke/core/action_config.rb +7 -0
  9. data/lib/netzke/core/actions.rb +6 -32
  10. data/lib/netzke/core/client_class.rb +1 -1
  11. data/lib/netzke/core/component_config.rb +1 -1
  12. data/lib/netzke/core/composition.rb +17 -111
  13. data/lib/netzke/core/config_to_dsl_delegator.rb +0 -7
  14. data/lib/netzke/core/configuration.rb +48 -0
  15. data/lib/netzke/core/dsl_support.rb +71 -0
  16. data/lib/netzke/core/dynamic_assets.rb +10 -1
  17. data/lib/netzke/core/embedding.rb +2 -2
  18. data/lib/netzke/core/html.rb +29 -0
  19. data/lib/netzke/core/javascript.rb +32 -26
  20. data/lib/netzke/core/railz/action_view_ext/ext.rb +2 -2
  21. data/lib/netzke/core/railz/controller_extensions.rb +96 -3
  22. data/lib/netzke/core/railz/routes.rb +14 -3
  23. data/lib/netzke/core/ruby_ext/array.rb +4 -18
  24. data/lib/netzke/core/ruby_ext/hash.rb +19 -25
  25. data/lib/netzke/core/ruby_ext/time_with_zone.rb +1 -1
  26. data/lib/netzke/core/ruby_ext.rb +0 -2
  27. data/lib/netzke/core/session.rb +8 -1
  28. data/lib/netzke/core/state.rb +3 -3
  29. data/lib/netzke/core/version.rb +1 -1
  30. data/lib/netzke/core.rb +15 -7
  31. data/lib/netzke-core.rb +2 -9
  32. data/tasks/app_test_tasks.rake +94 -0
  33. data/tasks/rake_helper.rb +51 -0
  34. data/test/core_test_app/README +2 -2
  35. data/test/core_test_app/app/assets/javascripts/expect/expect.js +1253 -0
  36. data/test/core_test_app/app/assets/javascripts/mocha/mocha.js +5340 -0
  37. data/test/core_test_app/app/assets/stylesheets/mocha/mocha.css +231 -0
  38. data/test/core_test_app/app/components/{component_with_actions.rb → actions.rb} +7 -9
  39. data/test/core_test_app/app/components/{some_composite.rb → composition.rb} +16 -5
  40. data/test/core_test_app/app/components/{component_with_custom_css → css_inclusion}/stylesheets/custom.css +2 -2
  41. data/test/core_test_app/app/components/css_inclusion.rb +12 -0
  42. data/test/core_test_app/app/components/{component_loader/javascripts/component_loader.js → dynamic_loading/javascripts/dynamic_loading.js} +9 -1
  43. data/test/core_test_app/app/components/{component_loader.rb → dynamic_loading.rb} +12 -5
  44. data/test/core_test_app/app/components/{server_caller/javascripts/server_caller.js → endpoints/javascripts/endpoints.js} +10 -6
  45. data/test/core_test_app/app/components/{server_caller.rb → endpoints.rb} +12 -8
  46. data/test/core_test_app/app/components/{extended_server_caller.rb → endpoints_extended.rb} +6 -4
  47. data/test/core_test_app/app/components/ext_direct/composite.rb +5 -1
  48. data/test/core_test_app/app/components/feedback.rb +26 -0
  49. data/test/core_test_app/app/components/haml_panel/html/body.html.haml +10 -0
  50. data/test/core_test_app/app/components/haml_panel/html/server_response.html.haml +3 -0
  51. data/test/core_test_app/app/components/haml_panel.rb +32 -0
  52. data/test/core_test_app/app/components/hello_world.rb +1 -0
  53. data/test/core_test_app/app/components/js_inclusion/javascripts/extra_one.js +2 -0
  54. data/test/core_test_app/app/components/js_inclusion/javascripts/extra_two.js +2 -0
  55. data/test/core_test_app/app/components/js_inclusion/javascripts/js_inclusion.js +5 -0
  56. data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_one.js +0 -0
  57. data/test/core_test_app/app/components/{component_with_js_mixin → js_inclusion}/javascripts/method_set_two.js +0 -0
  58. data/test/core_test_app/app/components/{component_with_js_mixin.rb → js_inclusion.rb} +3 -3
  59. data/test/core_test_app/app/components/js_inclusion_extended/javascripts/some_method_set.js +5 -0
  60. data/test/core_test_app/app/components/js_inclusion_extended.rb +6 -0
  61. data/test/core_test_app/app/components/loaded_css_inclusion.rb +22 -0
  62. data/test/core_test_app/app/components/{localized_panel.rb → localization.rb} +5 -5
  63. data/test/core_test_app/app/components/localization_extended.rb +2 -0
  64. data/test/core_test_app/app/components/persistence.rb +60 -0
  65. data/test/core_test_app/app/components/persistence_with_shared_state.rb +7 -0
  66. data/test/core_test_app/app/components/plugin_with_actions.rb +24 -0
  67. data/test/core_test_app/app/components/plugin_with_components.rb +3 -3
  68. data/test/core_test_app/app/components/plugin_with_endpoints.rb +29 -0
  69. data/test/core_test_app/app/components/plugins.rb +9 -0
  70. data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/basic_stuff.rb +1 -1
  71. data/test/core_test_app/app/components/{kinda_complex_component → ruby_modules}/extra_stuff.rb +3 -3
  72. data/test/core_test_app/app/components/{kinda_complex_component.rb → ruby_modules.rb} +1 -1
  73. data/test/core_test_app/app/components/scoped/deeply_scoped/scoping.rb +10 -0
  74. data/test/core_test_app/app/components/scoped/scoping.rb +8 -0
  75. data/test/core_test_app/app/components/scoped/scoping_extended.rb +8 -0
  76. data/test/core_test_app/app/components/self_reloading.rb +25 -0
  77. data/test/core_test_app/app/components/server_counter/javascripts/server_counter.js +4 -4
  78. data/test/core_test_app/app/components/server_counter.rb +10 -10
  79. data/test/core_test_app/app/components/simple_authentication_component.rb +1 -0
  80. data/test/core_test_app/app/components/simple_component.rb +0 -4
  81. data/test/core_test_app/app/components/simple_composite.rb +1 -1
  82. data/test/core_test_app/app/components/simple_form_with_file_upload.rb +1 -2
  83. data/test/core_test_app/app/components/simple_tab_panel.rb +5 -3
  84. data/test/core_test_app/app/components/{panel_with_tools.rb → tools.rb} +3 -3
  85. data/test/core_test_app/app/components/window_with_simple_component.rb +1 -0
  86. data/test/core_test_app/app/controllers/alternative_controller.rb +10 -0
  87. data/test/core_test_app/app/controllers/specs_controller.rb +11 -0
  88. data/test/core_test_app/app/views/layouts/application.html.erb +19 -1
  89. data/test/core_test_app/app/views/simple_rails/multiple_nested.html.erb +2 -2
  90. data/test/core_test_app/config/boot.rb +3 -10
  91. data/test/core_test_app/config/environments/development.rb +1 -0
  92. data/test/core_test_app/config/initializers/netzke.rb +4 -1
  93. data/test/core_test_app/config/locales/en.yml +11 -4
  94. data/test/core_test_app/config/locales/es.yml +1 -4
  95. data/test/core_test_app/config/routes.rb +10 -1
  96. data/test/core_test_app/core_test_app.tmproj +254 -0
  97. data/test/core_test_app/db/development.sqlite3 +0 -0
  98. data/test/core_test_app/{lib/tasks/.gitkeep → db/test.sqlite3} +0 -0
  99. data/test/core_test_app/log/development.log +78046 -0
  100. data/test/core_test_app/log/production.log +18 -0
  101. data/test/core_test_app/log/test.log +120048 -0
  102. data/test/core_test_app/rails_app.tmproj +324 -0
  103. data/test/core_test_app/tmp/cache/assets/C8B/BF0/sprockets%2F54de2792b036d1dab855f88599503551 +0 -0
  104. data/test/core_test_app/tmp/cache/assets/C92/5A0/sprockets%2F39e75754782ee12179bf35c9a0971d80 +0 -0
  105. data/test/core_test_app/tmp/cache/assets/C99/720/sprockets%2F981d5a1b957a012e380b22011a6d176d +0 -0
  106. data/test/core_test_app/tmp/cache/assets/C9F/750/sprockets%2F20ce3d64040a5d3a0a8883bd60754356 +0 -0
  107. data/test/core_test_app/tmp/cache/assets/CC4/C00/sprockets%2Fc615df52887d8c2e67e8413576a419c5 +0 -0
  108. data/test/core_test_app/tmp/cache/assets/CF1/3F0/sprockets%2Fc69ee42924fab565a3533d56473ce878 +0 -0
  109. data/test/core_test_app/tmp/cache/assets/D0E/870/sprockets%2Fa593bf4fac106add88c9434141a49663 +0 -0
  110. data/test/core_test_app/tmp/cache/assets/D14/8E0/sprockets%2F20748e8d1d7d090d122904a9fe6f18fc +0 -0
  111. data/test/core_test_app/tmp/cache/assets/D3E/DA0/sprockets%2Fa175f1ac5996544b908ba3ba3f64c4f3 +0 -0
  112. data/test/core_test_app/tmp/cache/assets/D43/C00/sprockets%2F7bc60c758776356d615ab5edff201ee2 +0 -0
  113. data/test/core_test_app/tmp/cache/assets/D4B/C50/sprockets%2F8483b7e322da338e8f9eb3b30a957e9a +0 -0
  114. data/test/core_test_app/tmp/cache/assets/D64/090/sprockets%2F5a01ff309c3f2503eb5e4f5667cca4b3 +0 -0
  115. data/test/core_test_app/tmp/cache/assets/D8B/FB0/sprockets%2F7a86225caaa389f1be600b4f3a2d1ef0 +0 -0
  116. data/test/core_test_app/tmp/cache/assets/D98/9C0/sprockets%2F18b80e8fe200aebc522e561a867ea6fb +0 -0
  117. data/test/core_test_app/tmp/cache/assets/DB0/6E0/sprockets%2F03e33f5a4779eeb48bcfc86ee717fb55 +0 -0
  118. data/test/core_test_app/tmp/cache/assets/DED/7E0/sprockets%2Feaedd52ba538f19e4ab543a3e20ce2c4 +0 -0
  119. data/test/core_test_app/tmp/cache/assets/E07/FF0/sprockets%2Fb3c071e0a6de36f041adbbdaa8ab060b +0 -0
  120. data/test/core_test_app/tmp/capybara/capybara-20101214105940.html +40 -0
  121. data/test/core_test_app/tmp/capybara/capybara-20101214110642.html +40 -0
  122. data/test/core_test_app/tmp/capybara/capybara-20101214110749.html +40 -0
  123. data/test/core_test_app/tmp/capybara/capybara-20101214110750.html +40 -0
  124. data/test/core_test_app/tmp/capybara/capybara-20101214111025.html +40 -0
  125. data/test/core_test_app/tmp/capybara/capybara-20101214111027.html +40 -0
  126. data/test/core_test_app/tmp/capybara/capybara-20101214111213.html +40 -0
  127. data/test/core_test_app/tmp/capybara/capybara-20101214111214.html +40 -0
  128. data/test/core_test_app/tmp/capybara/capybara-20101214111332.html +40 -0
  129. data/test/core_test_app/tmp/capybara/capybara-20101214111333.html +40 -0
  130. data/test/core_test_app/{spec/component → tmp/pids/passenger.3000.pid.lock} +0 -0
  131. metadata +370 -133
  132. data/.autotest +0 -1
  133. data/.travis.yml +0 -18
  134. data/Manifest +0 -50
  135. data/config/ci/before-travis.sh +0 -10
  136. data/install.rb +0 -1
  137. data/lib/netzke/core/options_hash.rb +0 -27
  138. data/lib/netzke/core/ruby_ext/string.rb +0 -26
  139. data/lib/netzke/core/ruby_ext/symbol.rb +0 -13
  140. data/netzke-core.gemspec +0 -253
  141. data/test/core_test_app/.gitignore +0 -4
  142. data/test/core_test_app/.powrc +0 -4
  143. data/test/core_test_app/.rvmrc +0 -1
  144. data/test/core_test_app/Gemfile +0 -19
  145. data/test/core_test_app/Gemfile.lock +0 -147
  146. data/test/core_test_app/app/components/border_layout_panel.rb +0 -4
  147. data/test/core_test_app/app/components/card_component_loader.rb +0 -25
  148. data/test/core_test_app/app/components/component_with_custom_css.rb +0 -11
  149. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/component_with_js_mixin.js +0 -5
  150. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_one.js +0 -2
  151. data/test/core_test_app/app/components/component_with_js_mixin/javascripts/extra_two.js +0 -2
  152. data/test/core_test_app/app/components/component_with_nested_through.rb +0 -28
  153. data/test/core_test_app/app/components/component_with_required_js.rb +0 -24
  154. data/test/core_test_app/app/components/dsl_delegated_properties.rb +0 -4
  155. data/test/core_test_app/app/components/dsl_delegated_properties_base.rb +0 -5
  156. data/test/core_test_app/app/components/extended_component_with_actions.rb +0 -9
  157. data/test/core_test_app/app/components/extended_component_with_js_mixin/javascripts/some_method_set.js +0 -5
  158. data/test/core_test_app/app/components/extended_component_with_js_mixin.rb +0 -10
  159. data/test/core_test_app/app/components/extended_localized_panel.rb +0 -2
  160. data/test/core_test_app/app/components/included.js +0 -5
  161. data/test/core_test_app/app/components/inline_composite.rb +0 -13
  162. data/test/core_test_app/app/components/loader_of_component_with_custom_css.rb +0 -23
  163. data/test/core_test_app/app/components/multipane_component_loader.rb +0 -41
  164. data/test/core_test_app/app/components/nested_component.rb +0 -17
  165. data/test/core_test_app/app/components/panel_with_plugin.rb +0 -9
  166. data/test/core_test_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +0 -10
  167. data/test/core_test_app/app/components/scoped_components/extended_scoped_component.rb +0 -8
  168. data/test/core_test_app/app/components/scoped_components/some_scoped_component.rb +0 -8
  169. data/test/core_test_app/app/components/some_ext_component.rb +0 -8
  170. data/test/core_test_app/app/components/some_plugin.rb +0 -40
  171. data/test/core_test_app/app/components/stateful_component.rb +0 -46
  172. data/test/core_test_app/app/components/stateful_component_with_shared_state.rb +0 -11
  173. data/test/core_test_app/config/database.yml.travis +0 -11
  174. data/test/core_test_app/db/schema.rb +0 -29
  175. data/test/core_test_app/features/actions_and_tools.feature +0 -22
  176. data/test/core_test_app/features/basic.feature +0 -7
  177. data/test/core_test_app/features/client-server.feature +0 -19
  178. data/test/core_test_app/features/complex_component.feature +0 -18
  179. data/test/core_test_app/features/component.feature +0 -10
  180. data/test/core_test_app/features/component_loader.feature +0 -52
  181. data/test/core_test_app/features/composition.feature +0 -45
  182. data/test/core_test_app/features/config_to_dsl_delegation.feature +0 -10
  183. data/test/core_test_app/features/custom_css.feature +0 -17
  184. data/test/core_test_app/features/ext.direct.feature +0 -32
  185. data/test/core_test_app/features/file_inclusion.feature +0 -10
  186. data/test/core_test_app/features/i18n.feature +0 -35
  187. data/test/core_test_app/features/inheritance.feature +0 -18
  188. data/test/core_test_app/features/js_include.feature +0 -20
  189. data/test/core_test_app/features/nested_views.feature +0 -10
  190. data/test/core_test_app/features/persistence.feature +0 -34
  191. data/test/core_test_app/features/plugin.feature +0 -16
  192. data/test/core_test_app/features/rails_views.feature +0 -16
  193. data/test/core_test_app/features/scopes.feature +0 -14
  194. data/test/core_test_app/features/step_definitions/custom_css_steps.rb +0 -7
  195. data/test/core_test_app/features/step_definitions/generic_steps.rb +0 -64
  196. data/test/core_test_app/features/step_definitions/web_steps.rb +0 -219
  197. data/test/core_test_app/features/support/env.rb +0 -58
  198. data/test/core_test_app/features/support/paths.rb +0 -42
  199. data/test/core_test_app/spec/action_config_spec.rb +0 -15
  200. data/test/core_test_app/spec/actions_spec.rb +0 -96
  201. data/test/core_test_app/spec/base_spec.rb +0 -35
  202. data/test/core_test_app/spec/client_class_spec.rb +0 -17
  203. data/test/core_test_app/spec/composition_spec.rb +0 -118
  204. data/test/core_test_app/spec/core_ext_spec.rb +0 -27
  205. data/test/core_test_app/spec/endpoint_response_spec.rb +0 -17
  206. data/test/core_test_app/spec/javascript_spec.rb +0 -33
  207. data/test/core_test_app/spec/js_class_config_scope.rb +0 -37
  208. data/test/core_test_app/spec/panel_spec.rb +0 -11
  209. data/test/core_test_app/spec/services_spec.rb +0 -16
  210. data/test/core_test_app/spec/spec.opt +0 -2
  211. data/test/core_test_app/spec/spec_helper.rb +0 -27
  212. data/test/core_test_app/spec/state_spec.rb +0 -20
  213. data/test/core_test_app/vendor/plugins/.gitkeep +0 -0
  214. data/test/unit/core_ext_test.rb +0 -8
  215. data/test/unit/netzke_core_test.rb +0 -178
  216. data/uninstall.rb +0 -1
@@ -1,18 +0,0 @@
1
- Feature: Inheritance
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- @javascript
7
- Scenario: Inherited component should successfully call parent methods in Ruby and JavaScript
8
- When I go to the "en" version of the ExtendedServerCaller page
9
- Then I should see "Extended Server Caller"
10
- When I press "Call server extensively"
11
- Then I should see "All quiet here on the server, shiny weather"
12
- And I should see "Added by extended Server Caller"
13
-
14
- @javascript
15
- Scenario: Extended scoped components should render
16
- Given I am on the ScopedComponents::ExtendedScopedComponent test page
17
- Then I should see "Extended Scoped Component Title"
18
- And I should see "Extended Scoped Component HTML"
@@ -1,20 +0,0 @@
1
- Feature: JsMixins
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- @javascript
7
- Scenario: ComponentWithJsMixin should behave
8
- Given I am on the ComponentWithJsMixin test page
9
- When I press "Action one"
10
- Then I should see "Action One triggered!"
11
- When I press "Action two"
12
- Then I should see "Action Two triggered!"
13
- When I press "Action three"
14
- Then I should see "Action Three triggered!"
15
-
16
- @javascript
17
- Scenario: ExtendedComponentWithJsMixin should behave, too
18
- Given I am on the ExtendedComponentWithJsMixin test page
19
- When I press "Action three"
20
- Then I should see "Modified action Three triggered!"
@@ -1,10 +0,0 @@
1
- Feature: Nested views
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- # @javascript
7
- # WIP: This scenario may never be needed
8
- # Scenario: A component with auto loaded content should render properly
9
- # When I go to the "panel with autoload" view
10
- # Then I should see "Autoloaded Panel"
@@ -1,34 +0,0 @@
1
- Feature: Persistence
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- @javascript
7
- Scenario: The component with persistence should be able to store and retrieve a persistence setting
8
- When I go to the StatefulComponent test page
9
- Then I should see "Default Title"
10
- And I should see "Default HTML"
11
- But I should not see "Title From State"
12
- And I should not see "HTML from session"
13
-
14
- When I press "Set session and state"
15
- And I wait for response from server
16
- And I go to the StatefulComponent test page
17
- Then I should see "Title From State"
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"
@@ -1,16 +0,0 @@
1
- Feature: Plugin
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- @javascript
7
- Scenario: Plugin calling its server part
8
- Given I am on the PanelWithPlugin test page
9
- When I press tool "gear"
10
- Then I should see "Server response"
11
-
12
- @javascript
13
- Scenario: Plugin inserting its action into component
14
- Given I am on the PanelWithPlugin test page
15
- When I press "Action one"
16
- Then I should see "Action one triggered"
@@ -1,16 +0,0 @@
1
- Feature: Rendering components in the Rails views
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- @javascript
7
- Scenario: Rendering multiple complex components in a view
8
- Given I am on the "multiple_nested" view
9
-
10
- When I press "Call server"
11
- And I wait for response from server
12
- Then I should see "All quiet here on the server"
13
-
14
- When I press "Call server extensively"
15
- And I wait for response from server
16
- Then I should see "All quiet here on the server, shiny weather"
@@ -1,14 +0,0 @@
1
- Feature: Scopes
2
- In order to value
3
- As a role
4
- I want feature
5
-
6
- @javascript
7
- Scenario: Scoped components should render
8
- Given I am on the ScopedComponents::SomeScopedComponent test page
9
- Then I should see "Some Scoped Component Title"
10
- And I should see "Some Scoped Component HTML"
11
-
12
- When I go to the ScopedComponents::DeepScopedComponents::SomeDeepScopedComponent test page
13
- Then I should see "Some Deep Scoped Component Title"
14
- And I should see "Some Deep Scoped Component HTML"
@@ -1,7 +0,0 @@
1
- Then /^the body of (.+) component should not be invisible$/ do |component|
2
- component_id = component.split("/").map{ |klass| klass.underscore }.join("__")
3
- page.wait_until{ page.evaluate_script("!Ext.Ajax.isLoading()") }
4
- page.execute_script(<<-JS).should == false
5
- return Ext.getCmp('#{component_id}').body.isVisible();
6
- JS
7
- end
@@ -1,64 +0,0 @@
1
- Then /^Netzke should be initialized$/ do
2
- Netzke::Base.should be
3
- end
4
-
5
- When /^I execute "([^\"]*)"$/ do |script|
6
- page.driver.browser.execute_script(script)
7
- end
8
-
9
- Then /^button "([^"]*)" should be enabled$/ do |arg1|
10
- page.driver.browser.execute_script(<<-JS).should == true
11
- var btn = Array.filter( Ext.ComponentManager.all.getValues(), function(o){ return o.text == '#{arg1}' })[0];
12
- return typeof(btn)!='undefined' ? !btn.disabled : false
13
- JS
14
- end
15
-
16
- Then /^button "([^"]*)" should be disabled$/ do |arg1|
17
- page.driver.browser.execute_script(<<-JS).should == true
18
- var btn = Array.filter( Ext.ComponentManager.all.getValues(), function(o){ return o.text == '#{arg1}' })[0];
19
- return typeof(btn)!='undefined' ? btn.disabled : false
20
- JS
21
- end
22
-
23
- When /^total requests made should be (\d+)$/ do |count|
24
- page.driver.browser.execute_script(<<-JS).should == true
25
- return Netzke.connectionCount == #{count};
26
- JS
27
- end
28
-
29
- When /^I press tool "([^"]*)"$/ do |tool|
30
- id = page.driver.browser.execute_script(<<-JS)
31
- var toolCmp;
32
- Ext.ComponentManager.all.each(function(k,v){
33
- if (v.type == '#{tool}') {
34
- toolCmp = v;
35
- return false;
36
- }
37
- });
38
- return toolCmp.getId();
39
- JS
40
-
41
- find("##{id} img").click
42
- end
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
-
58
- When /^I wait for response from server$/ do
59
- page.wait_until{ page.driver.browser.execute_script("return !Netzke.ajaxIsLoading()") }
60
- end
61
-
62
- When /I sleep (\d+) seconds?/ do |arg1|
63
- sleep arg1.to_i
64
- end
@@ -1,219 +0,0 @@
1
- # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
- # It is recommended to regenerate this file in the future when you upgrade to a
3
- # newer version of cucumber-rails. Consider adding your own code to a new file
4
- # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
- # files.
6
-
7
-
8
- require 'uri'
9
- require 'cgi'
10
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
11
-
12
- module WithinHelpers
13
- def with_scope(locator)
14
- locator ? within(locator) { yield } : yield
15
- end
16
- end
17
- World(WithinHelpers)
18
-
19
- Given /^(?:|I )am on (.+)$/ do |page_name|
20
- visit path_to(page_name)
21
- end
22
-
23
- When /^(?:|I )go to (.+)$/ do |page_name|
24
- visit path_to(page_name)
25
- end
26
-
27
- When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
28
- with_scope(selector) do
29
- click_button(button)
30
- end
31
- end
32
-
33
- When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
34
- with_scope(selector) do
35
- click_link(link)
36
- end
37
- end
38
-
39
- When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
40
- with_scope(selector) do
41
- fill_in(field, :with => value)
42
- end
43
- end
44
-
45
- When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
46
- with_scope(selector) do
47
- fill_in(field, :with => value)
48
- end
49
- end
50
-
51
- # Use this to fill in an entire form with data from a table. Example:
52
- #
53
- # When I fill in the following:
54
- # | Account Number | 5002 |
55
- # | Expiry date | 2009-11-01 |
56
- # | Note | Nice guy |
57
- # | Wants Email? | |
58
- #
59
- # TODO: Add support for checkbox, select og option
60
- # based on naming conventions.
61
- #
62
- When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
63
- with_scope(selector) do
64
- fields.rows_hash.each do |name, value|
65
- When %{I fill in "#{name}" with "#{value}"}
66
- end
67
- end
68
- end
69
-
70
- When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
71
- with_scope(selector) do
72
- select(value, :from => field)
73
- end
74
- end
75
-
76
- When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
77
- with_scope(selector) do
78
- check(field)
79
- end
80
- end
81
-
82
- When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
83
- with_scope(selector) do
84
- uncheck(field)
85
- end
86
- end
87
-
88
- When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
89
- with_scope(selector) do
90
- choose(field)
91
- end
92
- end
93
-
94
- When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
95
- with_scope(selector) do
96
- attach_file(field, path)
97
- end
98
- end
99
-
100
- Then /^(?:|I )should see JSON:$/ do |expected_json|
101
- require 'json'
102
- expected = JSON.pretty_generate(JSON.parse(expected_json))
103
- actual = JSON.pretty_generate(JSON.parse(response.body))
104
- expected.should == actual
105
- end
106
-
107
- Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
108
- with_scope(selector) do
109
- if page.respond_to? :should
110
- page.should have_content(text)
111
- else
112
- assert page.has_content?(text)
113
- end
114
- end
115
- end
116
-
117
- Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
118
- regexp = Regexp.new(regexp)
119
- with_scope(selector) do
120
- if page.respond_to? :should
121
- page.should have_xpath('//*', :text => regexp)
122
- else
123
- assert page.has_xpath?('//*', :text => regexp)
124
- end
125
- end
126
- end
127
-
128
- Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
129
- with_scope(selector) do
130
- if page.respond_to? :should
131
- page.should have_no_content(text)
132
- else
133
- assert page.has_no_content?(text)
134
- end
135
- end
136
- end
137
-
138
- Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
139
- regexp = Regexp.new(regexp)
140
- with_scope(selector) do
141
- if page.respond_to? :should
142
- page.should have_no_xpath('//*', :text => regexp)
143
- else
144
- assert page.has_no_xpath?('//*', :text => regexp)
145
- end
146
- end
147
- end
148
-
149
- Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
150
- with_scope(selector) do
151
- field = find_field(field)
152
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
153
- if field_value.respond_to? :should
154
- field_value.should =~ /#{value}/
155
- else
156
- assert_match(/#{value}/, field_value)
157
- end
158
- end
159
- end
160
-
161
- Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
162
- with_scope(selector) do
163
- field = find_field(field)
164
- field_value = (field.tag_name == 'textarea') ? field.text : field.value
165
- if field_value.respond_to? :should_not
166
- field_value.should_not =~ /#{value}/
167
- else
168
- assert_no_match(/#{value}/, field_value)
169
- end
170
- end
171
- end
172
-
173
- Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
174
- with_scope(selector) do
175
- field_checked = find_field(label)['checked']
176
- if field_checked.respond_to? :should
177
- field_checked.should be_true
178
- else
179
- assert field_checked
180
- end
181
- end
182
- end
183
-
184
- Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
185
- with_scope(selector) do
186
- field_checked = find_field(label)['checked']
187
- if field_checked.respond_to? :should
188
- field_checked.should be_false
189
- else
190
- assert !field_checked
191
- end
192
- end
193
- end
194
-
195
- Then /^(?:|I )should be on (.+)$/ do |page_name|
196
- current_path = URI.parse(current_url).path
197
- if current_path.respond_to? :should
198
- current_path.should == path_to(page_name)
199
- else
200
- assert_equal path_to(page_name), current_path
201
- end
202
- end
203
-
204
- Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
205
- query = URI.parse(current_url).query
206
- actual_params = query ? CGI.parse(query) : {}
207
- expected_params = {}
208
- expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
209
-
210
- if actual_params.respond_to? :should
211
- actual_params.should == expected_params
212
- else
213
- assert_equal expected_params, actual_params
214
- end
215
- end
216
-
217
- Then /^show me the page$/ do
218
- save_and_open_page
219
- end
@@ -1,58 +0,0 @@
1
- # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
- # It is recommended to regenerate this file in the future when you upgrade to a
3
- # newer version of cucumber-rails. Consider adding your own code to a new file
4
- # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
- # files.
6
-
7
- ENV["RAILS_ENV"] ||= "test"
8
-
9
- require 'cucumber/rails'
10
-
11
- require 'capybara/rails'
12
- require 'capybara/cucumber'
13
- require 'capybara/session'
14
- # require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
15
-
16
- # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
17
- # order to ease the transition to Capybara we set the default here. If you'd
18
- # prefer to use XPath just remove this line and adjust any selectors in your
19
- # steps to use the XPath syntax.
20
- Capybara.default_selector = :css
21
-
22
- # Capybara.register_driver :selenium do |app|
23
- # Capybara::Driver::Selenium.new(app, {:browser => :chrome } )
24
- # end
25
-
26
- # If you set this to false, any error raised from within your app will bubble
27
- # up to your step definition and out to cucumber unless you catch it somewhere
28
- # on the way. You can make Rails rescue errors and render error pages on a
29
- # per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
30
- #
31
- # If you set this to true, Rails will rescue all errors and render error
32
- # pages, more or less in the same way your application would behave in the
33
- # default production environment. It's not recommended to do this for all
34
- # of your scenarios, as this makes it hard to discover errors in your application.
35
- ActionController::Base.allow_rescue = false
36
-
37
- # If you set this to true, each scenario will run in a database transaction.
38
- # You can still turn off transactions on a per-scenario basis, simply tagging
39
- # a feature or scenario with the @no-txn tag. If you are using Capybara,
40
- # tagging with @culerity or @javascript will also turn transactions off.
41
- #
42
- # If you set this to false, transactions will be off for all scenarios,
43
- # regardless of whether you use @no-txn or not.
44
- #
45
- # Beware that turning transactions off will leave data in your database
46
- # after each scenario, which can lead to hard-to-debug failures in
47
- # subsequent scenarios. If you do this, we recommend you create a Before
48
- # block that will explicitly put your database in a known state.
49
- Cucumber::Rails::World.use_transactional_fixtures = true
50
- # How to clean your database when transactions are turned off. See
51
- # http://github.com/bmabey/database_cleaner for more info.
52
- if defined?(ActiveRecord::Base)
53
- begin
54
- require 'database_cleaner'
55
- DatabaseCleaner.strategy = :truncation
56
- rescue LoadError => ignore_if_database_cleaner_not_present
57
- end
58
- end
@@ -1,42 +0,0 @@
1
- module NavigationHelpers
2
- # Maps a name to a path. Used by the
3
- #
4
- # When /^I go to (.+)$/ do |page_name|
5
- #
6
- # step definition in web_steps.rb
7
- #
8
- def path_to(page_name)
9
- case page_name
10
-
11
- when /the home\s?page/
12
- '/'
13
-
14
- # Add more mappings here.
15
- # Here is an example that pulls values out of the Regexp:
16
- #
17
- # when /^(.*)'s profile page$/i
18
- # user_profile_path(User.find_by_login($1))
19
-
20
- when /the "(.*)" view/
21
- simple_rails_views_path(:action => $1.gsub(" ", "_"))
22
-
23
- when /the (.*) test page/
24
- components_path(:component => $1)
25
-
26
- when /the "(.+)" version of the (.*) page/
27
- components_path(:component => $2, :locale => $1)
28
-
29
- else
30
- begin
31
- page_name =~ /the (.*) page/
32
- path_components = $1.split(/\s+/)
33
- self.send(path_components.push('path').join('_').to_sym)
34
- rescue Object => e
35
- raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
36
- "Now, go and add a mapping in #{__FILE__}"
37
- end
38
- end
39
- end
40
- end
41
-
42
- World(NavigationHelpers)
@@ -1,15 +0,0 @@
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,96 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Netzke::Core
4
- describe Actions do
5
- class SomeComponent < Netzke::Base
6
- action :action_one
7
- action :action_two
8
- action :action_three do |a|
9
- a.text = "Action three"
10
- end
11
-
12
- def configure(c)
13
- super
14
- c.tbar = [:action_one, :action_two, :action_three]
15
- end
16
-
17
- def actions
18
- super.deep_merge({
19
- :action_four => {:text => "Action 4"}
20
- })
21
- end
22
-
23
- action :action_five do |a|
24
- a.text = "Action 5"
25
- end
26
- end
27
-
28
- class ExtendedComponent < SomeComponent
29
- end
30
-
31
- class AnotherExtendedComponent < ExtendedComponent
32
- action :action_one do |a|
33
- a.text = "Action 1"
34
- end
35
-
36
- action :action_five do |a|
37
- a.text = "Action Five"
38
- end
39
-
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"
48
- end
49
- end
50
-
51
- class YetAnotherExtendedComponent < AnotherExtendedComponent
52
- action :action_two do |c|
53
- super(c)
54
- c.disabled = false
55
- end
56
- end
57
-
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
67
-
68
- it "should not override previous actions when reconfiguring bars in child class" do
69
- component = ExtendedComponent.new
70
- # component.actions.keys.size.should == 5
71
- component.actions[:action_one][:text].should == "Action one"
72
- component.actions[:action_two][:text].should == "Action two"
73
- component.actions[:action_three][:text].should == "Action three"
74
- component.actions[:action_four][:text].should == "Action 4"
75
- component.actions[:action_five][:text].should == "Action 5"
76
- end
77
-
78
- it "should be possible to override actions in child class" do
79
- component = AnotherExtendedComponent.new
80
- component.actions[:action_one][:text].should == "Action 1"
81
- component.actions[:action_five][:text].should == "Action Five"
82
-
83
- component.actions[:action_two][:text].should == "Action two, extended"
84
- component.actions[:action_two][:disabled].should == true
85
-
86
- component.actions[:action_three][:text].should == "Action 3"
87
- end
88
-
89
- it "should only override the specified actions" do
90
- component = YetAnotherExtendedComponent.new
91
- component.actions[:action_two][:disabled].should == false
92
- component.actions[:action_two][:text].should == "Action two, extended"
93
- end
94
-
95
- end
96
- end
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class Parent < Netzke::Base
4
- class_attribute :with_feature
5
- self.with_feature = "yes"
6
- end
7
-
8
- class Child < Parent; end
9
-
10
- module Netzke
11
- module MyComponents
12
- class CoolComponent < Netzke::Base
13
- end
14
- end
15
- end
16
-
17
- describe Netzke::Base do
18
- it "should preserve class config within class hierarchy" do
19
- Parent.with_feature.should == "yes"
20
- Child.with_feature.should == "yes"
21
-
22
- Child.with_feature = "no"
23
-
24
- Parent.with_feature.should == "yes"
25
- Child.with_feature.should == "no"
26
-
27
- Parent.with_feature = "maybe"
28
- Parent.with_feature.should == "maybe"
29
- Child.with_feature.should == "no"
30
- end
31
-
32
- it "should return correct i18n_id" do
33
- Netzke::MyComponents::CoolComponent.i18n_id.should == "netzke.my_components.cool_component"
34
- end
35
- end