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.
- data/.autotest +1 -1
- data/.gitignore +4 -2
- data/CHANGELOG.rdoc +37 -15
- data/README.rdoc +93 -28
- data/Rakefile +5 -7
- data/TODO +24 -3
- data/app/controllers/netzke_controller.rb +70 -0
- data/app/models/netzke_preference.rb +170 -0
- data/autotest/discover.rb +2 -3
- data/features/actions.feature +13 -0
- data/features/basic.feature +7 -0
- data/features/client-server.feature +15 -0
- data/features/complex_component.feature +18 -0
- data/features/component.feature +13 -0
- data/features/component_loader.feature +31 -0
- data/features/composition.feature +32 -0
- data/features/custom_css.feature +17 -0
- data/features/file_inclusion.feature +13 -0
- data/features/inheritance.feature +19 -0
- data/features/persistence.feature +16 -0
- data/features/scopes.feature +17 -0
- data/features/step_definitions/custom_css_steps.rb +7 -0
- data/features/step_definitions/generic_steps.rb +15 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +62 -0
- data/features/support/paths.rb +45 -0
- data/generators/netzke_core/USAGE +3 -3
- data/generators/netzke_core/netzke_core_generator.rb +8 -0
- data/install.rb +1 -1
- data/javascripts/core.js +542 -499
- data/lib/generators/migration_helper.rb +32 -0
- data/lib/generators/netzke/USAGE +9 -0
- data/lib/generators/netzke/core_generator.rb +24 -0
- data/lib/netzke/actions.rb +102 -0
- data/lib/netzke/base.rb +77 -529
- data/lib/netzke/composition.rb +251 -0
- data/lib/netzke/configuration.rb +134 -0
- data/lib/netzke/core/masquerading.rb +34 -0
- data/lib/netzke/core/session.rb +30 -0
- data/lib/netzke/core/version.rb +11 -0
- data/lib/netzke/core.rb +53 -0
- data/lib/netzke/core_ext/array.rb +30 -0
- data/lib/netzke/core_ext/hash.rb +84 -0
- data/lib/netzke/core_ext/string.rb +26 -0
- data/lib/netzke/core_ext/symbol.rb +13 -0
- data/lib/netzke/core_ext/time_with_zone.rb +7 -0
- data/lib/netzke/core_ext.rb +5 -141
- data/lib/netzke/embedding.rb +21 -0
- data/lib/netzke/ext_component.rb +25 -0
- data/lib/netzke/javascript.rb +248 -0
- data/lib/netzke/persistence.rb +118 -0
- data/lib/netzke/rails/action_view_ext.rb +103 -0
- data/lib/netzke/{controller_extensions.rb → rails/controller_extensions.rb} +7 -2
- data/lib/netzke/rails/routes.rb +7 -0
- data/lib/netzke/services.rb +68 -0
- data/lib/netzke/session.rb +35 -0
- data/lib/netzke/stylesheets.rb +52 -0
- data/lib/netzke-core.rb +28 -29
- data/netzke-core.gemspec +253 -0
- data/spec/component/actions_spec.rb +94 -0
- data/spec/component/base_spec.rb +25 -0
- data/spec/component/composition_spec.rb +132 -0
- data/spec/component/javascript_spec.rb +15 -0
- data/spec/core_ext_spec.rb +16 -0
- data/spec/spec.opt +2 -0
- data/spec/spec_helper.rb +35 -0
- data/{test/app_root/db/migrate/20081222035855_create_netzke_preferences.rb → templates/core/create_netzke_preferences.rb} +4 -4
- data/test/rails_app/.gitignore +4 -0
- data/test/rails_app/Gemfile +36 -0
- data/test/rails_app/Gemfile.lock +137 -0
- data/test/rails_app/README +15 -0
- data/test/rails_app/Rakefile +7 -0
- data/test/rails_app/app/components/border_layout_panel.rb +4 -0
- data/test/rails_app/app/components/component_loader.rb +59 -0
- data/test/rails_app/app/components/component_with_actions.rb +58 -0
- data/test/rails_app/app/components/component_with_custom_css.rb +8 -0
- data/test/rails_app/app/components/component_with_included_js.rb +16 -0
- data/test/rails_app/app/components/component_with_session_persistence.rb +25 -0
- data/test/rails_app/app/components/custom.css +3 -0
- data/test/rails_app/app/components/deprecated/server_caller.rb +20 -0
- data/test/rails_app/app/components/extended_component_with_actions.rb +5 -0
- data/test/rails_app/app/components/extended_server_caller.rb +18 -0
- data/test/rails_app/app/components/included.js +5 -0
- data/test/rails_app/app/components/kinda_complex_component/basic_stuff.rb +35 -0
- data/test/rails_app/app/components/kinda_complex_component/extra_stuff.rb +16 -0
- data/test/rails_app/app/components/kinda_complex_component.rb +7 -0
- data/test/rails_app/app/components/loader_of_component_with_custom_css.rb +15 -0
- data/test/rails_app/app/components/scoped_components/deep_scoped_components/some_deep_scoped_component.rb +7 -0
- data/test/rails_app/app/components/scoped_components/extended_scoped_component.rb +5 -0
- data/test/rails_app/app/components/scoped_components/some_scoped_component.rb +5 -0
- data/test/rails_app/app/components/server_caller.rb +21 -0
- data/test/rails_app/app/components/simple_component.rb +5 -0
- data/test/rails_app/app/components/simple_tab_panel.rb +27 -0
- data/test/rails_app/app/components/simple_window.rb +3 -0
- data/test/rails_app/app/components/some_composite.rb +65 -0
- data/test/rails_app/app/components/some_ext_component.rb +8 -0
- data/test/{app_root → rails_app}/app/controllers/application_controller.rb +1 -0
- data/test/rails_app/app/controllers/components_controller.rb +12 -0
- data/test/rails_app/app/controllers/multiple_components_controller.rb +2 -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/rails_app/app/views/layouts/application.html.erb +13 -0
- data/test/rails_app/app/views/multiple_components/set_one.html.erb +3 -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 +22 -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 +7 -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 +3 -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/en.yml +5 -0
- data/test/rails_app/config/routes.rb +64 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/db/development_structure.sql +4 -0
- data/{generators/netzke_core/templates/create_netzke_preferences.rb → test/rails_app/db/migrate/20100905214933_create_netzke_preferences.rb} +1 -3
- data/test/rails_app/db/schema.rb +24 -0
- data/test/rails_app/db/seeds.rb +7 -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/rails.png +0 -0
- data/test/rails_app/public/robots.txt +5 -0
- data/test/rails_app/script/rails +6 -0
- data/test/{app_root/config/environments/postgresql.rb → rails_app/vendor/plugins/.gitkeep} +0 -0
- data/test/unit/netzke_core_test.rb +74 -75
- data/test/unit/netzke_preference_test.rb +2 -2
- metadata +176 -48
- data/lib/app/controllers/netzke_controller.rb +0 -46
- data/lib/app/models/netzke_preference.rb +0 -171
- data/lib/netzke/action_view_ext.rb +0 -81
- data/lib/netzke/base_js.rb +0 -339
- data/lib/netzke/routing.rb +0 -9
- data/test/app_root/app/models/role.rb +0 -3
- data/test/app_root/app/models/user.rb +0 -3
- data/test/app_root/config/boot.rb +0 -115
- data/test/app_root/config/database.yml +0 -31
- data/test/app_root/config/environment.rb +0 -14
- data/test/app_root/config/environments/sqlite.rb +0 -0
- 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/20090423214303_create_roles.rb +0 -11
- data/test/app_root/db/migrate/20090423222114_create_users.rb +0 -12
- data/test/app_root/lib/console_with_fixtures.rb +0 -4
- 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)
|
File without changes
|
@@ -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>
|
File without changes
|
Binary file
|
@@ -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'
|
File without changes
|
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
require 'netzke-core'
|
3
3
|
|
4
4
|
module Netzke
|
5
|
-
class
|
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
|
15
|
+
def initial_components
|
16
16
|
{
|
17
|
-
:nested_one => {:class_name => '
|
18
|
-
:nested_two => {:class_name => '
|
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
|
34
|
+
class NestedComponentOne < Base
|
35
35
|
end
|
36
36
|
|
37
|
-
class
|
38
|
-
def
|
37
|
+
class NestedComponentTwo < Base
|
38
|
+
def initial_components
|
39
39
|
{
|
40
|
-
:nested => {:class_name => '
|
40
|
+
:nested => {:class_name => 'DeepNestedComponent'}
|
41
41
|
}
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
class
|
46
|
-
def
|
45
|
+
class DeepNestedComponent < Base
|
46
|
+
def initial_components
|
47
47
|
{
|
48
|
-
:nested => {:class_name => "
|
48
|
+
:nested => {:class_name => "VeryDeepNestedComponent"}
|
49
49
|
}
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
class
|
53
|
+
class VeryDeepNestedComponent < Base
|
54
54
|
end
|
55
55
|
|
56
|
-
class
|
56
|
+
class JsInheritanceComponent < Component
|
57
57
|
end
|
58
58
|
|
59
|
-
module
|
60
|
-
class
|
59
|
+
module ScopedComponents
|
60
|
+
class SomeScopedComponent < Base
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
class
|
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
|
84
|
-
assert_equal '
|
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
|
-
|
89
|
-
assert_equal [:
|
88
|
+
component_class = Component
|
89
|
+
assert_equal [:deliver_component, :method_one, :method_two], component_class.endpoints
|
90
90
|
end
|
91
91
|
|
92
|
-
test "
|
93
|
-
|
92
|
+
test "components" do
|
93
|
+
component = Component.new(:name => 'my_component')
|
94
94
|
|
95
|
-
# instantiate
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
-
|
101
|
-
assert_kind_of
|
102
|
-
assert_kind_of
|
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
|
-
|
106
|
-
assert_equal '
|
107
|
-
assert_equal '
|
108
|
-
assert_equal '
|
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 =
|
114
|
-
|
115
|
-
assert_equal("
|
116
|
-
assert_equal("
|
117
|
-
assert_equal("
|
118
|
-
assert_equal("
|
119
|
-
assert_equal("
|
120
|
-
assert_nil(
|
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
|
-
|
125
|
-
assert_equal({:config_uno => true, :config_dos => false},
|
122
|
+
component = Component.new
|
123
|
+
assert_equal({:config_uno => true, :config_dos => false}, component.config)
|
126
124
|
|
127
|
-
|
128
|
-
assert_equal({:name => '
|
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
|
132
|
-
|
133
|
-
assert(
|
134
|
-
assert(
|
135
|
-
assert(!
|
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
|
-
|
137
|
+
component = Component.new
|
140
138
|
# not testing the order
|
141
|
-
assert(%w{
|
139
|
+
assert(%w{DeepNestedComponent NestedComponentOne NestedComponentTwo Component}.inject(true){|r, k| r && component.dependency_classes.include?(k)})
|
142
140
|
end
|
143
141
|
|
144
|
-
test "
|
145
|
-
|
146
|
-
assert_equal(
|
147
|
-
assert_equal('
|
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
|
-
|
152
|
-
assert(
|
153
|
-
assert(
|
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::
|
159
|
-
assert_equal(2, Netzke::
|
160
|
-
assert_equal(-1, Netzke::
|
161
|
-
assert_equal(2, Netzke::
|
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::
|
164
|
-
Netzke::
|
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::
|
168
|
-
# assert_equal(2, Netzke::
|
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::
|
171
|
+
klass = Netzke::NestedComponentOne
|
173
172
|
assert_equal("Netzke.classes", klass.js_full_scope)
|
174
|
-
assert_equal("", klass.js_class_name_to_scope(klass.
|
173
|
+
assert_equal("", klass.js_class_name_to_scope(klass.short_component_class_name))
|
175
174
|
|
176
|
-
klass = Netzke::
|
175
|
+
klass = Netzke::ScopedComponents::SomeScopedComponent
|
177
176
|
assert_equal("Netzke.classes", klass.js_default_scope)
|
178
|
-
assert_equal("
|
179
|
-
assert_equal("
|
180
|
-
assert_equal("Netzke.classes.
|
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::
|
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::
|
49
|
+
session = Netzke::Core.session
|
50
50
|
|
51
51
|
admin_role = Role.create(:name => 'admin')
|
52
52
|
user_role = Role.create(:name => 'user')
|