netzke-basepack-zh 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. data/.autotest +1 -0
  2. data/.travis.yml +11 -0
  3. data/CHANGELOG.rdoc +445 -0
  4. data/LICENSE +1 -0
  5. data/README.md +94 -0
  6. data/Rakefile +44 -0
  7. data/TODO.rdoc +8 -0
  8. data/config/ci/before-travis.sh +28 -0
  9. data/init.rb +1 -0
  10. data/install.rb +1 -0
  11. data/javascripts/basepack.js +139 -0
  12. data/javascripts/xdatetime.js +196 -0
  13. data/lib/generators/netzke/basepack_generator.rb +10 -0
  14. data/lib/generators/netzke/templates/assets/ts-checkbox.gif +0 -0
  15. data/lib/generators/netzke/templates/create_netzke_field_lists.rb +18 -0
  16. data/lib/netzke-basepack.rb +26 -0
  17. data/lib/netzke/active_record.rb +20 -0
  18. data/lib/netzke/active_record/attributes.rb +256 -0
  19. data/lib/netzke/active_record/combobox_options.rb +16 -0
  20. data/lib/netzke/active_record/relation_extensions.rb +37 -0
  21. data/lib/netzke/basepack.rb +45 -0
  22. data/lib/netzke/basepack/accordion_panel.rb +39 -0
  23. data/lib/netzke/basepack/action_column.rb +68 -0
  24. data/lib/netzke/basepack/action_column/javascripts/action_column.js +61 -0
  25. data/lib/netzke/basepack/auth_app.rb +159 -0
  26. data/lib/netzke/basepack/basic_app.rb +7 -0
  27. data/lib/netzke/basepack/border_layout_panel.rb +53 -0
  28. data/lib/netzke/basepack/border_layout_panel/javascripts/border_layout_panel.js +40 -0
  29. data/lib/netzke/basepack/data_accessor.rb +53 -0
  30. data/lib/netzke/basepack/data_adapters/abstract_adapter.rb +164 -0
  31. data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +279 -0
  32. data/lib/netzke/basepack/data_adapters/data_mapper_adapter.rb +264 -0
  33. data/lib/netzke/basepack/data_adapters/sequel_adapter.rb +260 -0
  34. data/lib/netzke/basepack/form_panel.rb +144 -0
  35. data/lib/netzke/basepack/form_panel/fields.rb +208 -0
  36. data/lib/netzke/basepack/form_panel/javascripts/comma_list_cbg.js +51 -0
  37. data/lib/netzke/basepack/form_panel/javascripts/form_panel.js +225 -0
  38. data/lib/netzke/basepack/form_panel/javascripts/misc.js +4 -0
  39. data/lib/netzke/basepack/form_panel/javascripts/n_radio_group.js +43 -0
  40. data/lib/netzke/basepack/form_panel/javascripts/readonly_mode.js +35 -0
  41. data/lib/netzke/basepack/form_panel/services.rb +142 -0
  42. data/lib/netzke/basepack/form_panel/stylesheets/readonly_mode.css +14 -0
  43. data/lib/netzke/basepack/grid_panel.rb +440 -0
  44. data/lib/netzke/basepack/grid_panel/columns.rb +394 -0
  45. data/lib/netzke/basepack/grid_panel/javascripts/advanced_search.js +27 -0
  46. data/lib/netzke/basepack/grid_panel/javascripts/check_column_fix.js +6 -0
  47. data/lib/netzke/basepack/grid_panel/javascripts/edit_in_form.js +51 -0
  48. data/lib/netzke/basepack/grid_panel/javascripts/event_handling.js +179 -0
  49. data/lib/netzke/basepack/grid_panel/javascripts/grid_panel.js +438 -0
  50. data/lib/netzke/basepack/grid_panel/javascripts/misc.js +4 -0
  51. data/lib/netzke/basepack/grid_panel/javascripts/rows-dd.js +281 -0
  52. data/lib/netzke/basepack/grid_panel/record_form_window.rb +41 -0
  53. data/lib/netzke/basepack/grid_panel/services.rb +235 -0
  54. data/lib/netzke/basepack/paging_form_panel.rb +72 -0
  55. data/lib/netzke/basepack/paging_form_panel/javascripts/paging_form_panel.js +76 -0
  56. data/lib/netzke/basepack/panel.rb +11 -0
  57. data/lib/netzke/basepack/query_builder.rb +107 -0
  58. data/lib/netzke/basepack/query_builder/javascripts/query_builder.js +153 -0
  59. data/lib/netzke/basepack/search_panel.rb +79 -0
  60. data/lib/netzke/basepack/search_panel/javascripts/condition_field.js +160 -0
  61. data/lib/netzke/basepack/search_panel/javascripts/search_panel.js +65 -0
  62. data/lib/netzke/basepack/search_window.rb +66 -0
  63. data/lib/netzke/basepack/simple_app.rb +104 -0
  64. data/lib/netzke/basepack/simple_app/javascripts/simple_app.js +64 -0
  65. data/lib/netzke/basepack/simple_app/javascripts/statusbar_ext.js +8 -0
  66. data/lib/netzke/basepack/tab_panel.rb +21 -0
  67. data/lib/netzke/basepack/tab_panel/javascripts/tab_panel.js +11 -0
  68. data/lib/netzke/basepack/version.rb +11 -0
  69. data/lib/netzke/basepack/window.rb +29 -0
  70. data/lib/netzke/basepack/window/javascripts/window.js +20 -0
  71. data/lib/netzke/basepack/wrap_lazy_loaded.rb +28 -0
  72. data/lib/netzke/basepack/wrapper.rb +28 -0
  73. data/lib/netzke/data_mapper.rb +18 -0
  74. data/lib/netzke/data_mapper/attributes.rb +273 -0
  75. data/lib/netzke/data_mapper/combobox_options.rb +11 -0
  76. data/lib/netzke/data_mapper/relation_extensions.rb +38 -0
  77. data/lib/netzke/sequel.rb +18 -0
  78. data/lib/netzke/sequel/attributes.rb +274 -0
  79. data/lib/netzke/sequel/combobox_options.rb +10 -0
  80. data/lib/netzke/sequel/relation_extensions.rb +40 -0
  81. data/lib/tasks/netzke_basepack_tasks.rake +4 -0
  82. data/locales/de.yml +79 -0
  83. data/locales/en.yml +79 -0
  84. data/netzke-basepack.gemspec +306 -0
  85. data/stylesheets/basepack.css +72 -0
  86. data/stylesheets/datetimefield.css +54 -0
  87. data/test/basepack_test_app/.gitignore +6 -0
  88. data/test/basepack_test_app/.rvmrc +1 -0
  89. data/test/basepack_test_app/Gemfile +59 -0
  90. data/test/basepack_test_app/Gemfile.lock +196 -0
  91. data/test/basepack_test_app/Guardfile +46 -0
  92. data/test/basepack_test_app/README +1 -0
  93. data/test/basepack_test_app/Rakefile +7 -0
  94. data/test/basepack_test_app/app/components/author_form.rb +32 -0
  95. data/test/basepack_test_app/app/components/author_grid.rb +3 -0
  96. data/test/basepack_test_app/app/components/book_form.rb +38 -0
  97. data/test/basepack_test_app/app/components/book_form_with_custom_fields.rb +21 -0
  98. data/test/basepack_test_app/app/components/book_form_with_defaults.rb +8 -0
  99. data/test/basepack_test_app/app/components/book_form_with_nested_attributes.rb +18 -0
  100. data/test/basepack_test_app/app/components/book_grid.rb +12 -0
  101. data/test/basepack_test_app/app/components/book_grid_filtering.rb +10 -0
  102. data/test/basepack_test_app/app/components/book_grid_loader.rb +24 -0
  103. data/test/basepack_test_app/app/components/book_grid_with_column_actions.rb +15 -0
  104. data/test/basepack_test_app/app/components/book_grid_with_custom_columns.rb +27 -0
  105. data/test/basepack_test_app/app/components/book_grid_with_default_values.rb +9 -0
  106. data/test/basepack_test_app/app/components/book_grid_with_extra_feedback.rb +8 -0
  107. data/test/basepack_test_app/app/components/book_grid_with_extra_filters.rb +14 -0
  108. data/test/basepack_test_app/app/components/book_grid_with_nested_attributes.rb +13 -0
  109. data/test/basepack_test_app/app/components/book_grid_with_overridden_columns.rb +15 -0
  110. data/test/basepack_test_app/app/components/book_grid_with_paging.rb +10 -0
  111. data/test/basepack_test_app/app/components/book_grid_with_persistence.rb +8 -0
  112. data/test/basepack_test_app/app/components/book_grid_with_scoped_authors.rb +8 -0
  113. data/test/basepack_test_app/app/components/book_grid_with_virtual_attributes.rb +21 -0
  114. data/test/basepack_test_app/app/components/book_paging_form_panel.rb +22 -0
  115. data/test/basepack_test_app/app/components/book_query_builder.rb +8 -0
  116. data/test/basepack_test_app/app/components/book_search_panel.rb +5 -0
  117. data/test/basepack_test_app/app/components/book_search_panel/javascripts/i18n_de.js +6 -0
  118. data/test/basepack_test_app/app/components/book_with_custom_primary_key_grid.rb +10 -0
  119. data/test/basepack_test_app/app/components/books_bound_to_author.rb +10 -0
  120. data/test/basepack_test_app/app/components/double_book_grid.rb +18 -0
  121. data/test/basepack_test_app/app/components/extras/book_presentation.rb +27 -0
  122. data/test/basepack_test_app/app/components/form_without_model.rb +21 -0
  123. data/test/basepack_test_app/app/components/generic_user_form.rb +12 -0
  124. data/test/basepack_test_app/app/components/lockable_book_form.rb +17 -0
  125. data/test/basepack_test_app/app/components/lockable_user_form.rb +7 -0
  126. data/test/basepack_test_app/app/components/paging_form_with_search.rb +40 -0
  127. data/test/basepack_test_app/app/components/simple_accordion.rb +11 -0
  128. data/test/basepack_test_app/app/components/simple_panel.rb +17 -0
  129. data/test/basepack_test_app/app/components/simple_tab_panel.rb +11 -0
  130. data/test/basepack_test_app/app/components/simple_window.rb +10 -0
  131. data/test/basepack_test_app/app/components/simple_wrapper.rb +7 -0
  132. data/test/basepack_test_app/app/components/some_accordion_panel.rb +22 -0
  133. data/test/basepack_test_app/app/components/some_auth_app.rb +32 -0
  134. data/test/basepack_test_app/app/components/some_border_layout.rb +28 -0
  135. data/test/basepack_test_app/app/components/some_simple_app.rb +35 -0
  136. data/test/basepack_test_app/app/components/some_tab_panel.rb +20 -0
  137. data/test/basepack_test_app/app/components/user_form.rb +25 -0
  138. data/test/basepack_test_app/app/components/user_form_with_default_fields.rb +8 -0
  139. data/test/basepack_test_app/app/components/user_grid.rb +8 -0
  140. data/test/basepack_test_app/app/components/user_grid_with_customized_form_fields.rb +18 -0
  141. data/test/basepack_test_app/app/components/window_component_loader.rb +27 -0
  142. data/test/basepack_test_app/app/controllers/application_controller.rb +9 -0
  143. data/test/basepack_test_app/app/controllers/components_controller.rb +10 -0
  144. data/test/basepack_test_app/app/controllers/welcome_controller.rb +9 -0
  145. data/test/basepack_test_app/app/helpers/application_helper.rb +8 -0
  146. data/test/basepack_test_app/app/helpers/embedded_components_helper.rb +2 -0
  147. data/test/basepack_test_app/app/models/address.rb +29 -0
  148. data/test/basepack_test_app/app/models/author.rb +38 -0
  149. data/test/basepack_test_app/app/models/book.rb +49 -0
  150. data/test/basepack_test_app/app/models/book_with_custom_primary_key.rb +26 -0
  151. data/test/basepack_test_app/app/models/role.rb +24 -0
  152. data/test/basepack_test_app/app/models/user.rb +29 -0
  153. data/test/basepack_test_app/app/presenters/forms/generic_user.rb +6 -0
  154. data/test/basepack_test_app/app/views/components/loadable_window.html.erb +9 -0
  155. data/test/basepack_test_app/app/views/components/simple_panel.html.erb +1 -0
  156. data/test/basepack_test_app/app/views/layouts/application.html.erb +12 -0
  157. data/test/basepack_test_app/app/views/layouts/components.html.erb +13 -0
  158. data/test/basepack_test_app/app/views/layouts/nested.html.erb +5 -0
  159. data/test/basepack_test_app/app/views/welcome/index.html.erb +10 -0
  160. data/test/basepack_test_app/config.ru +4 -0
  161. data/test/basepack_test_app/config/application.rb +57 -0
  162. data/test/basepack_test_app/config/boot.rb +13 -0
  163. data/test/basepack_test_app/config/cucumber.yml +8 -0
  164. data/test/basepack_test_app/config/database.yml.sample +41 -0
  165. data/test/basepack_test_app/config/database.yml.travis +15 -0
  166. data/test/basepack_test_app/config/environment.rb +6 -0
  167. data/test/basepack_test_app/config/environments/development.rb +22 -0
  168. data/test/basepack_test_app/config/environments/production.rb +49 -0
  169. data/test/basepack_test_app/config/environments/test.rb +35 -0
  170. data/test/basepack_test_app/config/initializers/backtrace_silencers.rb +7 -0
  171. data/test/basepack_test_app/config/initializers/data_mapper_logging.rb +3 -0
  172. data/test/basepack_test_app/config/initializers/inflections.rb +10 -0
  173. data/test/basepack_test_app/config/initializers/mime_types.rb +5 -0
  174. data/test/basepack_test_app/config/initializers/netzke.rb +9 -0
  175. data/test/basepack_test_app/config/initializers/secret_token.rb +7 -0
  176. data/test/basepack_test_app/config/initializers/sequel.rb +26 -0
  177. data/test/basepack_test_app/config/initializers/session_store.rb +8 -0
  178. data/test/basepack_test_app/config/locales/de.yml +35 -0
  179. data/test/basepack_test_app/config/locales/es.yml +96 -0
  180. data/test/basepack_test_app/config/routes.rb +68 -0
  181. data/test/basepack_test_app/db/development_structure.sql +88 -0
  182. data/test/basepack_test_app/db/migrate/20100914104207_create_users.rb +15 -0
  183. data/test/basepack_test_app/db/migrate/20100914104236_create_roles.rb +13 -0
  184. data/test/basepack_test_app/db/migrate/20101026185816_create_authors.rb +14 -0
  185. data/test/basepack_test_app/db/migrate/20101026190021_create_books.rb +19 -0
  186. data/test/basepack_test_app/db/migrate/20110101143818_create_addresses.rb +17 -0
  187. data/test/basepack_test_app/db/migrate/20110213213050_create_netzke_component_states.rb +20 -0
  188. data/test/basepack_test_app/db/migrate/20110701070052_create_book_with_custom_primary_keys.rb +15 -0
  189. data/test/basepack_test_app/db/migrate/20110901114016_add_last_read_at_to_books.rb +9 -0
  190. data/test/basepack_test_app/db/migrate/20110909071740_add_published_on_to_books.rb +5 -0
  191. data/test/basepack_test_app/db/schema.rb +81 -0
  192. data/test/basepack_test_app/db/seeds.rb +44 -0
  193. data/test/basepack_test_app/features/accordion_panel.feature +12 -0
  194. data/test/basepack_test_app/features/components_in_view.feature +11 -0
  195. data/test/basepack_test_app/features/form_panel.feature +142 -0
  196. data/test/basepack_test_app/features/grid_panel.feature +277 -0
  197. data/test/basepack_test_app/features/grid_panel_filters.feature +73 -0
  198. data/test/basepack_test_app/features/grid_panel_with_custom_primary_key.feature +15 -0
  199. data/test/basepack_test_app/features/grid_sorting.feature +47 -0
  200. data/test/basepack_test_app/features/i18n.feature +18 -0
  201. data/test/basepack_test_app/features/nested_attributes.feature +26 -0
  202. data/test/basepack_test_app/features/paging_form_panel.feature +43 -0
  203. data/test/basepack_test_app/features/search_in_grid.feature +49 -0
  204. data/test/basepack_test_app/features/simple_app.feature +15 -0
  205. data/test/basepack_test_app/features/simple_panel.feature +11 -0
  206. data/test/basepack_test_app/features/step_definitions/accordion_steps.rb +5 -0
  207. data/test/basepack_test_app/features/step_definitions/ext_steps.rb +16 -0
  208. data/test/basepack_test_app/features/step_definitions/form_panel_steps.rb +46 -0
  209. data/test/basepack_test_app/features/step_definitions/generic_steps.rb +44 -0
  210. data/test/basepack_test_app/features/step_definitions/grid_panel_steps.rb +186 -0
  211. data/test/basepack_test_app/features/step_definitions/pickle_steps.rb +100 -0
  212. data/test/basepack_test_app/features/step_definitions/web_steps.rb +219 -0
  213. data/test/basepack_test_app/features/support/env.rb +81 -0
  214. data/test/basepack_test_app/features/support/paths.rb +65 -0
  215. data/test/basepack_test_app/features/support/pickle.rb +24 -0
  216. data/test/basepack_test_app/features/support/selectors.rb +39 -0
  217. data/test/basepack_test_app/features/tab_panel.feature +12 -0
  218. data/test/basepack_test_app/features/validations_in_grid.feature +13 -0
  219. data/test/basepack_test_app/features/virtual_attributes.feature +16 -0
  220. data/test/basepack_test_app/features/window.feature +11 -0
  221. data/test/basepack_test_app/lib/tasks/.gitkeep +0 -0
  222. data/test/basepack_test_app/lib/tasks/cucumber.rake +71 -0
  223. data/test/basepack_test_app/lib/tasks/travis.rake +7 -0
  224. data/test/basepack_test_app/public/404.html +26 -0
  225. data/test/basepack_test_app/public/422.html +26 -0
  226. data/test/basepack_test_app/public/500.html +26 -0
  227. data/test/basepack_test_app/public/favicon.ico +0 -0
  228. data/test/basepack_test_app/public/images/header-deco.gif +0 -0
  229. data/test/basepack_test_app/public/images/rails.png +0 -0
  230. data/test/basepack_test_app/public/javascripts/application.js +2 -0
  231. data/test/basepack_test_app/public/javascripts/controls.js +965 -0
  232. data/test/basepack_test_app/public/javascripts/dragdrop.js +974 -0
  233. data/test/basepack_test_app/public/javascripts/effects.js +1123 -0
  234. data/test/basepack_test_app/public/javascripts/prototype.js +6001 -0
  235. data/test/basepack_test_app/public/javascripts/rails.js +175 -0
  236. data/test/basepack_test_app/public/robots.txt +5 -0
  237. data/test/basepack_test_app/public/stylesheets/.gitkeep +0 -0
  238. data/test/basepack_test_app/script/cucumber +10 -0
  239. data/test/basepack_test_app/script/rails +6 -0
  240. data/test/basepack_test_app/spec/components/form_panel_spec.rb +53 -0
  241. data/test/basepack_test_app/spec/components/grid_panel_spec.rb +10 -0
  242. data/test/basepack_test_app/spec/data_adapter/adapter_spec.rb +68 -0
  243. data/test/basepack_test_app/spec/data_adapter/attributes_spec.rb +56 -0
  244. data/test/basepack_test_app/spec/data_adapter/relation_extensions_spec.rb +125 -0
  245. data/test/basepack_test_app/spec/factories.rb +28 -0
  246. data/test/basepack_test_app/spec/spec_helper.rb +39 -0
  247. data/test/basepack_test_app/test/performance/browsing_test.rb +9 -0
  248. data/test/basepack_test_app/test/test_helper.rb +13 -0
  249. data/test/basepack_test_app/vendor/plugins/.gitkeep +0 -0
  250. data/test/console_with_fixtures.rb +4 -0
  251. data/test/fixtures/books.yml +11 -0
  252. data/test/fixtures/categories.yml +7 -0
  253. data/test/fixtures/cities.yml +21 -0
  254. data/test/fixtures/continents.yml +7 -0
  255. data/test/fixtures/countries.yml +9 -0
  256. data/test/fixtures/genres.yml +9 -0
  257. data/test/fixtures/roles.yml +8 -0
  258. data/test/fixtures/users.yml +11 -0
  259. data/test/schema.rb +10 -0
  260. data/test/test_helper.rb +21 -0
  261. data/test/unit/accordion_panel_test.rb +20 -0
  262. data/test/unit/active_record_basepack_test.rb +54 -0
  263. data/test/unit/fields_configuration_test.rb +18 -0
  264. data/test/unit/grid_panel_test.rb +52 -0
  265. data/test/unit/netzke_basepack_test.rb +4 -0
  266. data/test/unit/tab_panel_test.rb +21 -0
  267. data/uninstall.rb +1 -0
  268. metadata +332 -0
