netzke-core 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. data/.autotest +1 -1
  2. data/.gitignore +4 -2
  3. data/CHANGELOG.rdoc +37 -15
  4. data/README.rdoc +93 -28
  5. data/Rakefile +5 -7
  6. data/TODO +24 -3
  7. data/app/controllers/netzke_controller.rb +70 -0
  8. data/app/models/netzke_preference.rb +170 -0
  9. data/autotest/discover.rb +2 -3
  10. data/features/actions.feature +13 -0
  11. data/features/basic.feature +7 -0
  12. data/features/client-server.feature +15 -0
  13. data/features/complex_component.feature +18 -0
  14. data/features/component.feature +13 -0
  15. data/features/component_loader.feature +31 -0
  16. data/features/composition.feature +32 -0
  17. data/features/custom_css.feature +17 -0
  18. data/features/file_inclusion.feature +13 -0
  19. data/features/inheritance.feature +19 -0
  20. data/features/persistence.feature +16 -0
  21. data/features/scopes.feature +17 -0
  22. data/features/step_definitions/custom_css_steps.rb +7 -0
  23. data/features/step_definitions/generic_steps.rb +15 -0
  24. data/features/step_definitions/web_steps.rb +219 -0
  25. data/features/support/env.rb +62 -0
  26. data/features/support/paths.rb +45 -0
  27. data/generators/netzke_core/USAGE +3 -3
  28. data/generators/netzke_core/netzke_core_generator.rb +8 -0
  29. data/install.rb +1 -1
  30. data/javascripts/core.js +542 -499
  31. data/lib/generators/migration_helper.rb +32 -0
  32. data/lib/generators/netzke/USAGE +9 -0
  33. data/lib/generators/netzke/core_generator.rb +24 -0
  34. data/lib/netzke/actions.rb +102 -0
  35. data/lib/netzke/base.rb +77 -529
  36. data/lib/netzke/composition.rb +251 -0
  37. data/lib/netzke/configuration.rb +134 -0
  38. data/lib/netzke/core/masquerading.rb +34 -0
  39. data/lib/netzke/core/session.rb +30 -0
  40. data/lib/netzke/core/version.rb +11 -0
  41. data/lib/netzke/core.rb +53 -0
  42. data/lib/netzke/core_ext/array.rb +30 -0
  43. data/lib/netzke/core_ext/hash.rb +84 -0
  44. data/lib/netzke/core_ext/string.rb +26 -0
  45. data/lib/netzke/core_ext/symbol.rb +13 -0
  46. data/lib/netzke/core_ext/time_with_zone.rb +7 -0
  47. data/lib/netzke/core_ext.rb +5 -141
  48. data/lib/netzke/embedding.rb +21 -0
  49. data/lib/netzke/ext_component.rb +25 -0
  50. data/lib/netzke/javascript.rb +248 -0
  51. data/lib/netzke/persistence.rb +118 -0
  52. data/lib/netzke/rails/action_view_ext.rb +103 -0
  53. data/lib/netzke/{controller_extensions.rb → rails/controller_extensions.rb} +7 -2
  54. data/lib/netzke/rails/routes.rb +7 -0
  55. data/lib/netzke/services.rb +68 -0
  56. data/lib/netzke/session.rb +35 -0
  57. data/lib/netzke/stylesheets.rb +52 -0
  58. data/lib/netzke-core.rb +28 -29
  59. data/netzke-core.gemspec +253 -0
  60. data/spec/component/actions_spec.rb +94 -0
  61. data/spec/component/base_spec.rb +25 -0
  62. data/spec/component/composition_spec.rb +132 -0
  63. data/spec/component/javascript_spec.rb +15 -0
  64. data/spec/core_ext_spec.rb +16 -0
  65. data/spec/spec.opt +2 -0
  66. data/spec/spec_helper.rb +35 -0
  67. data/{test/app_root/db/migrate/20081222035855_create_netzke_preferences.rb → templates/core/create_netzke_preferences.rb} +4 -4
  68. data/test/rails_app/.gitignore +4 -0
  69. data/test/rails_app/Gemfile +36 -0
  70. data/test/rails_app/Gemfile.lock +137 -0
  71. data/test/rails_app/README +15 -0
  72. data/test/rails_app/Rakefile +7 -0
  73. data/test/rails_app/app/components/border_layout_panel.rb +4 -0
  74. data/test/rails_app/app/components/component_loader.rb +59 -0
  75. data/test/rails_app/app/components/component_with_actions.rb +58 -0
  76. data/test/rails_app/app/components/component_with_custom_css.rb +8 -0
  77. data/test/rails_app/app/components/component_with_included_js.rb +16 -0
  78. data/test/rails_app/app/components/component_with_session_persistence.rb +25 -0
  79. data/test/rails_app/app/components/custom.css +3 -0
  80. data/test/rails_app/app/components/deprecated/server_caller.rb +20 -0
  81. data/test/rails_app/app/components/extended_component_with_actions.rb +5 -0
  82. data/test/rails_app/app/components/extended_server_caller.rb +18 -0
  83. data/test/rails_app/app/components/included.js +5 -0
  84. data/test/rails_app/app/components/kinda_complex_component/basic_stuff.rb +35 -0
  85. data/test/rails_app/app/components/kinda_complex_component/extra_stuff.rb +16 -0
  86. data/test/rails_app/app/components/kinda_complex_component.rb +7 -0
  87. data/test/rails_app/app/components/loader_of_component_with_custom_css.rb +15 -0
  88. data/test/rails_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +7 -0
  89. data/test/rails_app/app/components/scoped_components/extended_scoped_component.rb +5 -0
  90. data/test/rails_app/app/components/scoped_components/some_scoped_component.rb +5 -0
  91. data/test/rails_app/app/components/server_caller.rb +21 -0
  92. data/test/rails_app/app/components/simple_component.rb +5 -0
  93. data/test/rails_app/app/components/simple_tab_panel.rb +27 -0
  94. data/test/rails_app/app/components/simple_window.rb +3 -0
  95. data/test/rails_app/app/components/some_composite.rb +65 -0
  96. data/test/rails_app/app/components/some_ext_component.rb +8 -0
  97. data/test/{app_root → rails_app}/app/controllers/application_controller.rb +1 -0
  98. data/test/rails_app/app/controllers/components_controller.rb +12 -0
  99. data/test/rails_app/app/controllers/multiple_components_controller.rb +2 -0
  100. data/test/rails_app/app/controllers/welcome_controller.rb +5 -0
  101. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  102. data/test/rails_app/app/views/layouts/application.html.erb +13 -0
  103. data/test/rails_app/app/views/multiple_components/set_one.html.erb +3 -0
  104. data/test/rails_app/config/application.rb +45 -0
  105. data/test/rails_app/config/boot.rb +13 -0
  106. data/test/rails_app/config/database.yml +22 -0
  107. data/test/rails_app/config/environment.rb +6 -0
  108. data/test/rails_app/config/environments/development.rb +22 -0
  109. data/test/rails_app/config/environments/production.rb +49 -0
  110. data/test/rails_app/config/environments/test.rb +35 -0
  111. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  112. data/test/rails_app/config/initializers/inflections.rb +10 -0
  113. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  114. data/test/rails_app/config/initializers/netzke.rb +3 -0
  115. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  116. data/test/rails_app/config/initializers/session_store.rb +8 -0
  117. data/test/rails_app/config/locales/en.yml +5 -0
  118. data/test/rails_app/config/routes.rb +64 -0
  119. data/test/rails_app/config.ru +4 -0
  120. data/test/rails_app/db/development_structure.sql +4 -0
  121. data/{generators/netzke_core/templates/create_netzke_preferences.rb → test/rails_app/db/migrate/20100905214933_create_netzke_preferences.rb} +1 -3
  122. data/test/rails_app/db/schema.rb +24 -0
  123. data/test/rails_app/db/seeds.rb +7 -0
  124. data/test/{app_root/config/environments/in_memory.rb → rails_app/lib/tasks/.gitkeep} +0 -0
  125. data/test/rails_app/public/404.html +26 -0
  126. data/test/rails_app/public/422.html +26 -0
  127. data/test/rails_app/public/500.html +26 -0
  128. data/test/{app_root/config/environments/mysql.rb → rails_app/public/favicon.ico} +0 -0
  129. data/test/rails_app/public/images/rails.png +0 -0
  130. data/test/rails_app/public/robots.txt +5 -0
  131. data/test/rails_app/script/rails +6 -0
  132. data/test/{app_root/config/environments/postgresql.rb → rails_app/vendor/plugins/.gitkeep} +0 -0
  133. data/test/unit/netzke_core_test.rb +74 -75
  134. data/test/unit/netzke_preference_test.rb +2 -2
  135. metadata +176 -48
  136. data/lib/app/controllers/netzke_controller.rb +0 -46
  137. data/lib/app/models/netzke_preference.rb +0 -171
  138. data/lib/netzke/action_view_ext.rb +0 -81
  139. data/lib/netzke/base_js.rb +0 -339
  140. data/lib/netzke/routing.rb +0 -9
  141. data/test/app_root/app/models/role.rb +0 -3
  142. data/test/app_root/app/models/user.rb +0 -3
  143. data/test/app_root/config/boot.rb +0 -115
  144. data/test/app_root/config/database.yml +0 -31
  145. data/test/app_root/config/environment.rb +0 -14
  146. data/test/app_root/config/environments/sqlite.rb +0 -0
  147. data/test/app_root/config/environments/sqlite3.rb +0 -0
  148. data/test/app_root/config/routes.rb +0 -4
  149. data/test/app_root/db/migrate/20090423214303_create_roles.rb +0 -11
  150. data/test/app_root/db/migrate/20090423222114_create_users.rb +0 -12
  151. data/test/app_root/lib/console_with_fixtures.rb +0 -4
  152. data/test/app_root/script/console +0 -7
