netzke-basepack 0.5.14 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -2
- data/CHANGELOG.rdoc +15 -0
- data/README.rdoc +45 -50
- data/Rakefile +8 -8
- data/TODO.rdoc +1 -6
- data/app/components/netzke/basepack/accordion_panel.rb +37 -0
- data/app/components/netzke/basepack/basic_app.rb +267 -0
- data/{lib/netzke → app/components/netzke/basepack}/basic_app/statusbar_ext.js +0 -0
- data/app/components/netzke/basepack/border_layout_panel.rb +39 -0
- data/app/components/netzke/basepack/form_panel.rb +102 -0
- data/app/components/netzke/basepack/form_panel/fields.rb +206 -0
- data/{lib/netzke → app/components/netzke/basepack}/form_panel/javascripts/netzkefileupload.js +0 -0
- data/app/components/netzke/basepack/form_panel/javascripts/pre.js +76 -0
- data/{lib/netzke → app/components/netzke/basepack}/form_panel/javascripts/xcheckbox.js +0 -0
- data/app/components/netzke/basepack/form_panel/services.rb +99 -0
- data/app/components/netzke/basepack/grid_panel.rb +374 -0
- data/app/components/netzke/basepack/grid_panel/columns.rb +233 -0
- data/app/components/netzke/basepack/grid_panel/javascript.rb +69 -0
- data/app/components/netzke/basepack/grid_panel/javascripts/advanced_search.js +96 -0
- data/{lib/netzke → app/components/netzke/basepack}/grid_panel/javascripts/edit_in_form.js +5 -4
- data/{lib/netzke/grid_panel/javascripts/grid_panel_pre.js → app/components/netzke/basepack/grid_panel/javascripts/pre.js} +17 -37
- data/{lib/netzke → app/components/netzke/basepack}/grid_panel/javascripts/rows-dd.js +0 -0
- data/app/components/netzke/basepack/grid_panel/multi_edit_form.rb +16 -0
- data/app/components/netzke/basepack/grid_panel/record_form_window.rb +36 -0
- data/app/components/netzke/basepack/grid_panel/search_window.rb +56 -0
- data/app/components/netzke/basepack/grid_panel/services.rb +356 -0
- data/app/components/netzke/basepack/panel.rb +11 -0
- data/app/components/netzke/basepack/search_panel.rb +59 -0
- data/app/components/netzke/basepack/tab_panel.rb +32 -0
- data/app/components/netzke/basepack/window.rb +73 -0
- data/app/components/netzke/basepack/wrapper.rb +28 -0
- data/{lib/app → app}/models/netzke_field_list.rb +1 -1
- data/{lib/app → app}/models/netzke_model_attr_list.rb +0 -0
- data/{lib/app → app}/models/netzke_persistent_array_auto_model.rb +0 -0
- data/config/database.yml +35 -0
- data/features/accordion_panel.feature +15 -0
- data/features/basic_app.feature +12 -0
- data/features/form_panel.feature +40 -0
- data/features/grid_panel.feature +62 -0
- data/features/search_in_grid.feature +35 -0
- data/features/simple_panel.feature +15 -0
- data/features/step_definitions/accordion_steps.rb +9 -0
- data/features/step_definitions/generic_steps.rb +15 -0
- data/features/step_definitions/grid_panel_steps.rb +26 -0
- data/features/step_definitions/pickle_steps.rb +100 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +66 -0
- data/features/support/paths.rb +59 -0
- data/features/support/pickle.rb +25 -0
- data/features/tab_panel.feature +15 -0
- data/features/window.feature +11 -0
- data/from_05_to_06.rdoc +2 -0
- data/javascripts/basepack.js +54 -2
- data/lib/netzke-basepack.rb +38 -25
- data/lib/netzke/active_record.rb +12 -4
- data/lib/netzke/active_record/attributes.rb +60 -5
- data/lib/netzke/active_record/combobox_options.rb +3 -2
- data/lib/netzke/active_record/relation_extensions.rb +35 -0
- data/lib/netzke/basepack.rb +27 -0
- data/lib/netzke/basepack/version.rb +11 -0
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +26 -0
- data/lib/netzke/data_accessor.rb +60 -32
- data/lib/netzke/fields_configurator.rb +5 -9
- data/lib/netzke/masquerade_selector.rb +1 -1
- data/locale/en.yml +16 -0
- data/netzke-basepack.gemspec +298 -0
- data/spec/active_record/attributes_spec.rb +14 -0
- data/spec/active_record/relation_extensions_spec.rb +44 -0
- data/spec/components/form_panel_spec.rb +70 -0
- data/spec/components/grid_panel_spec.rb +10 -0
- data/spec/factories.rb +9 -0
- data/spec/spec_helper.rb +35 -0
- data/test/rails_app/.gitignore +4 -0
- data/test/rails_app/Gemfile +32 -0
- data/test/rails_app/Gemfile.lock +171 -0
- data/test/rails_app/README +256 -0
- data/test/rails_app/Rakefile +7 -0
- data/test/rails_app/app/components/generic_user_form.rb +12 -0
- data/test/rails_app/app/components/simple_accordion.rb +11 -0
- data/test/rails_app/app/components/simple_basic_app.rb +32 -0
- data/test/rails_app/app/components/simple_panel.rb +17 -0
- data/test/rails_app/app/components/simple_tab_panel.rb +11 -0
- data/test/rails_app/app/components/simple_wrapper.rb +7 -0
- data/test/rails_app/app/components/some_border_layout.rb +24 -0
- data/test/rails_app/app/components/some_search_panel.rb +34 -0
- data/test/rails_app/app/components/some_tab_panel.rb +15 -0
- data/test/rails_app/app/components/user_form.rb +21 -0
- data/test/rails_app/app/components/user_form_with_default_fields.rb +8 -0
- data/test/rails_app/app/components/user_grid.rb +4 -0
- data/test/rails_app/app/components/window_component_loader.rb +17 -0
- data/test/{app_root/app/controllers/application.rb → rails_app/app/controllers/application_controller.rb} +1 -0
- data/test/rails_app/app/controllers/components_controller.rb +6 -0
- data/test/rails_app/app/controllers/welcome_controller.rb +5 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/{app_root → rails_app}/app/models/role.rb +0 -0
- data/test/rails_app/app/models/user.rb +6 -0
- data/test/rails_app/app/presenters/forms/generic_user.rb +6 -0
- data/test/rails_app/app/views/layouts/application.html.erb +13 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +45 -0
- data/test/rails_app/config/boot.rb +13 -0
- data/test/rails_app/config/database.yml +35 -0
- data/test/rails_app/config/environment.rb +6 -0
- data/test/rails_app/config/environments/development.rb +22 -0
- data/test/rails_app/config/environments/production.rb +49 -0
- data/test/rails_app/config/environments/test.rb +35 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +8 -0
- data/test/rails_app/config/initializers/inflections.rb +10 -0
- data/test/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/rails_app/config/initializers/netzke.rb +7 -0
- data/test/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/rails_app/config/initializers/session_store.rb +8 -0
- data/test/rails_app/config/locales/es.yml +12 -0
- data/test/rails_app/config/routes.rb +65 -0
- data/test/rails_app/db/development_structure.sql +39 -0
- data/test/{app_root/db/migrate/20081222035855_create_netzke_preferences.rb → rails_app/db/migrate/20100905214933_create_netzke_preferences.rb} +2 -4
- data/test/{app_root/db/migrate/20090423222114_create_users.rb → rails_app/db/migrate/20100914104207_create_users.rb} +4 -1
- data/test/{app_root/db/migrate/20090423214303_create_roles.rb → rails_app/db/migrate/20100914104236_create_roles.rb} +2 -0
- data/test/rails_app/db/schema.rb +38 -0
- data/test/rails_app/db/seeds.rb +20 -0
- data/test/rails_app/features/support/paths.rb +47 -0
- data/test/{app_root/config/environments/in_memory.rb → rails_app/lib/tasks/.gitkeep} +0 -0
- data/test/rails_app/public/404.html +26 -0
- data/test/rails_app/public/422.html +26 -0
- data/test/rails_app/public/500.html +26 -0
- data/test/{app_root/config/environments/mysql.rb → rails_app/public/favicon.ico} +0 -0
- data/test/rails_app/public/images/header-deco.gif +0 -0
- data/test/rails_app/public/images/rails.png +0 -0
- data/test/rails_app/public/javascripts/application.js +2 -0
- data/test/rails_app/public/javascripts/controls.js +965 -0
- data/test/rails_app/public/javascripts/dragdrop.js +974 -0
- data/test/rails_app/public/javascripts/effects.js +1123 -0
- data/test/rails_app/public/javascripts/prototype.js +6001 -0
- data/test/rails_app/public/javascripts/rails.js +175 -0
- data/test/rails_app/public/robots.txt +5 -0
- data/test/{app_root/config/environments/postgresql.rb → rails_app/public/stylesheets/.gitkeep} +0 -0
- data/test/rails_app/script/rails +6 -0
- data/test/rails_app/spec/models/role_spec.rb +5 -0
- data/test/rails_app/spec/models/user_spec.rb +5 -0
- data/test/rails_app/test/performance/browsing_test.rb +9 -0
- data/test/rails_app/test/test_helper.rb +13 -0
- data/test/{app_root/config/environments/sqlite.rb → rails_app/vendor/plugins/.gitkeep} +0 -0
- data/test/unit/accordion_panel_test.rb +3 -3
- data/test/unit/active_record_basepack_test.rb +4 -4
- data/test/unit/tab_panel_test.rb +4 -4
- metadata +199 -119
- data/lib/netzke/accordion_panel.rb +0 -115
- data/lib/netzke/active_record/data_accessor.rb +0 -25
- data/lib/netzke/attributes_configurator.rb +0 -195
- data/lib/netzke/basic_app.rb +0 -368
- data/lib/netzke/border_layout_panel.rb +0 -130
- data/lib/netzke/configuration_panel.rb +0 -24
- data/lib/netzke/form_panel.rb +0 -138
- data/lib/netzke/form_panel/form_panel_api.rb +0 -81
- data/lib/netzke/form_panel/form_panel_fields.rb +0 -149
- data/lib/netzke/form_panel/form_panel_js.rb +0 -163
- data/lib/netzke/grid_panel.rb +0 -367
- data/lib/netzke/grid_panel/grid_panel_api.rb +0 -364
- data/lib/netzke/grid_panel/grid_panel_columns.rb +0 -232
- data/lib/netzke/grid_panel/grid_panel_js.rb +0 -73
- data/lib/netzke/grid_panel/javascripts/advanced_search.js +0 -65
- data/lib/netzke/grid_panel/multi_edit_form.rb +0 -14
- data/lib/netzke/grid_panel/record_form_window.rb +0 -50
- data/lib/netzke/panel.rb +0 -11
- data/lib/netzke/plugins/configuration_tool.rb +0 -121
- data/lib/netzke/property_editor.rb +0 -111
- data/lib/netzke/property_editor/helper_model.rb +0 -122
- data/lib/netzke/search_panel.rb +0 -199
- data/lib/netzke/tab_panel.rb +0 -174
- data/lib/netzke/table_editor.rb +0 -118
- data/lib/netzke/tree_panel.rb +0 -25
- data/lib/netzke/window.rb +0 -82
- data/lib/netzke/wrapper.rb +0 -42
- data/test/app_root/app/models/book.rb +0 -9
- data/test/app_root/app/models/category.rb +0 -2
- data/test/app_root/app/models/city.rb +0 -3
- data/test/app_root/app/models/continent.rb +0 -2
- data/test/app_root/app/models/country.rb +0 -3
- data/test/app_root/app/models/genre.rb +0 -3
- data/test/app_root/app/models/user.rb +0 -3
- data/test/app_root/config/boot.rb +0 -114
- data/test/app_root/config/database.yml +0 -21
- data/test/app_root/config/environment.rb +0 -14
- data/test/app_root/config/environments/sqlite3.rb +0 -0
- data/test/app_root/config/routes.rb +0 -4
- data/test/app_root/db/migrate/20081222033343_create_books.rb +0 -15
- data/test/app_root/db/migrate/20081222033440_create_genres.rb +0 -15
- data/test/app_root/db/migrate/20081223024935_create_categories.rb +0 -13
- data/test/app_root/db/migrate/20081223025635_create_countries.rb +0 -14
- data/test/app_root/db/migrate/20081223025653_create_continents.rb +0 -13
- data/test/app_root/db/migrate/20081223025732_create_cities.rb +0 -15
- data/test/app_root/db/migrate/20090102223630_create_netzke_field_lists.rb +0 -18
- data/test/app_root/script/console +0 -7
- data/test/app_root/vendor/plugins/acts_as_list/README +0 -23
- data/test/app_root/vendor/plugins/acts_as_list/init.rb +0 -3
- data/test/app_root/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +0 -256
@@ -0,0 +1,73 @@
|
|
1
|
+
module Netzke
|
2
|
+
module Basepack
|
3
|
+
# == Window
|
4
|
+
# Ext.Window-based component able to nest other Netzke components
|
5
|
+
#
|
6
|
+
# == Features
|
7
|
+
# * Persistent position and dimensions
|
8
|
+
#
|
9
|
+
# == Instance configuration
|
10
|
+
# <tt>:item</tt> - nested Netzke component, e.g.:
|
11
|
+
#
|
12
|
+
# netzke :window, :item => {:class_name => "GridPanel", :model => "User"}
|
13
|
+
class Window < Netzke::Base
|
14
|
+
# Based on Ext.Window, naturally
|
15
|
+
def self.js_base_class
|
16
|
+
"Ext.Window"
|
17
|
+
end
|
18
|
+
|
19
|
+
js_properties(
|
20
|
+
# we nest component inside the "fit" layout
|
21
|
+
:layout => "fit"
|
22
|
+
|
23
|
+
# default width and height
|
24
|
+
# :width => 300,
|
25
|
+
# :height => 200
|
26
|
+
)
|
27
|
+
|
28
|
+
js_method :init_component, <<-END_OF_JAVASCRIPT
|
29
|
+
function(){
|
30
|
+
// superclass' initComponent
|
31
|
+
#{js_full_class_name}.superclass.initComponent.call(this);
|
32
|
+
|
33
|
+
// set the move and resize events after window is shown, so that they don't fire at initial rendering
|
34
|
+
this.on("show", function(){
|
35
|
+
this.on("move", this.onMoveResize, this);
|
36
|
+
this.on("resize", this.onMoveResize, this);
|
37
|
+
}, this);
|
38
|
+
|
39
|
+
// instantiate the component
|
40
|
+
if (this.itemConfig){
|
41
|
+
this.instantiateChild(this.itemConfig);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
END_OF_JAVASCRIPT
|
45
|
+
|
46
|
+
js_method :on_move_resize, <<-END_OF_JAVASCRIPT
|
47
|
+
function(){
|
48
|
+
var x = this.getPosition()[0], y = this.getPosition()[1], w = this.getSize().width, h = this.getSize().height;
|
49
|
+
|
50
|
+
// Don't bother the server twice when both move and resize events are fired at the same time
|
51
|
+
// (which happens when the left or upper window border is dragged)
|
52
|
+
if (this.moveResizeTimer) {clearTimeout(this.moveResizeTimer)};
|
53
|
+
|
54
|
+
this.moveResizeTimer = (function(sizeAndPosition){
|
55
|
+
this.setSizeAndPosition(sizeAndPosition); // API call
|
56
|
+
}).defer(10, this, [{x:x, y:y, w:w, h:h}]); // 10ms should be enough
|
57
|
+
}
|
58
|
+
END_OF_JAVASCRIPT
|
59
|
+
|
60
|
+
# Processing API calls from client
|
61
|
+
endpoint :set_size_and_position do |params|
|
62
|
+
Rails.logger.debug "!!! IMPLEMENT ME (set_size_and_position)\n"
|
63
|
+
# update_persistent_ext_config(
|
64
|
+
# :x => params[:x].to_i,
|
65
|
+
# :y => params[:y].to_i,
|
66
|
+
# :width => params[:w].to_i,
|
67
|
+
# :height => params[:h].to_i
|
68
|
+
# )
|
69
|
+
{}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Netzke
|
2
|
+
module Basepack
|
3
|
+
# = Wrapper
|
4
|
+
#
|
5
|
+
# Simple Ext.Panel with layout 'fit' that wraps up another Netzke component. Can be useful in HTML pages where
|
6
|
+
# a component should be dynamically configured, to not reload the entire page after configuration (Wrapper
|
7
|
+
# will reload the component automatically).
|
8
|
+
#
|
9
|
+
# == Configuration
|
10
|
+
# * <tt>:item</tt> - configuration hash for wrapped component
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
#
|
14
|
+
# netzke :wrapper, :item => {
|
15
|
+
# :class_name => "FormPanel",
|
16
|
+
# :model => "User"
|
17
|
+
# }
|
18
|
+
class Wrapper < Netzke::Base
|
19
|
+
js_properties(
|
20
|
+
:layout => 'fit',
|
21
|
+
|
22
|
+
# invisible
|
23
|
+
:header => false,
|
24
|
+
:border => false
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -158,7 +158,7 @@ class NetzkeFieldList < ActiveRecord::Base
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
# Overwrite pref_to_read, pref_to_write methods, and
|
161
|
+
# Overwrite pref_to_read, pref_to_write methods, and find_all_for_component if you want a different way of
|
162
162
|
# identifying the proper preference based on your own authorization strategy.
|
163
163
|
#
|
164
164
|
# The default strategy is:
|
File without changes
|
File without changes
|
data/config/database.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: mysql2
|
5
|
+
encoding: utf8
|
6
|
+
reconnect: false
|
7
|
+
database: nbt_development
|
8
|
+
pool: 5
|
9
|
+
username: root
|
10
|
+
password:
|
11
|
+
socket: /tmp/mysql.sock
|
12
|
+
|
13
|
+
# Warning: The database defined as "test" will be erased and
|
14
|
+
# re-generated from your development database when you run "rake".
|
15
|
+
# Do not set this db to the same as development or production.
|
16
|
+
# test:
|
17
|
+
# adapter: sqlite3
|
18
|
+
# database: db/test.sqlite3
|
19
|
+
# pool: 5
|
20
|
+
# timeout: 5000
|
21
|
+
test:
|
22
|
+
adapter: mysql2
|
23
|
+
encoding: utf8
|
24
|
+
reconnect: false
|
25
|
+
database: nbt_test
|
26
|
+
pool: 5
|
27
|
+
username: root
|
28
|
+
password:
|
29
|
+
socket: /tmp/mysql.sock
|
30
|
+
|
31
|
+
production:
|
32
|
+
adapter: sqlite3
|
33
|
+
database: db/production.sqlite3
|
34
|
+
pool: 5
|
35
|
+
timeout: 5000
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Accordion panel
|
2
|
+
In order to value
|
3
|
+
As a role
|
4
|
+
I want feature
|
5
|
+
|
6
|
+
@javascript
|
7
|
+
Scenario: Lazy loading of a component into a panel when the latter gets expanded
|
8
|
+
Given I am on the SimpleAccordion test page
|
9
|
+
When I expand "Panel Two"
|
10
|
+
Then I should see "Original HTML"
|
11
|
+
When I press "Update html"
|
12
|
+
Then I should see "Update for Panel Two"
|
13
|
+
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Basic application
|
2
|
+
In order to value
|
3
|
+
As a role
|
4
|
+
I want feature
|
5
|
+
|
6
|
+
@javascript
|
7
|
+
Scenario: BasicApp should load its components dynamically
|
8
|
+
Given I am on the SimpleBasicApp test page
|
9
|
+
When I press "Simple accordion"
|
10
|
+
Then I should see "Simple basic app simple accordion"
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Form panel
|
2
|
+
In order to value
|
3
|
+
As a role
|
4
|
+
I want feature
|
5
|
+
|
6
|
+
Scenario: UserForm should be rendered properly along with the data for the first user
|
7
|
+
Given a role exists with name: "writer"
|
8
|
+
And a user exists with first_name: "Carlos", last_name: "Castaneda", role: that role
|
9
|
+
When I go to the UserForm test page
|
10
|
+
Then I should see "Carlos"
|
11
|
+
And I should see "Castaneda"
|
12
|
+
And I should see "writer"
|
13
|
+
|
14
|
+
@javascript
|
15
|
+
Scenario: Editing the record
|
16
|
+
Given a role exists with name: "musician"
|
17
|
+
And a user exists with first_name: "Paul", last_name: "Bley", role: that role
|
18
|
+
And a role exists with name: "painter"
|
19
|
+
When I go to the UserForm test page
|
20
|
+
And I fill in "First name:" with "Salvador"
|
21
|
+
And I fill in "Last name:" with "Dali"
|
22
|
+
And I fill in "Role name:" with "painter"
|
23
|
+
And I press "Apply"
|
24
|
+
And I go to the UserForm test page
|
25
|
+
Then I should see "Salvador"
|
26
|
+
And I should see "Dali"
|
27
|
+
And I should see "painter"
|
28
|
+
|
29
|
+
But I should not see "Maxim"
|
30
|
+
And I should not see "Osminogov"
|
31
|
+
And I should not see "musician"
|
32
|
+
|
33
|
+
Scenario: UserFormWithDefaultFields should render properly
|
34
|
+
Given a role exists with name: "writer"
|
35
|
+
And a user exists with first_name: "Carlos", last_name: "Castaneda", role: that role
|
36
|
+
When I go to the UserFormWithDefaultFields test page
|
37
|
+
Then I should see "Carlos"
|
38
|
+
And I should see "Castaneda"
|
39
|
+
And I should see "writer"
|
40
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Feature: Grid panel
|
2
|
+
In order to value
|
3
|
+
As a role
|
4
|
+
I want feature
|
5
|
+
|
6
|
+
Scenario: UserGrid should render properly
|
7
|
+
Given a user exists with first_name: "Carlos", last_name: "Castaneda"
|
8
|
+
And a user exists with first_name: "Taisha", last_name: "Abelar"
|
9
|
+
When I go to the UserGrid test page
|
10
|
+
Then I should see "Carlos"
|
11
|
+
And I should see "Castaneda"
|
12
|
+
And I should see "Taisha"
|
13
|
+
And I should see "Abelar"
|
14
|
+
|
15
|
+
@javascript
|
16
|
+
Scenario: Adding a record via "Add in form"
|
17
|
+
Given I am on the UserGrid test page
|
18
|
+
When I press "Add in form"
|
19
|
+
Then I should see "Add User"
|
20
|
+
When I fill in "First name:" with "Herman"
|
21
|
+
And I fill in "Last name:" with "Hesse"
|
22
|
+
And I press "OK"
|
23
|
+
Then I should see "Herman"
|
24
|
+
And I should see "Hesse"
|
25
|
+
|
26
|
+
@javascript
|
27
|
+
Scenario: Updating a record via "Edit in form"
|
28
|
+
Given a user exists with first_name: "Carlos", last_name: "Castaneda"
|
29
|
+
When I go to the UserGrid test page
|
30
|
+
And I select first row in the grid
|
31
|
+
And I press "Edit in form"
|
32
|
+
And I fill in "First name:" with "Maxim"
|
33
|
+
And I fill in "Last name:" with "Osminogov"
|
34
|
+
And I press "OK"
|
35
|
+
Then I should see "Maxim"
|
36
|
+
And I should see "Osminogov"
|
37
|
+
And a user should not exist with first_name: "Carlos"
|
38
|
+
|
39
|
+
@javascript
|
40
|
+
Scenario: Deleting a record
|
41
|
+
Given a user exists with first_name: "Anton", last_name: "Chekhov"
|
42
|
+
And a user exists with first_name: "Maxim", last_name: "Osminogov"
|
43
|
+
When I go to the UserGrid test page
|
44
|
+
And I select all rows in the grid
|
45
|
+
And I press "Delete"
|
46
|
+
And I press "Yes"
|
47
|
+
Then I should see "Deleted 2 record(s)"
|
48
|
+
Then a user should not exist with first_name: "Anton"
|
49
|
+
And a user should not exist with first_name: "Maxim"
|
50
|
+
|
51
|
+
@javascript
|
52
|
+
Scenario: Multi-editing records
|
53
|
+
Given a user exists with first_name: "Carlos", last_name: "Castaneda"
|
54
|
+
And a user exists with first_name: "Herman", last_name: "Hesse"
|
55
|
+
When I go to the UserGrid test page
|
56
|
+
And I select all rows in the grid
|
57
|
+
And I press "Edit in form"
|
58
|
+
And I fill in "First name:" with "Maxim"
|
59
|
+
And I press "OK"
|
60
|
+
Then a user should exist with first_name: "Maxim", last_name: "Castaneda"
|
61
|
+
And a user should exist with first_name: "Maxim", last_name: "Hesse"
|
62
|
+
But a user should not exist with first_name: "Carlos"
|
@@ -0,0 +1,35 @@
|
|
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
|
+
| name |
|
10
|
+
| admin |
|
11
|
+
| superadmin |
|
12
|
+
| user |
|
13
|
+
|
14
|
+
And the following users exist:
|
15
|
+
| first_name | last_name | role__name |
|
16
|
+
| Paul | Bley | admin |
|
17
|
+
| Dalai | Lama | user |
|
18
|
+
| Taisha | Abelar | superadmin |
|
19
|
+
| Florinda | Donner | admin |
|
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 fill in "First name like:" with "ai"
|
26
|
+
And I press "Search" within "#user_grid__search_form"
|
27
|
+
And I sleep 1 second
|
28
|
+
Then the grid should show 2 records
|
29
|
+
|
30
|
+
When I press "Search"
|
31
|
+
And I fill in "Role name like:" with "adm"
|
32
|
+
And I fill in "First name like:" with ""
|
33
|
+
And I press "Search" within "#user_grid__search_form"
|
34
|
+
And I sleep 1 second
|
35
|
+
Then the grid should show 3 records
|
@@ -0,0 +1,15 @@
|
|
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"
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
When /^I expand "([^"]*)"$/ do |arg1|
|
2
|
+
page.driver.browser.execute_script <<-JS
|
3
|
+
var components = [];
|
4
|
+
for (var cmp in Netzke.page) { components.push(cmp); }
|
5
|
+
var accordion = Netzke.page[components[0]];
|
6
|
+
var panelToExpand = accordion.items.find(function(i){return i.title == '#{arg1}';});
|
7
|
+
panelToExpand.expand();
|
8
|
+
JS
|
9
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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 (\d+) seconds?/ do |arg1|
|
14
|
+
sleep arg1.to_i
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
When /^I select first row in the grid$/ do
|
2
|
+
page.driver.browser.execute_script <<-JS
|
3
|
+
var components = [];
|
4
|
+
for (var cmp in Netzke.page) { components.push(cmp); }
|
5
|
+
var grid = Netzke.page[components[0]];
|
6
|
+
grid.getSelectionModel().selectFirstRow();
|
7
|
+
JS
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^I select all rows in the grid$/ do
|
11
|
+
page.driver.browser.execute_script <<-JS
|
12
|
+
var components = [];
|
13
|
+
for (var cmp in Netzke.page) { components.push(cmp); }
|
14
|
+
var grid = Netzke.page[components[0]];
|
15
|
+
grid.getSelectionModel().selectAll();
|
16
|
+
JS
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^the grid should show (\d+) records$/ do |arg1|
|
20
|
+
page.driver.browser.execute_script(<<-JS).should == arg1.to_i
|
21
|
+
var components = [];
|
22
|
+
for (var cmp in Netzke.page) { components.push(cmp); }
|
23
|
+
var grid = Netzke.page[components[0]];
|
24
|
+
return grid.getStore().getCount();
|
25
|
+
JS
|
26
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# this file generated by script/generate pickle
|
2
|
+
|
3
|
+
# create a model
|
4
|
+
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
|
5
|
+
create_model(name, fields)
|
6
|
+
end
|
7
|
+
|
8
|
+
# create n models
|
9
|
+
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
10
|
+
count.to_i.times { create_model(plural_factory.singularize, fields) }
|
11
|
+
end
|
12
|
+
|
13
|
+
# create models from a table
|
14
|
+
Given(/^the following #{capture_plural_factory} exists?:?$/) do |plural_factory, table|
|
15
|
+
create_models_from_table(plural_factory, table)
|
16
|
+
end
|
17
|
+
|
18
|
+
# find a model
|
19
|
+
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
|
20
|
+
find_model!(name, fields)
|
21
|
+
end
|
22
|
+
|
23
|
+
# not find a model
|
24
|
+
Then(/^#{capture_model} should not exist(?: with #{capture_fields})?$/) do |name, fields|
|
25
|
+
find_model(name, fields).should be_nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# find models with a table
|
29
|
+
Then(/^the following #{capture_plural_factory} should exists?:?$/) do |plural_factory, table|
|
30
|
+
find_models_from_table(plural_factory, table).should_not be_any(&:nil?)
|
31
|
+
end
|
32
|
+
|
33
|
+
# find exactly n models
|
34
|
+
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
35
|
+
find_models(plural_factory.singularize, fields).size.should == count.to_i
|
36
|
+
end
|
37
|
+
|
38
|
+
# assert equality of models
|
39
|
+
Then(/^#{capture_model} should be #{capture_model}$/) do |a, b|
|
40
|
+
model!(a).should == model!(b)
|
41
|
+
end
|
42
|
+
|
43
|
+
# assert model is in another model's has_many assoc
|
44
|
+
Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
45
|
+
model!(owner).send(association).should include(model!(target))
|
46
|
+
end
|
47
|
+
|
48
|
+
# assert model is not in another model's has_many assoc
|
49
|
+
Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
50
|
+
model!(owner).send(association).should_not include(model!(target))
|
51
|
+
end
|
52
|
+
|
53
|
+
# assert model is another model's has_one/belongs_to assoc
|
54
|
+
Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
55
|
+
model!(owner).send(association).should == model!(target)
|
56
|
+
end
|
57
|
+
|
58
|
+
# assert model is not another model's has_one/belongs_to assoc
|
59
|
+
Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
60
|
+
model!(owner).send(association).should_not == model!(target)
|
61
|
+
end
|
62
|
+
|
63
|
+
# assert model.predicate?
|
64
|
+
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
65
|
+
if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
|
66
|
+
model!(name).should send("have_#{predicate.gsub(' ', '_')}")
|
67
|
+
else
|
68
|
+
model!(name).should send("be_#{predicate.gsub(' ', '_')}")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# assert not model.predicate?
|
73
|
+
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
74
|
+
if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
|
75
|
+
model!(name).should_not send("have_#{predicate.gsub(' ', '_')}")
|
76
|
+
else
|
77
|
+
model!(name).should_not send("be_#{predicate.gsub(' ', '_')}")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# model.attribute.should eql(value)
|
82
|
+
# model.attribute.should_not eql(value)
|
83
|
+
Then(/^#{capture_model}'s (\w+) (should(?: not)?) be #{capture_value}$/) do |name, attribute, expectation, expected|
|
84
|
+
actual_value = model(name).send(attribute)
|
85
|
+
expectation = expectation.gsub(' ', '_')
|
86
|
+
|
87
|
+
case expected
|
88
|
+
when 'nil', 'true', 'false'
|
89
|
+
actual_value.send(expectation, send("be_#{expected}"))
|
90
|
+
when /^[+-]?[0-9_]+(\.\d+)?$/
|
91
|
+
actual_value.send(expectation, eql(expected.to_f))
|
92
|
+
else
|
93
|
+
actual_value.to_s.send(expectation, eql(eval(expected)))
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# assert size of association
|
98
|
+
Then /^#{capture_model} should have (\d+) (\w+)$/ do |name, size, association|
|
99
|
+
model!(name).send(association).size.should == size.to_i
|
100
|
+
end
|