@@ -0,0 +1,73 @@
1
+ Feature: Grid panel filters
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Background:
7
+ Given an author exists with first_name: "Vladimir", last_name: "Nabokov"
8
+ And a book exists with author: that author, title: "Lolita", exemplars: 5, digitized: false, notes: "To read", last_read_at: "2010-12-23"
9
+
10
+ And an author exists with first_name: "Carlos", last_name: "Castaneda"
11
+ And a book exists with author: that author, title: "Journey to Ixtlan", exemplars: 10, digitized: true, notes: "A must-read", last_read_at: "2011-04-25"
12
+
13
+ And an author exists with first_name: "David", last_name: "Allen"
14
+ And a book exists with author: that author, title: "Getting Things Done", exemplars: 3, digitized: true, notes: "Productivity", last_read_at: "2011-04-26"
15
+
16
+ @javascript
17
+ Scenario: Numeric and text filter
18
+ When I go to the BookGridFiltering test page
19
+ And I enable filter on column "exemplars" with value "{gt:6}"
20
+ Then the grid should show 1 records
21
+
22
+ When I clear all filters in the grid
23
+ And I enable filter on column "exemplars" with value "{eq:5}"
24
+ Then the grid should show 1 records
25
+
26
+ When I clear all filters in the grid
27
+ And I enable filter on column "exemplars" with value "{eq:6}"
28
+ Then the grid should show 0 records
29
+
30
+ # NOTE: due to some mystery, this wouldn't work in a separate scenario (e.g. "Text filter")
31
+ # That is, the filter just wouldn't get set.
32
+ When I clear all filters in the grid
33
+ And I enable filter on column "notes" with value "'read'"
34
+ Then the grid should show 2 records
35
+
36
+ When I clear all filters in the grid
37
+ And I enable filter on column "author__first_name" with value "'d'"
38
+ Then the grid should show 2 records
39
+
40
+ When I clear all filters in the grid
41
+ And I enable filter on column "author__first_name" with value "'carl'"
42
+ Then the grid should show 1 records
43
+
44
+ When I clear all filters in the grid
45
+ And I enable date filter on column "last_read_at" with value "on 04/25/2011"
46
+ Then the grid should show 1 records
47
+
48
+ When I clear all filters in the grid
49
+ And I enable date filter on column "last_read_at" with value "after 04/25/2011"
50
+ Then the grid should show 1 records
51
+
52
+ When I clear all filters in the grid
53
+ And I enable date filter on column "last_read_at" with value "before 12/24/2010"
54
+ Then the grid should show 1 records
55
+
56
+ When I clear all filters in the grid
57
+ And I enable date filter on column "last_read_at" with value "after 12/23/2010"
58
+ Then the grid should show 2 records
59
+
60
+ When I clear all filters in the grid
61
+ And I enable date filter on column "last_read_at" with value "after 12/23/2010"
62
+ And I enable date filter on column "last_read_at" with value "before 04/26/2011"
63
+ Then the grid should show 1 records
64
+
65
+ @javascript
66
+ Scenario: Boolean filter
67
+ When I go to the BookGridFiltering test page
68
+ And I enable filter on column "digitized" with value "false"
69
+ Then the grid should show 1 records
70
+
71
+ When I clear all filters in the grid
72
+ And I enable filter on column "digitized" with value "true"
73
+ Then the grid should show 2 records
@@ -0,0 +1,15 @@
1
+ Feature: Grid panel with custom primary key
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ @javascript
7
+ Scenario: Inline editing
8
+ Given a book_with_custom_primary_key exists with title: "Book you are to write"
9
+ When I go to the BookWithCustomPrimaryKeyGrid test page
10
+ And I edit row 1 of the grid with title: "My fight club"
11
+ And I press "Apply"
12
+ And I wait for the response from the server
13
+ Then the grid should have 0 modified records
14
+ And a book_with_custom_primary_key should exist with title: "My fight club"
15
+ But a book should not exist with title: "Book you are to write"
@@ -0,0 +1,47 @@
1
+ Feature: Grid sorting
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ @javascript
7
+ Scenario: Sorting on regular column
8
+ Given the following books exist:
9
+ | title |
10
+ | Belief |
11
+ | Cosmos |
12
+ | Avatar |
13
+
14
+ When I go to the BookGrid test page
15
+ And I click on column "Title"
16
+ And I wait for the response from the server
17
+ Then the grid should have records sorted by "Title"
18
+
19
+ When I click on column "Title"
20
+ And I wait for the response from the server
21
+ Then the grid should have records sorted by "Title" desc
22
+
23
+ @javascript
24
+ Scenario: Sorting on association column
25
+ Given an author exists with first_name: "Herman", last_name: "Hesse"
26
+ And a book exists with title: "Damian", author: that author
27
+ And an author exists with first_name: "Carlos", last_name: "Castaneda"
28
+ And a book exists with title: "Journey", author: that author
29
+ And an author exists with first_name: "John", last_name: "Fowles"
30
+ And a book exists with title: "Magus", author: that author
31
+
32
+ When I go to the BookGridWithCustomColumns test page
33
+ And I click on column "Author first name"
34
+ And I wait for the response from the server
35
+ Then the grid should have records sorted by "Author first name"
36
+
37
+ When I click on column "Author first name"
38
+ And I wait for the response from the server
39
+ Then the grid should have records sorted by "Author first name" desc
40
+
41
+ When I go to the BookGrid test page
42
+ And I click on column "Author name"
43
+ And I wait for the response from the server
44
+ Then the grid should have records sorted by "Author name"
45
+ When I click on column "Author name"
46
+ And I wait for the response from the server
47
+ Then the grid should have records sorted by "Author name" desc
@@ -0,0 +1,18 @@
1
+ Feature: I18n
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Scenario: A grid with localized column headers
7
+ When I go to the "es" version of the BookGrid page
8
+ Then I should see "Autor"
9
+ And I should see "Creado en"
10
+ But I should not see "Author"
11
+ And I should not see "Created at"
12
+
13
+ Scenario: A form with localized field labels
14
+ When I go to the "es" version of the BookForm page
15
+ Then I should see "Autor"
16
+ And I should see "En abundancia"
17
+ But I should not see "Author"
18
+ And I should not see "In abundance"
@@ -0,0 +1,26 @@
1
+ Feature: Nested attributes
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ @javascript
7
+ Scenario: Grid with nested attributes
8
+ Given an author exists with first_name: "Vlad", last_name: "Nabokoff"
9
+ And a book exists with title: "Lola", author: that author
10
+ When I go to the BookGridWithNestedAttributes test page
11
+ Then I should see "Vlad" within "#book_grid_with_nested_attributes"
12
+ And I should see "Nabokoff" within "#book_grid_with_nested_attributes"
13
+
14
+ When I select first row in the grid
15
+ And I press "Edit in form"
16
+ And I fill in "Author first name:" with "Vladimir"
17
+ And I fill in "Author last name:" with "Nabokov"
18
+ And I fill in "Title:" with "Lolita"
19
+ And I press "OK"
20
+
21
+ Then I should see "Nabokov"
22
+ Then an author should exist with first_name: "Vladimir", last_name: "Nabokov"
23
+ And a book should exist with title: "Lolita", author: that author
24
+
25
+ But an author should not exist with first_name: "Vlad"
26
+ And a book should not exist with title: "Lola"
@@ -0,0 +1,43 @@
1
+ Feature: Paging form panel
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Background:
7
+ Given the following books exist:
8
+ | title | exemplars | digitized | notes | published_on | last_read_at |
9
+ | Journey to Ixtlan | 10 | true | A must-read | 2001-01-02 | 2011-01-02 |
10
+ | Lolita | 5 | false | To read | 1988-04-05 | 2011-03-04 |
11
+ | Getting Things Done | 3 | true | Productivity | 2005-06-07 | 2011-12-13 |
12
+
13
+ @javascript
14
+ Scenario: Paging through records
15
+ When I go to the BookPagingFormPanel test page
16
+ Then I should see "Journey to Ixtlan"
17
+
18
+ When I go forward one page
19
+ And I wait for the response from the server
20
+ Then the form should show title: "Lolita"
21
+
22
+ When I go forward one page
23
+ And I wait for the response from the server
24
+ Then the form should show title: "Getting Things Done"
25
+
26
+ #@javascript
27
+ #Scenario: Searching
28
+ #When I go to the BookPagingFormPanel test page
29
+ #And I press "Search"
30
+ #And I wait for the response from the server
31
+ #And I expand combobox "undefined_attr"
32
+ #And I select "Exemplars" from combobox "undefined_attr"
33
+ #And I expand combobox "exemplars_operator"
34
+ #And I select "Less than" from combobox "exemplars_operator"
35
+ #And I fill in "exemplars_value" with "5"
36
+ #And I press "Search" within "#book_paging_form_panel__search_form"
37
+ #And I wait for the response from the server
38
+ #Then the form should show title: "Getting Things Done"
39
+
40
+ @javascript
41
+ Scenario: I must see total records value
42
+ When I go to the BookPagingFormPanel test page
43
+ Then I should see "of 3" within paging toolbar
@@ -0,0 +1,49 @@
1
+ #Feature: Search
2
+ #In order to value
3
+ #As a role
4
+ #I want feature
5
+
6
+ #@javascript
7
+ #Scenario: Search via Search window
8
+ #Given the following roles exist:
9
+ #| id | name |
10
+ #| 1 | admin |
11
+ #| 2 | superadmin |
12
+ #| 3 | user |
13
+
14
+ #And the following users exist:
15
+ #| first_name | last_name | role_id |
16
+ #| Paul | Bley | 1 |
17
+ #| Dalai | Lama | 3 |
18
+ #| Taisha | Abelar | 2 |
19
+ #| Florinda | Donner | 1 |
20
+
21
+ #When I go to the UserGrid test page
22
+ #Then the grid should show 4 records
23
+
24
+ #When I press "Search"
25
+ #And I wait for the response from the server
26
+ #And I expand combobox "undefined_attr"
27
+ #And I select "First name" from combobox "undefined_attr"
28
+ #And I wait for the response from the server
29
+ #And I fill in "first_name_value" with "ai"
30
+ #And I press "Search" within "#user_grid__search_form"
31
+ #And I wait for the response from the server
32
+ #Then the grid should show 2 records
33
+
34
+ # When I press "Search"
35
+ # And I follow "+"
36
+ # And I expand combobox "undefined_attr"
37
+ # And I select "First name" from combobox "undefined_attr"
38
+ # And I fill in "first_name_value" with "in"
39
+ # And I press "Search" within "#user_grid__search_form"
40
+ # And I wait for the response from the server
41
+ # Then the grid should show 3 records
42
+
43
+ # Search on association column not supported yet
44
+ # When I press "Search"
45
+ # And I fill in "Role name like:" with "adm"
46
+ # And I fill in "First name like:" with ""
47
+ # And I press "Search" within "#user_grid__search_form"
48
+ # And I wait for the response from the server
49
+ # Then the grid should show 3 records
@@ -0,0 +1,15 @@
1
+ Feature: Basic application
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ @javascript
7
+ Scenario: SimpleApp should load its components dynamically
8
+ Given I am on the SomeSimpleApp test page
9
+ When I press "Simple accordion"
10
+ Then I should see "Some simple app simple accordion"
11
+ # TODO: there's a problem with dynamic loading of the grid: "event is undefined" as we try to load something AFTER loading grid
12
+ # When I press "User grid"
13
+ # Then I should see "Users"
14
+ When I press "Simple tab panel"
15
+ Then I should see "Some simple app simple tab panel"
@@ -0,0 +1,11 @@
1
+ Feature: Panel
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ @selenium
7
+ Scenario: The SimplePanel component should be able to update its body's HTML from the server
8
+ When I go to the SimplePanel test page
9
+ Then I should see "Original HTML"
10
+ When I press "Update html"
11
+ Then I should see "HTML received from server"
@@ -0,0 +1,5 @@
1
+ When /^I expand "([^"]*)"$/ do |arg1|
2
+ page.driver.browser.execute_script <<-JS
3
+ Ext.ComponentQuery.query('panel[title="#{arg1}"]')[0].expand();
4
+ JS
5
+ end
@@ -0,0 +1,16 @@
1
+ When /^(?:|I )check ext checkbox "([^"]*)"$/ do |field|
2
+ page.driver.browser.execute_script <<-JS
3
+ var checkbox = Ext.ComponentQuery.query("checkboxfield[fieldLabel='#{field}']")[0];
4
+ checkbox = checkbox || Ext.ComponentQuery.query("checkboxfield[boxLabel='#{field}']")[0];
5
+ checkbox.setValue(true);
6
+ JS
7
+ end
8
+
9
+ Then /^ext "([^"]*)" checkbox should(| not) be checked$/ do |name, arg|
10
+ page.driver.browser.execute_script(<<-JS).should == arg.eql?("")
11
+ var checkbox = Ext.ComponentQuery.query('checkboxfield[boxLabel="#{name}"]')[0];
12
+ checkbox = checkbox || Ext.ComponentQuery.query('checkboxfield[fieldLabel="#{name}"]')[0];
13
+
14
+ return checkbox.getValue();
15
+ JS
16
+ end
@@ -0,0 +1,46 @@
1
+ When /^I expand combobox "([^"]*)"$/ do |combo_label|
2
+ page.driver.browser.execute_script <<-JS
3
+ var combo = Ext.ComponentQuery.query("combobox[fieldLabel='#{combo_label}']")[0];
4
+ combo = combo || Ext.ComponentQuery.query("combobox[name='#{combo_label}']")[0];
5
+ combo.onTriggerClick();
6
+ JS
7
+
8
+ step "I wait for the response from the server"
9
+ end
10
+
11
+ When /^I select "([^"]*)" from combobox "([^"]*)"$/ do |value, combo_label|
12
+ page.driver.browser.execute_script <<-JS
13
+ var combo = Ext.ComponentQuery.query("combobox[fieldLabel='#{combo_label}']")[0];
14
+ combo = combo || Ext.ComponentQuery.query("combobox[name='#{combo_label}']")[0];
15
+ var rec = combo.findRecordByDisplay('#{value}');
16
+ combo.select(rec);
17
+ combo.fireEvent('select', combo, rec );
18
+ JS
19
+ end
20
+
21
+ Then /the form should show #{capture_fields}$/ do |fields|
22
+ page.driver.browser.execute_script(<<-JS).should == true
23
+ var form = Ext.ComponentQuery.query('form')[0].getForm();
24
+ var values = {#{fields}};
25
+ for (var fieldName in values) {
26
+ var field = form.findField(fieldName);
27
+
28
+ if (field.getXType() == 'xdatetime') {
29
+ // Treat xdatetime specially
30
+ var oldValue = field.getValue();
31
+ field.setValue(values[fieldName]);
32
+ return oldValue == field.getValue();
33
+ } else {
34
+ return (field.getValue() == values[fieldName] || field.getRawValue() == values[fieldName]);
35
+ }
36
+ }
37
+ return true;
38
+ JS
39
+ end
40
+
41
+ Then /^I fill in Ext field "([^"]*)" with "([^"]*)"$/ do |field_label, value|
42
+ page.driver.browser.execute_script <<-JS
43
+ var field = Ext.ComponentQuery.query("[fieldLabel='#{field_label}']")[0];
44
+ field.setValue("#{value}");
45
+ JS
46
+ end
@@ -0,0 +1,44 @@
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 disabled$/ do |arg1|
10
+ Netzke.should be # PENDING!
11
+ end
12
+
13
+ When /I (?:sleep|wait) (\d+) (\w+)/ do |amount, unit|
14
+ sleep amount.to_i.send(unit)
15
+ end
16
+
17
+ When /^I wait for the response from the server$/ do
18
+ sleep 0.5
19
+ page.wait_until{ page.driver.browser.execute_script("return !(Netzke.ajaxIsLoading() || Ext.Ajax.isLoading())") }
20
+ sleep 0.5
21
+ end
22
+
23
+ When /^I go forward one page$/ do
24
+ page.driver.browser.execute_script(<<-JS)
25
+ var toolbar = Ext.ComponentQuery.query('pagingtoolbar')[0];
26
+ toolbar.moveNext();
27
+ JS
28
+ page.wait_until{ page.driver.browser.execute_script("return !Ext.Ajax.isLoading();") }
29
+ end
30
+
31
+ Then /^the "([^"]*)" component should be hidden$/ do |id|
32
+ page.driver.browser.execute_script(<<-JS).should be_false
33
+ var cmp = Ext.ComponentMgr.get("#{id}");
34
+ return cmp.isVisible();
35
+ JS
36
+ end
37
+
38
+ Then /^I should see "([^"]*)" within paging toolbar$/ do |text|
39
+ step %Q{I should see "#{text}"}
40
+ # Not working, as it checks the initial text property, not the actual one
41
+ # page.driver.browser.execute_script(<<-JS).should == true
42
+ # Ext.ComponentQuery.query('pagingtoolbar')[0].query('tbtext[text="#{text}"]').length >= 1
43
+ # JS
44
+ end
@@ -0,0 +1,186 @@
1
+ When /^I select first row in the grid$/ do
2
+ page.driver.browser.execute_script <<-JS
3
+ Ext.ComponentQuery.query('gridpanel')[0].getSelectionModel().select(0);
4
+ JS
5
+ end
6
+
7
+ When /^I select all rows in the grid$/ do
8
+ page.driver.browser.execute_script <<-JS
9
+ var components = [];
10
+ for (var cmp in Netzke.page) { components.push(cmp); }
11
+ var grid = Netzke.page[components[0]];
12
+ grid.getSelectionModel().selectAll();
13
+ JS
14
+ end
15
+
16
+ Then /^the grid should show (\d+) records$/ do |arg1|
17
+ page.driver.browser.execute_script(<<-JS).should == arg1.to_i
18
+ var components = [];
19
+ for (var cmp in Netzke.page) { components.push(cmp); }
20
+ var grid = Netzke.page[components[0]];
21
+ return grid.getStore().getCount();
22
+ JS
23
+ end
24
+
25
+ When /^I edit row (\d+) of the grid with #{capture_fields}$/ do |rowIndex, fields|
26
+ fields = parse_fields(fields)
27
+ js_set_fields = fields.each_pair.map do |k,v|
28
+ "r.set('#{k}', '#{v}');"
29
+ end.join
30
+ page.driver.browser.execute_script <<-JS
31
+ var components = [];
32
+ for (var cmp in Netzke.page) { components.push(cmp); }
33
+ var grid = Netzke.page[components[0]];
34
+ var r = grid.getStore().getAt(#{rowIndex.to_i-1});
35
+ #{js_set_fields}
36
+ JS
37
+ end
38
+
39
+ Then /^the grid should have (\d+) modified records$/ do |n|
40
+ page.driver.browser.execute_script(<<-JS).should == n.to_i
41
+ return Ext.ComponentQuery.query('gridpanel')[0].getStore().getUpdatedRecords().length;
42
+ JS
43
+ end
44
+
45
+ When /^I enable filter on column "([^"]*)" with value "([^"]*)"$/ do |column, value|
46
+ page.driver.browser.execute_script <<-JS
47
+ var grid = Ext.ComponentQuery.query('gridpanel')[0],
48
+ filter;
49
+ grid.filters.createFilters();
50
+ filter = grid.filters.getFilter('#{column}');
51
+ filter.setValue(#{value});
52
+ filter.setActive(true);
53
+ JS
54
+ sleep 1
55
+ end
56
+
57
+ # E.g.: And I enable date filter on column "last_read_at" with value "after 04/25/2011" (this date should be in the US format)
58
+ When /^I enable date filter on column "([^"]*)" with value "([^"]*)"$/ do |column, value|
59
+ operand, date = value.split
60
+ page.driver.browser.execute_script <<-JS
61
+ var grid = Ext.ComponentQuery.query('gridpanel')[0],
62
+ filter, value;
63
+ grid.filters.createFilters();
64
+ filter = grid.filters.getFilter('#{column}');
65
+ value = filter.getValue();
66
+ value.#{operand} = new Date('#{date}'); // merge the new value with the current one
67
+ filter.setValue(value);
68
+ filter.setActive(true);
69
+ JS
70
+ sleep 1
71
+ end
72
+
73
+ When /^I clear all filters in the grid$/ do
74
+ page.driver.browser.execute_script <<-JS
75
+ var components = [];
76
+ for (var cmp in Netzke.page) { components.push(cmp); }
77
+ var grid = Netzke.page[components[0]];
78
+ grid.filters.clearFilters();
79
+ JS
80
+ end
81
+
82
+ When /^I expand combobox "([^"]*)" in row (\d+) of the grid$/ do |field, row|
83
+ page.driver.browser.execute_script <<-JS
84
+ var grid = Ext.ComponentQuery.query('gridpanel')[0],
85
+ editor = grid.getPlugin('celleditor');
86
+
87
+ editor.startEditByPosition({ row:#{row.to_i-1}, column:grid.headerCt.items.findIndex('name', '#{field}') });
88
+ JS
89
+
90
+ sleep 0.5
91
+
92
+ page.driver.browser.execute_script("Ext.ComponentQuery.query('netzkeremotecombo')[0].onTriggerClick();");
93
+ end
94
+
95
+ When /^I select "([^"]*)" in combobox "([^"]*)" in row (\d+) of the grid$/ do |value, field, row|
96
+ page.driver.browser.execute_script <<-JS
97
+ var grid = Ext.ComponentQuery.query('gridpanel')[0],
98
+ col = Ext.ComponentQuery.query('gridcolumn[name="#{field}"]'),
99
+ colId = grid.headerCt.items.findIndex('name', '#{field}'),
100
+ combo = Ext.ComponentQuery.query('netzkeremotecombo')[0];
101
+
102
+ combo.setValue( combo.findRecordByDisplay('#{value}') );
103
+ combo.onTriggerClick();
104
+ JS
105
+ end
106
+
107
+ When /^I stop editing the grid$/ do
108
+ page.driver.browser.execute_script <<-JS
109
+ var p;
110
+ (p = Ext.ComponentQuery.query('gridpanel')[0].getPlugin('celleditor')) && p.completeEdit();
111
+ JS
112
+ end
113
+
114
+ When /^I reload the grid$/ do
115
+ page.driver.browser.execute_script <<-JS
116
+ var components = [];
117
+ for (var cmp in Netzke.page) { components.push(cmp); }
118
+ var grid = Netzke.page[components[0]];
119
+ grid.getStore().load();
120
+ JS
121
+ end
122
+
123
+ When /^I (?:drag|move) "([^"]*)" column before "([^"]*)"$/ do |header1, header2|
124
+ headers=[header1,header2].map {|s| s=s.gsub(/ /, ' ')}
125
+ indexi =[0,1].map { |i| i=page.driver.browser.execute_script %Q(return Ext.ComponentQuery.query('gridcolumn[text="#{headers[i]}"]')[0].getIndex()) }
126
+ page.driver.browser.execute_script <<-JS
127
+ cmp = Ext.ComponentQuery.query('gridpanel')[0];
128
+ cmp.onColumnMove(null, null, #{indexi[0]}, #{indexi[1]});
129
+ JS
130
+ step "I wait for the response from the server"
131
+ end
132
+
133
+ Then /^I should see columns in order: "([^"]*)", "([^"]*)", "([^"]*)"$/ do |header1, header2, header3|
134
+ headers=[header1,header2,header3].map {|s| s=s.gsub(/ /, ' ')}
135
+ page.driver.browser.execute_script(<<-JS).should be_true
136
+ return (Ext.ComponentQuery.query('gridcolumn[text="#{headers[0]}"]')[0].getIndex() == 1) &&
137
+ (Ext.ComponentQuery.query('gridcolumn[text="#{headers[1]}"]')[0].getIndex() == 2) &&
138
+ (Ext.ComponentQuery.query('gridcolumn[text="#{headers[2]}"]')[0].getIndex() == 3)
139
+ JS
140
+ end
141
+
142
+ When /^I click on column "([^"]*)"$/ do |column|
143
+ el_id = page.driver.browser.execute_script <<-JS
144
+ return Ext.ComponentQuery.query('gridcolumn[text="#{column}"]')[0].id;
145
+ JS
146
+
147
+ find("##{el_id}").click
148
+ end
149
+
150
+ Then /^the grid should have records sorted by "([^"]*)"\s?(asc|desc)?$/ do |column, dir|
151
+ dir ||= "asc"
152
+
153
+ page.driver.browser.execute_script(<<-JS).should be_true
154
+ var grid = Ext.ComponentQuery.query('gridpanel')[0],
155
+ column = Ext.ComponentQuery.query('gridcolumn[text="#{column}"]')[0],
156
+ fieldName = column.name,
157
+ columnValues = [];
158
+
159
+ grid.getStore().each(function(r){
160
+ var value = column.assoc ? r.get('_meta').associationValues[fieldName] : r.get(fieldName);
161
+ if (value) columnValues.#{dir == "asc" ? "push" : "unshift"}(value);
162
+ });
163
+
164
+ return (columnValues.length > 0) && (columnValues.toString() === Ext.Array.sort(columnValues).toString());
165
+ JS
166
+ end
167
+
168
+ Then /^the grid's column "([^"]*)" should not be sortable$/ do |column_name|
169
+ column = column_name.downcase.gsub(' ', '_')
170
+ page.driver.browser.execute_script(<<-JS).should_not be_true
171
+ var col = Ext.ComponentQuery.query('gridcolumn[name="#{column}"]')[0];
172
+ return col.sortable;
173
+ JS
174
+ end
175
+
176
+ Then /^the grid's column "([^"]*)" should not be editable$/ do |column_name|
177
+ column = column_name.downcase.gsub(' ', '_')
178
+ page.driver.browser.execute_script(<<-JS).should be_true
179
+ var col = Ext.ComponentQuery.query('gridcolumn[name="#{column}"]')[0];
180
+ return typeof col.getEditor() == 'undefined';
181
+ JS
182
+ end
183
+
184
+ When /^I click the "([^"]*)" action icon$/ do |action_name|
185
+ find("img[data-qtip='#{action_name}']").click
186
+ end