@@ -0,0 +1,24 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended to check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(:version => 20100905214933) do
14
+
15
+ create_table "netzke_preferences", :force => true do |t|
16
+ t.string "key"
17
+ t.text "value"
18
+ t.integer "user_id"
19
+ t.integer "role_id"
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+
24
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
  require 'netzke-core'
3
3
 
4
4
  module Netzke
5
- class Widget < Base
5
+ class Component < Base
6
6
  api :method_one, :method_two
7
7
 
8
8
  def self.config
@@ -12,10 +12,10 @@ module Netzke
12
12
  })
13
13
  end
14
14
 
15
- def initial_aggregatees
15
+ def initial_components
16
16
  {
17
- :nested_one => {:class_name => 'NestedWidgetOne'},
18
- :nested_two => {:class_name => 'NestedWidgetTwo'}
17
+ :nested_one => {:class_name => 'NestedComponentOne'},
18
+ :nested_two => {:class_name => 'NestedComponentTwo'}
19
19
  }
20
20
  end
21
21
 
@@ -31,37 +31,37 @@ module Netzke
31
31
  end
32
32
  end
33
33
 
34
- class NestedWidgetOne < Base
34
+ class NestedComponentOne < Base
35
35
  end
36
36
 
37
- class NestedWidgetTwo < Base
38
- def initial_aggregatees
37
+ class NestedComponentTwo < Base
38
+ def initial_components
39
39
  {
40
- :nested => {:class_name => 'DeepNestedWidget'}
40
+ :nested => {:class_name => 'DeepNestedComponent'}
41
41
  }
42
42
  end
43
43
  end
44
44
 
45
- class DeepNestedWidget < Base
46
- def initial_aggregatees
45
+ class DeepNestedComponent < Base
46
+ def initial_components
47
47
  {
48
- :nested => {:class_name => "VeryDeepNestedWidget"}
48
+ :nested => {:class_name => "VeryDeepNestedComponent"}
49
49
  }
50
50
  end
51
51
  end
52
52
 
53
- class VeryDeepNestedWidget < Base
53
+ class VeryDeepNestedComponent < Base
54
54
  end
55
55
 
56
- class JsInheritanceWidget < Widget
56
+ class JsInheritanceComponent < Component
57
57
  end
58
58
 
59
- module ScopedWidgets
60
- class SomeScopedWidget < Base
59
+ module ScopedComponents
60
+ class SomeScopedComponent < Base
61
61
  end
62
62
  end
63
63
 
64
- class InheritedWidget < Widget
64
+ class InheritedComponent < Component
65
65
  def self.config
66
66
  super.merge({
67
67
  :pref_one => -1
@@ -80,104 +80,103 @@ class NetzkeCoreTest < ActiveSupport::TestCase
80
80
  assert_kind_of Netzke::Base, Netzke::Base.new
81
81
  end
82
82
 
83
- test "short widget class name" do
84
- assert_equal 'Widget', Widget.short_widget_class_name
83
+ test "short component class name" do
84
+ assert_equal 'Component', Component.short_component_class_name
85
85
  end
86
86
 
87
87
  test "api" do
88
- widget_class = Widget
89
- assert_equal [:load_aggregatee_with_cache, :method_one, :method_two], widget_class.api_points
88
+ component_class = Component
89
+ assert_equal [:deliver_component, :method_one, :method_two], component_class.endpoints
90
90
  end
91
91
 
92
- test "aggregatees" do
93
- widget = Widget.new(:name => 'my_widget')
92
+ test "components" do
93
+ component = Component.new(:name => 'my_component')
94
94
 
95
- # instantiate aggregatees
96
- nested_widget_one = widget.aggregatee_instance(:nested_one)
97
- nested_widget_two = widget.aggregatee_instance(:nested_two)
98
- deep_nested_widget = widget.aggregatee_instance(:nested_two__nested)
95
+ # instantiate components
96
+ nested_component_one = component.component_instance(:nested_one)
97
+ nested_component_two = component.component_instance(:nested_two)
98
+ deep_nested_component = component.component_instance(:nested_two__nested)
99
99
 
100
- # check the classes of aggregation instances
101
- assert_kind_of NestedWidgetOne, nested_widget_one
102
- assert_kind_of NestedWidgetTwo, nested_widget_two
103
- assert_kind_of DeepNestedWidget, deep_nested_widget
100
+ assert_kind_of NestedComponentOne, nested_component_one
101
+ assert_kind_of NestedComponentTwo, nested_component_two
102
+ assert_kind_of DeepNestedComponent, deep_nested_component
104
103
 
105
- # check the internal names of aggregation instances
106
- assert_equal 'my_widget', widget.global_id
107
- assert_equal 'my_widget__nested_one', nested_widget_one.global_id
108
- assert_equal 'my_widget__nested_two', nested_widget_two.global_id
109
- assert_equal 'my_widget__nested_two__nested', deep_nested_widget.global_id
104
+ assert_equal 'my_component', component.global_id
105
+ assert_equal 'my_component__nested_one', nested_component_one.global_id
106
+ assert_equal 'my_component__nested_two', nested_component_two.global_id
107
+ assert_equal 'my_component__nested_two__nested', deep_nested_component.global_id
110
108
  end
111
109
 
112
110
  test "global_id_by_reference" do
113
- w = Widget.new(:name => "a_widget")
114
- deep_nested_widget = w.aggregatee_instance(:nested_two__nested)
115
- assert_equal("a_widget__nested_two", deep_nested_widget.global_id_by_reference(:parent))
116
- assert_equal("a_widget", deep_nested_widget.global_id_by_reference(:parent__parent))
117
- assert_equal("a_widget__nested_one", deep_nested_widget.global_id_by_reference(:parent__parent__nested_one))
118
- assert_equal("a_widget__nested_two__nested__nested", deep_nested_widget.global_id_by_reference(:nested))
119
- assert_equal("a_widget__nested_two__nested__non_existing", deep_nested_widget.global_id_by_reference(:non_existing))
120
- assert_nil(deep_nested_widget.global_id_by_reference(:parent__parent__parent)) # too far up
111
+ w = Component.new(:name => "a_component")
112
+ deep_nested_component = w.component_instance(:nested_two__nested)
113
+ assert_equal("a_component__nested_two", deep_nested_component.global_id_by_reference(:parent))
114
+ assert_equal("a_component", deep_nested_component.global_id_by_reference(:parent__parent))
115
+ assert_equal("a_component__nested_one", deep_nested_component.global_id_by_reference(:parent__parent__nested_one))
116
+ assert_equal("a_component__nested_two__nested__nested", deep_nested_component.global_id_by_reference(:nested))
117
+ assert_equal("a_component__nested_two__nested__non_existing", deep_nested_component.global_id_by_reference(:non_existing))
118
+ assert_nil(deep_nested_component.global_id_by_reference(:parent__parent__parent)) # too far up
121
119
  end
122
120
 
123
121
  test "default config" do
124
- widget = Widget.new
125
- assert_equal({:config_uno => true, :config_dos => false}, widget.config)
122
+ component = Component.new
123
+ assert_equal({:config_uno => true, :config_dos => false}, component.config)
126
124
 
127
- widget = Widget.new(:name => 'widget', :config_uno => false)
128
- assert_equal({:name => 'widget', :config_uno => false, :config_dos => false}, widget.config)
125
+ component = Component.new(:name => 'component', :config_uno => false)
126
+ assert_equal({:name => 'component', :config_uno => false, :config_dos => false}, component.config)
129
127
  end
130
128
 
131
- test "dependencies calculated based on aggregations" do
132
- widget = Widget.new
133
- assert(widget.dependencies.include?('NestedWidgetOne'))
134
- assert(widget.dependencies.include?('NestedWidgetTwo'))
135
- assert(!widget.dependencies.include?('DeepNestedWidget'))
129
+ test "dependencies calculated" do
130
+ component = Component.new
131
+ assert(component.dependencies.include?('NestedComponentOne'))
132
+ assert(component.dependencies.include?('NestedComponentTwo'))
133
+ assert(!component.dependencies.include?('DeepNestedComponent'))
136
134
  end
137
135
 
138
136
  test "dependency classes" do
139
- widget = Widget.new
137
+ component = Component.new
140
138
  # not testing the order
141
- assert(%w{DeepNestedWidget NestedWidgetOne NestedWidgetTwo Widget}.inject(true){|r, k| r && widget.dependency_classes.include?(k)})
139
+ assert(%w{DeepNestedComponent NestedComponentOne NestedComponentTwo Component}.inject(true){|r, k| r && component.dependency_classes.include?(k)})
142
140
  end
143
141
 
144
- test "widget instance by config" do
145
- widget = Netzke::Base.instance_by_config({:class_name => 'Widget', :name => 'a_widget'})
146
- assert_equal(Widget, widget.class)
147
- assert_equal('a_widget', widget.name)
142
+ test "component instance by config" do
143
+ component = Netzke::Base.instance_by_config({:class_name => 'Component', :name => 'a_component'})
144
+ assert_equal(Component, component.class)
145
+ assert_equal('a_component', component.name)
148
146
  end
149
147
 
150
148
  test "js inheritance" do
151
- widget = JsInheritanceWidget.new
152
- assert(widget.js_missing_code.index("Netzke.classes.JsInheritanceWidget"))
153
- assert(widget.js_missing_code.index("Netzke.classes.Widget"))
149
+ component = JsInheritanceComponent.new
150
+ assert(component.js_missing_code.index("Netzke.classes.JsInheritanceComponent"))
151
+ assert(component.js_missing_code.index("Netzke.classes.Component"))
154
152
  end
155
153
 
156
154
  test "class-level configuration" do
157
155
  # predefined defaults
158
- assert_equal(1, Netzke::Widget.config[:pref_one])
159
- assert_equal(2, Netzke::Widget.config[:pref_two])
160
- assert_equal(-1, Netzke::InheritedWidget.config[:pref_one])
161
- assert_equal(2, Netzke::InheritedWidget.config[:pref_two])
156
+ assert_equal(1, Netzke::Component.config[:pref_one])
157
+ assert_equal(2, Netzke::Component.config[:pref_two])
158
+ assert_equal(-1, Netzke::InheritedComponent.config[:pref_one])
159
+ assert_equal(2, Netzke::InheritedComponent.config[:pref_two])
162
160
 
163
- Netzke::Widget.config[:pref_for_widget] = 1
164
- Netzke::InheritedWidget.config[:pref_for_widget] = 2
161
+ Netzke::Component.config[:pref_for_component] = 1
162
+ Netzke::InheritedComponent.config[:pref_for_component] = 2
165
163
 
166
164
  # this is broken in 1.9
167
- # assert_equal(1, Netzke::Widget.config[:pref_for_widget])
168
- # assert_equal(2, Netzke::InheritedWidget.config[:pref_for_widget])
165
+ # assert_equal(1, Netzke::Component.config[:pref_for_component])
166
+ # assert_equal(2, Netzke::InheritedComponent.config[:pref_for_component])
167
+ #
169
168
  end
170
169
 
171
170
  test "JS class names and scopes" do
172
- klass = Netzke::NestedWidgetOne
171
+ klass = Netzke::NestedComponentOne
173
172
  assert_equal("Netzke.classes", klass.js_full_scope)
174
- assert_equal("", klass.js_class_name_to_scope(klass.short_widget_class_name))
173
+ assert_equal("", klass.js_class_name_to_scope(klass.short_component_class_name))
175
174
 
176
- klass = Netzke::ScopedWidgets::SomeScopedWidget
175
+ klass = Netzke::ScopedComponents::SomeScopedComponent
177
176
  assert_equal("Netzke.classes", klass.js_default_scope)
178
- assert_equal("ScopedWidgets::SomeScopedWidget", klass.short_widget_class_name)
179
- assert_equal("ScopedWidgets", klass.js_class_name_to_scope(klass.short_widget_class_name))
180
- assert_equal("Netzke.classes.ScopedWidgets", klass.js_full_scope)
177
+ assert_equal("ScopedComponents::SomeScopedComponent", klass.short_component_class_name)
178
+ assert_equal("ScopedComponents", klass.js_class_name_to_scope(klass.short_component_class_name))
179
+ assert_equal("Netzke.classes.ScopedComponents", klass.js_full_scope)
181
180
  end
182
181
 
183
182
  end
@@ -3,7 +3,7 @@ require 'netzke-core'
3
3
  class NetzkePreferenceTest < ActiveSupport::TestCase
4
4
  test "pref to read-write" do
5
5
  p = NetzkePreference
6
- session = Netzke::Base.session
6
+ session = Netzke::Core.session
7
7
  session.clear
8
8
 
9
9
  assert_not_nil(p.pref_to_write(:test))
@@ -46,7 +46,7 @@ class NetzkePreferenceTest < ActiveSupport::TestCase
46
46
 
47
47
  test "multi-user/multi-role support" do
48
48
  p = NetzkePreference
49
- session = Netzke::Base.session
49
+ session = Netzke::Core.session
50
50
 
51
51
  admin_role = Role.create(:name => 'admin')
52
52
  user_role = Role.create(:name => 'user')